It samples frames from remote participants’ video tracks, sends them to the Dataspike API for analysis, and publishes lightweight detection events back into the room or to a custom callback.
Summary
- Manipulation Recognition: Detects face swaps, compositing, and AI‑generated overlays.
- AI Model Detection: Identifies content associated with modern generative systems (e.g., Veo, Sana, Flux).
- Adaptive Sampling: Selectively samples frames to maintain real‑time responsiveness while minimizing bandwidth.
- Realtime Alerts: Emits compact detection signals for immediate action.
- Privacy by Design: No video or metadata is stored; frames are end‑to‑end encrypted in transit; results are short‑lived.
Installation
Prerequisites
- Dataspike API Key — set as an environment variable:
- LiveKit credentials (for your room/agent):
Quick Start (Agent Worker)
The example below shows a ready-to-use LiveKit Agent Worker that integrates the Dataspike detector.It connects to a LiveKit room, attaches the deepfake detection plugin, and streams frames for real-time analysis. Simply copy the snippet into a new file (for example,
agent_worker.py), set your environment variables, and run it.
Default Alert Behavior
By default, the detector automatically subscribes to remote participant video tracks and begins adaptive frame sampling. Detection results are published back into the LiveKit room’s data channel as lightweight JSON alerts under the topic deepfake_alert. Example default payload:Custom Notification Channels
Developers can override this default behavior to route alerts anywhere — for example, sending them to a webhook, Slack, a moderation API, or your own analytics pipeline. You can achieve this by passing a custom async callback (notification_cb) when creating the detector:Flexible integration: You have full control over how alerts are processed, logged, or relayed. For example, you can store results in a database, call an external moderation API, or send messages to your in-house alerting system.
Configuration
You can configure the detector via constructor parameters or environment variables.| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | env:DATASPIKE_API_KEY | Dataspike API key. Required unless set via env. |
normal_fps | float | 0.2 | Baseline sampling rate (frames/second). |
burst_fps | float | 1.0 | Elevated sampling rate when state is suspicious/alert. |
quality | int | 75 | JPEG quality used for encoded frames (0–100). |
notification_cb | Callable | None | Optional async callback invoked for each result event. If omitted, events are published to the room data channel. |
How It Works
- Track discovery — When a remote participant’s video track is subscribed, the detector creates an internal
InputTrackfor sampling. - Adaptive sampling — Frames are emitted at
normal_fpsduring CLEAR state; if results indicate elevated risk (SUSPICIOUS/ALERT), sampling increases up toburst_fps. - Encoding — Frames are JPEG‑encoded (configurable
quality) and placed on a bounded async queue to avoid backpressure. - Streaming — Frames are streamed via a secure WebSocket to the Dataspike API; detection signals are returned in real time.
- Notifications — Incoming results update per‑track state and trigger either the default data‑channel publisher or your custom callback.
Privacy & Security
- No storage — The plugin and server do not store video data or metadata.
- E2E encryption in transit — All frame transmissions are encrypted; only short‑lived detection signals are returned.
- Principle of least data — Only the encoded frame and minimal metadata required for analysis are transmitted.
- Key management — Provide
DATASPIKE_API_KEYvia environment variables or a secret manager; never hard‑code secrets.
Troubleshooting
- No events received — Confirm the agent joined the room and remote participants are publishing video tracks. Check data channel permissions.
- High latency — Reduce
qualityorburst_fps; ensure the network path to the Dataspike API is low‑latency. - Rate/bandwidth constraints — Lower
normal_fpsand/or enable selective subscription to fewer tracks. - Auth errors — Ensure
DATASPIKE_API_KEYis set in the environment of the worker process. - Reconnect loops — The detector auto‑reconnects with exponential backoff; inspect logs for repeated auth or network failures.