@twilio/krisp-audio-plugin
This plugin can be used with twilio-video.js to add custom noise cancellation
to LocalAudioTracks in Group Rooms. In Peer-to-Peer and Go Rooms, Krisp noise cancellation will not be enabled even when
requested by the application code. Please follow the steps below to use the plugin in your application:
- Install the plugin as a dependency by running
npm install @twilio/krisp-audio-plugin.
- Host the
node_modules/@twilio/krisp-audio-plugin/dist/ folder on your application server. We recommend that you
include the plugin's version in the path where the files are hosted in order to avoid browser caching issues when
updating the plugin to a newer version.
- In your application code, you can now enable Krisp noise cancellation as shown below.
const { connect, createLocalAudioTrack } = require('twilio-video');
const localAudioTrack = await createLocalAudioTrack({
noiseCancellationOptions: {
sdkAssetsPath: 'path/to/hosted/twilio/krisp/audio/plugin/1.0.0/dist',
vendor: 'krisp'
}
});
if (!localAudioTrack.noiseCancellation) {
} else {
const room = await connect('token', {
name: 'my-cool-room',
tracks: [localAudioTrack]
});
if (!localAudioTrack.noiseCancellation.isEnabled) {
}
}
function setNoiseCancellation(enable) {
const { noiseCancellation } = localAudioTrack;
if (noiseCancellation) {
if (enable) {
noiseCancellation.enable();
} else {
noiseCancellation.disable();
}
}
}