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

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

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