Docs / Web / LiveKit

LiveKit on the Web

Beautify a LiveKit JS camera track with FacevityTrackProcessor, a track processor with no LiveKit dependency.

Demo app: facevity-web-demo on GitHub

LiveKit JS supports track processors on local video tracks. FacevityTrackProcessor implements LiveKit’s TrackProcessor shape, so it plugs in with one call and adds no LiveKit dependency to the package.

1. Requirements

  • @facevity/web set up as in the quick start
  • livekit-client 2.x
  • A licence that lists the page’s domain

2. Set the processor

import { Room, createLocalVideoTrack } from 'livekit-client';
import { Facevity, FacevityTrackProcessor, BeautyParams } from '@facevity/web';

const fv = await Facevity.initialize({ licenseToken, assetsBaseUrl: '/facevity/' });
fv.setParams(BeautyParams.NATURAL);

const room = new Room();
await room.connect(serverUrl, accessToken);

const track = await createLocalVideoTrack({ facingMode: 'user' });
await track.setProcessor(new FacevityTrackProcessor(fv));
track.attach(document.getElementById('local') as HTMLVideoElement);
await room.localParticipant.publishTrack(track);

The processor can be set before or after publishing. Remote participants receive the processed track.

3. Turn it off or tear down

await track.stopProcessor();     // back to the raw camera, the track stays published
fv.release();
await room.disconnect();

Next: WebRTC on the Web · all platforms

Need help with an integration? Contact the Facevity team. We answer integration questions during trials.