Raven Docs

RTC Integration

camera.attachEffects()/detachEffects() — how a pipeline plugs into Raven RTC without disconnecting or renegotiating.

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

  1. The pipeline captures frames from the live camera track into an offscreen video element.
  2. It picks an engine (WebGL2, Canvas2D, or passthrough) based on what this browser actually supports — see Performance.
  3. The processed output is a new MediaStreamTrack. attachEffects() swaps it into the already-published sender via the SFU adapter's replaceTrack()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 track

Constraints

  • Camera tracks only. Calling attachEffects() on a microphone or screen-share track throws RTCError with code MEDIA_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/rtc build 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, unmodified

Effects 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).