An ordered array of codec names that will be used during the test call, from most to least preferred.
Whether to enable debug logging.
Specifies which Twilio Data Center to use when initiating the test call. Please see this page for the list of available edges.
If set to true
, the test call will ignore microphone input and will use a default audio file.
If set to false
, the test call will capture the audio from the microphone.
Setting this to true
is only supported on Chrome and will throw a fatal error on other browsers
An array of custom ICE servers to use to connect media. If you provide both STUN and TURN server configurations, the test will detect whether a TURN server is required to establish a connection.
The following example demonstrates how to use Twilio's Network Traversal Service to generate STUN/TURN credentials and how to specify a specific edge location.
import Client from 'twilio';
import { Device } from 'twilio-client';
// Generate the STUN and TURN server credentials with a ttl of 120 seconds
const client = Client(twilioAccountSid, authToken);
const token = await client.tokens.create({ ttl: 120 });
let iceServers = token.iceServers;
// By default, global will be used as the default edge location.
// You can replace global with a specific edge name for each of the iceServer configuration.
iceServers = iceServers.map(config => {
let { url, urls, ...rest } = config;
url = url.replace('global', 'ashburn');
urls = urls.replace('global', 'ashburn');
return { url, urls, ...rest };
});
// Use the TURN credentials using the iceServers parameter
const preflightTest = Device.runPreflight(token, { iceServers });
// Read from the report object to determine whether TURN is required to connect to media
preflightTest.on('completed', (report) => {
console.log(report.isTurnRequired);
});
Amount of time to wait for setting up signaling connection.
Generated using TypeDoc
Options passed to PreflightTest constructor.