yarn add @livekit/track-processors
This package exposes BackgroundBlur
and VirtualBackground
as pre-prepared processor pipelines.
import { BackgroundBlur } from '@livekit/track-processors';
const videoTrack = await createLocalVideoTrack();
await videoTrack.setProcessor(BackgroundBlur(10));
room.localParticipant.publishTrack(videoTrack);
async function disableBackgroundBlur() {
await videoTrack.stopProcessor();
}
A track processor consists of one or multiple transformers.
// src/index.ts
export const VirtualBackground = (imagePath: string) => {
const pipeline = new ProcessorPipeline([new BackgroundTransformer({ imagePath })]);
return pipeline;
};
- BackgroundTransformer (can blur background or use a virtual background);