Skip to contentSkip to navigationSkip to topbar

Specifying Audio Constraints


You can customize the audio capture by setting audio constraints(link takes you to an external page) on a LocalAudioTrack. Note that some audio constraints such as noiseSuppression and echoCancellation are set to true by default.

1
const { connect, createLocalAudioTrack, createLocalTracks } = require('twilio-video');
2
3
// Option 1
4
createLocalTracks({
5
audio: { noiseSuppression: false, echoCancellation: false },
6
video: true
7
}).then(localTracks => {
8
return connect('$TOKEN', {
9
name: 'my-room-name',
10
tracks: localTracks
11
});
12
}).then(room => {
13
console.log(`Connected to Room: ${room.name}`);
14
});
15
16
// Option 2
17
connect('$TOKEN', {
18
audio: { noiseSuppression: false, echoCancellation: false },
19
name: 'my-room-name',
20
video: true
21
}).then(room => {
22
console.log(`Connected to Room: ${room.name}`);
23
});
24
25
// Option 3
26
createLocalAudioTrack({
27
noiseSuppression: false,
28
echoCancellation: false
29
}).then(localTrack => {
30
console.log(`Created LocalAudioTrack: ${localTrack.name}`);
31
});