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

154
Vistas
WebRTC - How to add MediaStream to existing RTCPeerConnection (which has not any MediaStream attached)

I have RTCPeerConnection between 2 peers. These 2 peers can exchange messages and everything works fine in their communication. But now I would like to add a stream to this RTCPeerConnection. I do It like that:

            if(stream)if(This.myRTCMediaConnections[id][hash].addTrack){
                stream.getTracks().forEach(function(track){
                    This.myRTCMediaConnections[id][hash].addTrack(track,stream)
                })
            }
            else This.myRTCMediaConnections[id][hash].addStream(stream)

after I do so the ontrack event fires on another side:

        this.myRTCMediaConnections[id][hash].ontrack=function(e){
            if(CAE(This.callRequests,id)){
                delete This.callRequests[id]
                This.insertVideoElement(logicGroupName,targetId,id,hash,e.streams[0],!noVideo)
            }
        }

where I add video element like this:

video.srcObject=stream

However it creates an empty video tag where "loadeddata" event never fires which means that there is something wrong with the received stream.

Can anyone guide me what I am doing wrong and is there a way to add stream to existing RTCPeerConnection?

Thanks!

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