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

134
Visualizações
Agora Web check network quality

I am using agora for video call and streaming services. I need to check the netwok quality and notify users for slow connection.For these i wrote these functions for checking uplink and downlink network quality.this is the reference

https://docs.agora.io/en/All/API%20Reference/web/v2.6/interfaces/agorartc.networkqualitystats.html

    const rtcClient = this.client;
    
const checkQualityDrop = (
              quality: string,
              currentQuality: number,
            ): { newNetworkQuality: number; qualityDroppedNow: boolean } => {
              const newNetworkQuality = Number.parseInt(quality, 10);
              const qualityDroppedNow = currentQuality < 4
                && newNetworkQuality >= 4;
              return { newNetworkQuality, qualityDroppedNow };
            };
        
            rtcClient.on('network-quality', (quality) => {
              if (quality.uplinkNetworkQuality) {
                const {
                  newNetworkQuality,
                  qualityDroppedNow,
                } = checkQualityDrop(quality.uplinkNetworkQuality, this.uplinkNetworkQuality);
        
                if (qualityDroppedNow) {
                  this._log('network-drop', { type: 'uplink', newNetworkQuality });
                }
        
                this.uplinkNetworkQuality = newNetworkQuality;
              }
        
              if (quality.downlinkNetworkQuality) {
                const {
                  newNetworkQuality,
                  qualityDroppedNow,
                } = checkQualityDrop(quality.downlinkNetworkQuality, this.downlinkNetworkQuality);
        
                if (qualityDroppedNow) {
                  this._log('network-drop', { type: 'downlink', quality: newNetworkQuality });
                }
        
                this.downlinkNetworkQuality = newNetworkQuality;
              }
            });

Anything greater than 4 in the uplink and downlink should notify users for slow network.But here its not working for slow network.Anyway i can rewrite or improve these functions?

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

0

I'm not sure your conditional will evaluate true when the quality drops:

const qualityDroppedNow = currentQuality < 4 && newNetworkQuality >= 4;

You're checking if the previous quality was low and the new quality is improved/recovered.

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