import { RTStream } from '../core/rtstream'; import type { CaptureSessionBase, CaptureSessionChannelBase } from '../interfaces/core'; import type { CaptureSessionStatusType } from '../types/capture'; import { HttpClient } from '../utils/httpClient'; /** * CaptureSession class for managing video capture sessions * * @example * ```typescript * // Backend: Create session via Collection * const conn = connect({ apiKey: process.env.VIDEO_DB_API_KEY }); * const coll = await conn.getCollection('col-xxx'); * * const session = await coll.createCaptureSession({ * endUserId: 'user_abc', * callbackUrl: 'https://example.com/webhook', * metadata: { clientName: 'desktop-app' }, * }); * * // Generate client token (account-scoped, can be used for WS too) * const token = await conn.generateClientToken(86400); * * // After capture starts, refresh to get RTStreams * await session.refresh(); * const mics = session.getRTStream('mics'); * ``` */ export declare class CaptureSession { #private; id: string; collectionId: string; status?: CaptureSessionStatusType; endUserId?: string; clientId?: string; callbackUrl?: string; metadata?: Record; exportedVideoId?: string; rtstreams: RTStream[]; createdAt?: number; channels: CaptureSessionChannelBase[]; primaryVideoChannelId?: string; exportStatus?: string; constructor(http: HttpClient, data: CaptureSessionBase); /** * Refresh the capture session data from the server * Updates all local properties with the latest server state including RTStreams * * @example * ```typescript * // After capture becomes active, refresh to get RTStreams * await session.refresh(); * console.log(session.status); // 'active' * console.log(session.rtstreams); // RTStream[] * ``` */ refresh: () => Promise; /** * Get RTStreams by category * @param category - Category to filter by (e.g., 'mic', 'screen', 'system_audio', 'camera') * @returns Array of RTStream objects matching the category * * @example * ```typescript * const mics = session.getRTStream('mic'); * const displays = session.getRTStream('screen'); * const systemAudio = session.getRTStream('system_audio'); * * if (mics.length > 0) { * await mics[0].startTranscript(ws.connectionId); * } * ``` */ getRTStream: (category: string) => RTStream[]; /** * Get video channels in the session * @returns Array of video channel objects */ get displays(): CaptureSessionChannelBase[]; /** * Trigger export for this capture session. * * Call repeatedly to poll for completion. Returns exportStatus * of "exporting" while in progress, "exported" with videoId, * streamUrl, and playerUrl when done. * * @param videoChannelId - Optional channel ID of the video to export. Defaults to the primary video channel. * @param wsConnectionId - WebSocket connection ID for push notification when export completes (optional). * @returns Export response */ export: (videoChannelId?: string, wsConnectionId?: string) => Promise>; /** * String representation of the CaptureSession */ toString(): string; } export type { CaptureSessionBase };