You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-visual-audio-recorder

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-visual-audio-recorder - npm Package Compare versions

Comparing version

to
1.2.1

2

package.json
{
"name": "react-visual-audio-recorder",
"version": "1.2.0",
"version": "1.2.1",
"private": false,

@@ -5,0 +5,0 @@ "scripts": {

@@ -9,2 +9,3 @@ /* eslint-disable react-hooks/exhaustive-deps */

const [pause, setPause] = useState(false);
const [audioRecorderStatus, setAudioRecorderStatus] = useState("stopped");
const visualizerRef = useRef(null);

@@ -48,13 +49,20 @@ const { mimeType, ext } = useMemo(() => {

useEffect(() => {
const status = pause && record ? "pause" : !pause && record ? "recording" : "stopped";
if (handleStatus)
handleStatus(pause && record ? "pause" : !pause && record ? "recording" : "stopped");
handleStatus(status);
setAudioRecorderStatus(status);
}, [pause, record]);
function startRecording() {
onStartRecording().then(() => {
setRecord(true);
});
if (audioRecorderStatus === "stopped")
onStartRecording();
else if (audioRecorderStatus === "pause")
onResumeRecording();
setPause(false);
setRecord(true);
}
function stopRecording() {
if (["recording", "pause"].indexOf(audioRecorderStatus) !== -1)
onStopRecording();
setRecord(false);
onStopRecording();
setPause(false);
}

@@ -71,4 +79,8 @@ function resetRecording() {

function resumeRecording() {
if (audioRecorderStatus === "stopped")
onStartRecording();
else if (audioRecorderStatus === "pause")
onResumeRecording();
setRecord(true);
setPause(false);
onResumeRecording();
}

@@ -75,0 +87,0 @@ useImperativeHandle(ref, () => ({

@@ -68,2 +68,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

});
mediaRecorderInstance.addEventListener("error", (event) => {
console.error("ReactVisualAudioRecorder", event);
});
audioCtx.resume().then(() => {

@@ -171,3 +174,5 @@ const sourceNode = audioCtx.createMediaStreamSource(mediaStream);

function startRecording() {
return mediaRecorderApi.then((api) => api.mediaRecorder.start(10));
return mediaRecorderApi.then((api) => {
api.mediaRecorder.start(10);
});
}

@@ -174,0 +179,0 @@ useEffect(() => {