Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

294
Views
React-Webcam (npm package) Recording Audio but Mute playback

I am trying to use the react-webcam from npm here in order to be able to record video with audio. I want the audio to be muted whilst recording but be included when saving a recording.

The webcam is set as follows:

const videoConstraints = {
  width: 640,
  height: 480,
  facingMode: "user",
};

const audioConstraints = {
  suppressLocalAudioPlayback: true,
  noiseSuppression: true,
  echoCancellation: true,
};

const ReactWebcam = () => {
  return (
    <div className="webcam" style={{ width: 640 }}>
      <Webcam
        audio={true}
        height={100 + "%"}
        width={100 + "%"}
        screenshotFormat="image/jpeg"
        videoConstraints={videoConstraints}
        audioConstraints={audioConstraints}
      />
    </div>
  );
};

And this is used on a button click to Record and Stop the video recording:

  const handleStartCaptureClick = React.useCallback(() => {
    setCapturing(true);
    mediaRecorderRef.current = new MediaRecorder(webcamElement.current.stream, {
      mimeType: "video/webm",
    });
    mediaRecorderRef.current.addEventListener(
      "dataavailable",
      handleDataAvailable
    );
    mediaRecorderRef.current.start();
  }, [webcamElement, setCapturing, mediaRecorderRef, handleDataAvailable]);

  const handleStopCaptureClick = React.useCallback(() => {
    mediaRecorderRef.current.stop();
    setCapturing(false);
  }, [mediaRecorderRef, setCapturing]);

I have set the Webcam property audio to true and audio seems to feedback through the speakers from the mic. I have taken a look at the audioConstraints but have found very little luck here. I have found three properties for these audioConstraints whilst digging through the react-webcam.d.ts file however no combination of these properties seem to make any difference.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

So this was quite simple in the end. This Webcam component ultimately renders a video html element and therefore accepts its properties. Therefore adding the video element property muted={true} to the webcam component along with the audio={true} resulted in Audio being recorded but no play-back as I am recording. Exactly what I was after. Hope this helps someone else!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!