Skip to main content

Noise Cancellation

Noise Cancellation capabilities of our Plain-JS Video SDK can be enabled by installing our @stream-io/audio-filters-web plugin. Under the hood, this package uses the technology developed by krisp.ai.

Compatibility

This plugin currently supports only modern desktop browsers:

  • Chrome, Firefox and Edge
  • Safari 17.4.1+

Install the plugin

With your favourite package manager, run the following command:

yarn add @stream-io/audio-filters-web
# or
npm install @stream-io/audio-filters-web

Integration

In the following code snippet, we show how to check if platform is supported, initialize the plugin and enable/disable it.

import { NoiseCancellation } from '@stream-io/audio-filters-web';
import { Call } from '@stream-io/video-client';

let call: Call; // grab a reference to the call instance

// create a new NoiseCancellation instance
const noiseCancellation = new NoiseCancellation();

// check if the current platform is supported
const isSupported = noiseCancellation.isSupported();

// and initialize it
await noiseCancellation.init();

// provide the NoiseCancellation instance to the call and register the plugin
await call.microphone.enableNoiseCancellation(noiseCancellation);

// disable it and unregister the plugin
await call.microphone.disableNoiseCancellation();

// convenience methods
noiseCancellation.isSupported(); // returns true for supported platforms

noiseCancellation.disable(); // will temporarily disable NC (doesn't unregister the plugin)
noiseCancellation.enable(); // will enable NC (requires the plugin to be registered first)

// listen for state updates
const off = noiseCancellation.on('change', (v) => {
console.log(`Noise Cancellation is ${v ? 'enabled' : 'disabled'}`);
});

Did you find this page helpful?