SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to Test getUserMedia Latency in Browser Console

Objective

This article explains how to test getUserMedia latency in your browser’s Developer Console. This can help troubleshoot issues with Flex Voice, Voice JS SDK, or Video JS SDK by measuring how quickly your browser can access the microphone. Running this test may reveal device, browser, or system-related issues affecting Twilio voice or video products.

 

Product

Twilio Flex 

 

Environment

legacy Twilio Console

 

User Account Permission/Role(s) Required 

No special permissions are required. You need access to a browser with Developer Console capabilities.

 

Procedure 

  1. Open your browser’s Developer Console (usually by pressing F12 or Ctrl+Shift+I).
  2. Copy and paste the following script into the Twilio Console and press Enter:

Script

(async () => {
  console.log("Requesting getUserMedia...");
  const start = performance.now();
  try {
    const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
    const end = performance.now();
    console.log("getUserMedia resolved.");
    console.log(`:stopwatch: Latency: ${(end - start).toFixed(2)} ms`);
    // Clean up the stream
    stream.getTracks().forEach(track => track.stop());
  } catch (err) {
    console.error("getUserMedia failed:", err);
  }
})();

 

Additional Information 

  • This test requests microphone access. Your browser will prompt you for permission.
  • Latency may vary depending on your device, browser, and system load.
  • The script stops all tracks after measuring latency to clean up resources.
  • For more troubleshooting tips, see related articles in the Twilio Help Center.
Have more questions? Submit a request
Powered by Zendesk