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

121
Views
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 answers
Answer question

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 Report
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!