The AudioContext instance to use
An ordered array of codec names that will be used during the test call, from most to least preferred.
Whether to enable debug logging.
Device class to use.
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
File input stream to use instead of reading from mic
The getRTCIceCandidateStatsReport to use for testing.
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);
});
An RTCConfiguration to pass to the RTCPeerConnection constructor during Device.setup
.
Amount of time to wait for setting up signaling connection.
Generated using TypeDoc
Options that may be passed to PreflightTest constructor for internal testing.