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

169
Vistas
How to set srcObject for a videotag in React while rendering?

I have a piece of code as such :

  function VideoRender() {
    const pRef = React.useRef()
    return incData.map((el, i) => {
      return (
        <div key={i}>
          <video ref={pRef} autoPlay></video>
        </div>
      )
    })
  }

I want to set mediaStream to the video tag right in the map function but apparently I run into errors. What is the proper way of rendering <video> and changing the mediaStream through srcObject in React?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

ref has a callback so you can do something like this.

return (
  <video
    autoPlay
    key={index}
    muted
    ref={(ref) => {
      if (ref) ref.srcObject = remoteStream;
    }}
  />
);
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