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

123
Visualizações
WebRTC to stream new Audio

I'm building a web application, where music/audio is playing from an object using new Audio(). On another tab I'd like to listen to the music through WebRTC. I already have the WebRTC established, and I can confirm it works with microphones on both sides.
When I try to change the "music" tab's microphone to a mediastream of a "new Audio()", it no longer works and the listeners-tab is silent.

I'm trying it like this:

audio = new Audio();
audio.src = someArray['audiosrc'];
mediaStream = audio.captureStream()
audio.play();
webRTC.addTrack(mediaStreams.getAudioTracks()[0]);

I have no clue why the listeners-tab is completely silent... Is there anything wrong with the code? I don't see any errors in the console, I don't see any errors on the receiving side, but it still does not want to "stream" the audio.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

When you already have a WebRTC connection established and you want to add a new track to it, renegotiation needs to be done so the browser knows how to encode the track.

Renegotiation is pretty much creating an SDP offer and receiving an answer just like during the first connection setup.

See the note on top of the page: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTrack

about 4 years ago · Juan Pablo Isaza Relatório
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