yarn add @stream-io/audio-filters-web
# or
npm install @stream-io/audio-filters-web
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:
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 = await 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
await 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"}`);
});
In action, the most straight-forward integration should look like this:
import { NoiseCancellation } from "@stream-io/audio-filters-web";
const call = client.call(type, id);
await call.get(); // or call.getOrCreate()
const noiseCancellation = new NoiseCancellation();
const isSupported = await noiseCancellation.isSupported();
if (isSupported) {
await noiseCancellation.init();
await call.microphone.enableNoiseCancellation(noiseCancellation);
}
On this page: