Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda