github twilio/twilio-video.js 2.8.0-beta.1

2.8.0-beta.1 (September 28, 2020)

New Features

  • This beta release adds a new experimental API testPreflight to help test the connectivity with twilio servers.
    The API connects two participants to the video room using supplied tokens. It publishes synthetic audio and video
    tracks from one participant. It also ensures that other participant receives media on those tracks.
    After successfully verifying the connectivity, it generates a report about statistics of the connection.

Few things to note:

  • The tokens used for the connection must specify the room for the test. This must be a unique test room
    and not to be used for regular operations.
  • Since the API connects participants to the room it would incur the typical cost for 2 mins of usage. The actual cost
    would depend on the room type used.
  • This function uses web audio API's.
    Browser's autoplay policies sometimes require user action before accessing these APIs. Please ensure that this API
    is called in response to user action like a button click.
  • preflightTest emits failed event to indicate test failures. Please refer to
    this guide
    for interpreting common errors.

Report generated by preflightTest on completed can be used to determine the quality of connection. Some of the useful stats and their optimal values are listed below.

Stat Explanation Optimal values
jitter Packets delay variation on audio tracks < 30ms
packetLoss Packet loss as a percent of total packets sent < 1%
networkQuality Network quality score (1 to 5), available only for group rooms > 3
rtt Round trip time in milliseconds. < 200ms

We encourage you to reach out to us with any feedback with the usage of the API.

const Video = require('twilio-video');
const tempRoomName = 'test-room-' + Date.now();
const publisherToken = getAccessToken('alice', tempRoomName);
const subscriberToken = getAccessToken('bob', tempRoomName);

const preflightTest = Video.testPreflight(publisherToken, subscriberToken);

preflightTest.on('completed', function(report) {
  console.log("Test completed in " + report.testTiming.duration + " milliseconds.");
  console.log(" It took " + report.networkTiming.connect.duration + " milliseconds to connect");
  console.log(" It took " + report.networkTiming.media.duration + " milliseconds to receive media");

  // network score is available only for group rooms.
  console.log(" Your network score was: " + report.stats.networkQuality);
});

preflightTest.on('failed', function(error) {
  console.log("Test failed:" + error);
});

preflightTest.on('progress', function(progressState) {
  console.log(progressState);
});

Bug Fixes

  • Fixed a bug where LocalTrack event listeners were not being cleaned up after disconnecting from a room. (JSDK-2985)
latest releases: 2.14.0-rc1, 2.13.0, 2.13.0-rc5...
5 months ago