Effects attach to a LocalTrack of kind 'camera' — the same class
Rooms & Participants and
Audio & Video already document.
const room = await client.join('room-123');
const camera = await room.enableCamera();
const pipeline = effects.createPipeline();
pipeline.applyPreset(effects.presets.vivid);
await camera.attachEffects(pipeline);What happens on attach
- The pipeline captures frames from the live camera track into an offscreen video element.
- It picks an engine (WebGL2, Canvas2D, or passthrough) based on what this browser actually supports — see Performance.
- The processed output is a new
MediaStreamTrack.attachEffects()swaps it into the already-published sender via the SFU adapter'sreplaceTrack()— no renegotiation, no reconnect, no room restart. Audio and every other participant's connection are untouched.
await camera.detachEffects(); // reverts to the original, unmodified camera trackConstraints
- Camera tracks only. Calling
attachEffects()on a microphone or screen-share track throwsRTCErrorwith codeMEDIA_ERROR. - One pipeline per track at a time. Calling
attachEffects()again with a different pipeline detaches the first automatically. - Requires adapter support for
replaceTrack()— every current@corvidhq/rtcbuild has this; it's checked defensively so a future adapter without it fails clearly (MEDIA_ERROR) instead of silently.
What doesn't change
Existing code with no effects keeps working exactly as before:
const camera = await room.enableCamera(); // still works, unmodifiedEffects are additive — nothing about createRTCClient, Room, or
Track's existing public API changed to support this.
Errors during processing
A GPU/rendering failure never disconnects the room. It surfaces on
pipeline.on('error', ...), and the camera keeps publishing (see
Pipeline → Failure handling).
attachEffects()/detachEffects() themselves reject only for the
constraints above (wrong track kind, no adapter support).
Related
- Pipeline — the full lifecycle and event catalogue.
- Live Streaming Integration — the same mechanism, applied to a stream host.
- Performance