Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

295
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda