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

200
Vistas
Agora Audio Call Local Voice not working and local users mic muted automatically

I have implemented audio call functionality using Agora Javascript SDK 4. in one of my sites and facing an issue that local user voice is not streaming to remote users and when I disable and enable mic using Browser console it works, I don't know why this happening Here is the code I am using 4.6.3 and below CDN I have used.

CDN :

<script src="https://download.agora.io/sdk/release/AgoraRTC_N-4.6.3.js"></script>

var rtc = {
    client: null,
    localAudioTrack: null,
};
let searchParams = new URLSearchParams(window.location.search)
let channel = searchParams.get('cid')
var options = {
    appId: "<appId>",
    channel: channel,
    token: null,
};

async function startBasicCall() {
    rtc.client = AgoraRTC.createClient({ mode: "rtc", codec: "vp8" });
    const uid = await rtc.client.join(options.appId, options.channel, options.token, null);
    rtc.localAudioTrack = await AgoraRTC.createMicrophoneAudioTrack();
    rtc.localAudioTrack.setEnabled(true);
    await rtc.client.publish([rtc.localAudioTrack]);
    rtc.client.on("user-published", async (user, mediaType) => {
        await rtc.client.subscribe(user, mediaType);
        if (mediaType === "audio") {
            const remoteAudioTrack = user.audioTrack;
            remoteAudioTrack.play();
        }
    });
    rtc.client.on("user-unpublished", user => {
        const playerContainer = document.getElementById(user.uid);
        playerContainer.remove();
    }); 
}

async function leaveCall() {
    rtc.localAudioTrack.close();
    await rtc.client.leave();
}

if(channel != "" && channel != null){
    startBasicCall();
}

I have a dynamic channel Name that will be collected from the URL. I have 2 users User A: calls User B User B : B is able to hear voice of A but B users voice not streaming to A so A is not able to hear anything

But when i run below code on user A's Browser console then both user can hear each others voice rtc.localAudioTrack.setEnabled(false); //this is for muting rtc.localAudioTrack.setEnabled(true); // this is for unmute

FYI : I have used same code for both end.

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

0

I think the problem is because you're attaching event handlers after the channel join. You should do it before you invoke the join method.

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