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

196
Vistas
Party calls with peerjs

I'm trying to make a voice chat using some particular voice channels. I'm having trouble getting more than two users to interact at a time though.

From what I understand when it creates a call it seems that somehow it interrupts the previous one.

I've tried following Multi Party - Video Conference with peerJS

and convert it to make it compatible with my

Would anyone know the solution?

// when the user connect to the channel
  socket.on('user-connected', (data) => {
    if(document.querySelector(`#channel-user-${data.user_id}`) !== null) return;
    const connectedUsers = document.querySelectorAll(`#channel-image-${data.channel_id}`)[0];

    if (data.user_id === user_id && connectedUsers !== undefined) {
      for (let i = 0; i < connectedUsers.children.length; i++) { 

        // get all the users inside the channel
        const element = connectedUsers.children[i];
        const otherUser = element.id.split('-')[element.id.split('-').length - 1] 
        //this is the peer id

        // call it
        const call = peer.call(otherUser, localStream);
        call.on('stream', stream => {
          remoteStream = stream;
          const audio = document.createElement('audio');
          audio.srcObject = stream;
          audio.play();
        })
      }
    }
  //when receiving a call answer and play it
  peer.on('call', call => {
    console.log('Received call by', call.peer);
    call.answer(localStream);
    call.on('stream', stream => {
      remoteStream = stream;
      const audio = document.createElement('audio');
      audio.srcObject = stream;
      audio.play();
    })
  });
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