Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@twilio/rtc-diagnostics

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twilio/rtc-diagnostics

Various diagnostics functions to help analyze connections to Twilio

  • 1.0.0-preview3
  • alpha
  • npm
  • Socket score

Version published
Weekly downloads
4K
decreased by-36.8%
Maintainers
1
Weekly downloads
 
Created
Source

Voice Diagnostics SDK

The Voice Diagnostics SDK provides functions to test input and output audio devices, and the functionality to test network bandwidth requirements towards Twilio’s servers.

This SDK requires the use of Twilio NTS to perform the network tests. Using NTS will incur charges as per NTS pricing.

Features

  • Input audio device tests include volume calculation
  • Output audio device tests are done by playing a sound file to the selected device
  • Bandwidth requirements tests

Prerequisites

  • A Twilio account. Sign up for free here
  • Node.js v10+
  • NPM v6+ (comes installed with newer Node versions)

Installation

Building the project locally

# Clone repository
git clone git@github.com:twilio/rtc-diagnostics.git
cd rtc-diagnostics

# Install dependencies
npm install

# Build the artifacts under dist folder
npm run build

NPM

You can install directly from npm.

npm install @twilio/rtc-diagnostics --save

Or install from a local directory.

npm install /local-path-to-repo/rtc-diagnostics

Using this method, you can import rtc-diagnostics like so:

import { testBitrate } from '@twilio/rtc-diagnostics';

Script tag

You can also include rtc-diagnostics.js directly in your web app using a <script> tag.

<script src="https://my-server-path/rtc-diagnostics.js"></script>

Using this method, rtc-diagnostics.js will set a browser global:

const { testBitrate } = Twilio.Diagnostics;

Usage

The following are examples for running tests. For more information, please refer to the API Docs

BitrateTest Example

import { testBitrate } from '@twilio/rtc-diagnostics';

const bitrateTest = testBitrate({
 iceServers: [{
   credential: 'bar',
   username: 'foo',
   urls: 'turn:global.turn.twilio.com:3478?transport=udp',
 }],
});

bitrateTest.on('bitrate', (bitrate) => {
 console.log(bitrate);
});

bitrateTest.on('error', (error) => {
 console.log(error);
});

bitrateTest.on('end', (report) => {
 console.log(report);
});

setTimeout(() => {
 bitrateTest.stop();
}, 10000);

See BitrateTest.Options for more information for how to obtain the urls values

InputTest Example

import { testInputDevice, InputTest } from '@twilio/rtc-diagnostics';

const outputDeviceTest = testInputDevice({
  deviceId: ...,
});

inputDeviceTest.on(InputTest.Events.Volume, (volume) => {
  console.log(volume);
});

inputDeviceTest.on(InputTest.Events.Error, (error) => {
  console.error(error);
});

inputDeviceTest.on(InputTest.Events.End, (report) => {
  console.log(report);
});

setTimeout(() => {
  inputDeviceTest.stop();
}, 10000);

OutputTest Example

import { testOutputDevice, OutputTest } from '@twilio/rtc-diagnostics';

const outputDeviceTest = testOutputDevice({
  deviceId: ...,
});

outputDeviceTest.on(InputTest.Events.Volume, (volume) => {
  console.log(volume);
});

outputDeviceTest.on(InputTest.Events.Error, (error) => {
  console.error(error);
});

outputDeviceTest.on(InputTest.Events.End, (report) => {
  console.log(report);
});

setTimeout(() => {
  outputDeviceTest.stop();
}, 10000);

License

See LICENSE.md

Keywords

FAQs

Package last updated on 18 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc