A complete example showing real-time media capture, indexing, and transcription using the VideoDB Node.js SDK.
This app runs as a single script that demonstrates the full VideoDB Capture workflow:
- Creates a capture session with WebSocket for real-time events
- Captures screen, mic, and system audio using the native capture client
- Performs live transcription and audio/visual indexing on all streams
- Prints real-time results to the console
- Node.js 18+
- VideoDB API Key: Get one from console.videodb.io
-
Install Dependencies:
npm install
-
Configure Environment: Copy
.env.exampleto.envand add your API key:cp .env.example .env # Edit .env and set VIDEODB_API_KEY
npm startThe app will:
- Connect to VideoDB and create a capture session
- Request permissions for microphone and screen capture
- Start recording mic, system audio, and screen
- Start transcription and indexing on all streams
- Print real-time results via WebSocket
Press Ctrl+C to stop.
- The script creates a capture session and generates a client token
- The native capture client discovers channels (mic, display, system audio)
- Channels with
record: truesave the recording to VideoDB after capture stops - Once active, transcription and audio indexing start on both audio streams (mic + system audio)
- Visual indexing starts on the display stream
- Real-time results stream back via WebSocket
============================================================
VideoDB Capture - Node.js Quickstart
============================================================
Connecting to VideoDB...
Using collection: c-xxx
Connecting WebSocket...
WebSocket connected: ws_id
Creating capture session...
Session created: cap-xxx
Client token generated
Requesting permissions...
Discovering channels...
- mic:default (audio): Default Microphone
- display:1 (video): Built-in Display
- system_audio:default (audio): System Audio
Starting capture with 3 channel(s):
- mic:default
- display:1
- system_audio:default
Capture started!
Waiting for session to become active...
Session status: active
Starting audio indexing on: rts-xxx
Audio indexing started: rts-xxx
Starting audio indexing on: rts-yyy
Audio indexing started: rts-yyy
Starting visual indexing on: rts-zzz
Visual indexing started: rts-zzz
============================================================
Recording... Press Ctrl+C to stop
============================================================
[Transcript:mic] real-time transcription streams live...
[Transcript:system_audio] real-time transcription streams live...
**************************************************
[Audio Index:mic] Summary of what is being discussed
**************************************************
**************************************************
[Audio Index:system_audio] Summary of what is being discussed
**************************************************
**************************************************
[Visual Index:screen] One-sentence description of screen content
**************************************************
Press Enter to stop recording gracefully, or Ctrl+C to force quit. The app will:
- Stop the capture session
- Shut down the native binary
- Close the WebSocket connection
Wait a few seconds for the session to finalize. Once exported, you can view the video in the VideoDB console.
| Variable | Required | Description |
|---|---|---|
VIDEODB_API_KEY |
Yes | Your VideoDB API key from console.videodb.io |
VIDEODB_COLLECTION_ID |
No | Collection ID (defaults to default) |
- Error:
VIDEODB_API_KEY is required- Make sure you've created a
.envfile with your API key - Verify the API key is valid at console.videodb.io
- Make sure you've created a
- Error: Permission request failed
- Grant system permissions for microphone and screen recording when prompted
- On macOS: Check System Settings > Privacy & Security
- The native capture binary may not be running properly
- Try reinstalling:
npm install
- Make sure you're generating audio or visual activity to be indexed
- Verify the capture session status shows as "active"
- Check that the WebSocket connection was established successfully