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

394
Views
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
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!