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

398
Vistas
I'm getting a error where webrtc is not returning the current videos that is being broadcasted, Im using react

I have a different component that is responsible for streaming and this component is for listing the streams out so eventually they can be selected. the problem here is the streams are here in the event object but I can't view them the peerConnection.ontrack actually working because I was able to get the streams. but the problem is the srcObject uncaught TypeError: Cannot add property srcObject, object is not extensible that is the error it returning

import React, { useEffect, useContext, useState, useRef } from 'react';

import  { io }  from 'socket.io-client'
const socket = io('http://localhost:8080')


let peerConnection;



const Watcher = () => {
  const [myStream, setStream] = useState([]);

  const appCxt = useContext(AppContext)

  const myVideo = useRef(null)
  const config = appCxt.config

  useEffect(() => {

    socket.on("offer", (id, description) => {

      peerConnection = new RTCPeerConnection(config);
      peerConnection
        .setRemoteDescription(description)
        .then(() => peerConnection.createAnswer())
        .then(sdp => peerConnection.setLocalDescription(sdp))
        .then(() => {
          socket.emit("answer", id, peerConnection.localDescription);
        });


       
          peerConnection.ontrack = (event) => {

             myVideo.current.srcObject = event.streams[0]
          };
          peerConnection.onicecandidate = event => {
            if (event.candidate) {
              socket.emit("candidate", id, event.candidate);
            }
          };
    
        });
        socket.on("candidate", (id, candidate) => {
          peerConnection
            .addIceCandidate(new RTCIceCandidate(candidate))
            .catch(e => console.error(e));
        });
        
        socket.on("connect", () => {
          socket.emit("watcher");
        });
        socket.on("broadcaster", () => {
          socket.emit("watcher");
        });
      }, [])
    
      return (
        <>
        </>
      )
    }
    ```
    
    
about 4 years ago · Juan Pablo Isaza
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