Skip to main content

Installation

npm install videodb
# or
yarn add videodb

Quick Start

import { connect } from 'videodb';

// Connect using environment variable
const conn = connect();

// Or pass API key directly
const conn = connect({ apiKey: "your-api-key" });

Environment Variables

VariableDescription
VIDEODB_API_KEYYour API key from console.videodb.io
export VIDEODB_API_KEY="your-api-key"

TypeScript Support

Full TypeScript definitions are included. No additional packages needed.
import { connect, Video, SearchResult } from 'videodb';

const conn = connect();
const video: Video = await conn.uploadURL("default", { url: "..." });
const results: SearchResult = await video.search("query");

Module Formats

Both ESM and CommonJS are supported:
// ESM
import { connect } from 'videodb';

// CommonJS
const { connect } = require('videodb');

Basic Usage

import { connect } from 'videodb';

const conn = connect();

// Upload a video
const video = await conn.uploadURL("default", {
    url: "https://www.youtube.com/watch?v=example"
});

// Index for search
await video.indexSpokenWords();

// Search with natural language
const results = await video.search("key moments");
for (const shot of results.shots) {
    console.log(`${shot.start}s: ${shot.text}`);
}

Server Side

Use the full SDK on your backend to manage sessions, run AI pipelines, and handle webhooks. Your API key should never be exposed to the browser.
// Create a capture session and generate a client token
const cap = await conn.createCaptureSession({ endUserId: "user_123" });
const token = await conn.generateClientToken(600);

Client Side

For real-time desktop capture, install the Capture SDK on your client application. It uses short-lived tokens instead of your API key.
npm install videodb

Capture SDK Overview

Learn how to integrate real-time screen, audio, and camera capture into your application

Next Steps