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

157
Vistas
WebRTC & Web Audio API - workaround for missing createMediaStreamTrackSource in chromium browsers?

I have a JS-based web gui that uses WebRTC for audio exchange with a server. The WebRTC negotiation works fine, and with a single set of audio tracks (incoming and outgoing) the audio components work fine.

However I've found an issue where I can't add more than the first received track to my web audio context.

According to the documentation, the RTCTrackEvent event for my WebRTC connection returns an event that contains both event.streams and event.track. The streams object will always be the same for a single RTC connection (as far as I can tell), while the track object is the unique track I'm trying to play.

I figured this out because I was originally calling audioCtx.createMediaStreamSource(event.streams[0]) for each received track, thinking that the streams object contained the new track audio. However, that just ended up with multiple copies of the first track playing on top of each other. See the "track ordering" section here for the reason behind that.

The proper way to add & play the new track (as far as I can tell) would be to call createMediaStreamTrackSource(event.track) and connect the resulting node to my web audio flowgraph. However, this function is only supported in Firefox as of right now. Does that mean there's truly no way to add additional received tracks from a WebRTC connection to a web audio flowgraph on other browsers? That seems unlikely. Who here knows the secret trick to making this work?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Well that was actually much simpler than I thought it would be. All you need to do to work around this is create a new MediaStream from the track you need to add:

var newStream = new MediaStream( [ event.track ] ); // must be an array
var newSource = audioCtx.createMediaStreamSource(newStream);
newSource.connect(audioCtx.destination);
about 4 years ago · Juan Pablo Isaza Denunciar
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