import type { RTStreamBase, RTStreamSceneIndexBase, RTStreamShotBase, RTStreamSearchConfig } from '../interfaces/core'; import type { IndexVisualsConfig, IndexSpokenWordsConfig } from '../types/capture'; import { HttpClient } from '../utils/httpClient'; /** * Result of exporting an RTStream recording */ export interface RTStreamExportResult { /** ID of the exported video or audio asset */ videoId: string; /** URL to stream the exported asset (may be undefined for audio) */ streamUrl?: string; /** URL to play the exported asset in a player (may be undefined for audio) */ playerUrl?: string; /** Name of the exported recording */ name?: string; /** Duration of the exported recording in seconds (may be undefined on idempotent calls) */ duration?: number; } export interface RTStreamPlayerConfig { /** Optional title shown in the player share page */ title?: string; /** Optional description shown in the player share page */ description?: string; /** Optional slug prefix for the generated player share URL */ slug?: string; } /** * RTStreamShot class for rtstream search results */ export declare class RTStreamShot { #private; rtstreamId: string; rtstreamName?: string; start: number; end: number; text?: string; searchScore?: number; sceneIndexId?: string; sceneIndexName?: string; metadata?: Record; streamUrl?: string; playerUrl?: string; constructor(http: HttpClient, data: RTStreamShotBase); /** * Generate a stream url for the shot * @returns The stream url */ generateStream: () => Promise; /** * Generate a stream url for the shot and open it in the default browser * @returns The stream url */ play: () => Promise; } /** * RTStreamSearchResult class to interact with rtstream search results */ export declare class RTStreamSearchResult { collectionId: string; shots: RTStreamShot[]; constructor(collectionId: string, shots: RTStreamShot[]); /** * Get the list of shots from the search result * @returns List of RTStreamShot objects */ getShots: () => RTStreamShot[]; } /** * RTStreamSceneIndex class to interact with the rtstream scene index */ export declare class RTStreamSceneIndex { #private; rtstreamIndexId: string; rtstreamId: string; extractionType?: string; extractionConfig?: Record; prompt?: string; name?: string; status?: string; constructor(http: HttpClient, data: RTStreamSceneIndexBase); /** * Get rtstream scene index scenes * @param start - Start time of the scenes * @param end - End time of the scenes * @param page - Page number * @param pageSize - Number of scenes per page * @returns Object with scenes array and next_page boolean */ getScenes: (start?: number, end?: number, page?: number, pageSize?: number) => Promise<{ scenes: unknown[]; nextPage: boolean; } | null>; /** * Start the scene index */ start: () => Promise; /** * Stop the scene index */ stop: () => Promise; /** * Update the scene index prompt * @param prompt - New prompt for the scene index * @returns API response with update status */ updateSceneIndex: (prompt: string) => Promise<{ success: boolean; message?: string; data?: { prompt?: string; }; } | null>; /** * Create an event alert * @param eventId - ID of the event * @param callbackUrl - URL to receive the alert callback * @param socketId - WebSocket connection ID for real-time alerts (optional) * @returns Alert ID */ createAlert: (eventId: string, callbackUrl: string, socketId?: string) => Promise; /** * List all alerts for the rtstream scene index * @returns List of alerts */ listAlerts: () => Promise; /** * Enable an alert * @param alertId - ID of the alert */ enableAlert: (alertId: string) => Promise; /** * Disable an alert * @param alertId - ID of the alert */ disableAlert: (alertId: string) => Promise; } /** * RTStream class to interact with the RTStream */ export declare class RTStream { #private; id: string; name?: string; collectionId?: string; createdAt?: string; sampleRate?: number; status?: string; /** Channel ID this rtstream is associated with */ channelId?: string; /** Media types this rtstream handles */ mediaTypes?: string[]; /** Generated playback URL for the rtstream segment */ streamUrl?: string; /** Player URL for the generated rtstream segment */ playerUrl?: string; constructor(http: HttpClient, data: RTStreamBase); /** * Connect to the rtstream */ start: () => Promise; /** * Disconnect from the rtstream */ stop: () => Promise; /** * Export the latest completed recording as a video or audio asset. * * The stream must be stopped before exporting. The call is idempotent: * calling it again returns the same asset without re-ingesting. * * @param name - Name for the exported asset (optional, defaults to "{stream_name} - Recording") * @returns Export result with the asset ID and metadata */ export: (name?: string) => Promise; /** * Generate a stream from the rtstream * @param start - Start time of the stream in Unix timestamp format * @param end - End time of the stream in Unix timestamp format * @param playerConfig - Optional player share page metadata * @returns Player URL */ generateStream: (start: number, end: number, playerConfig?: RTStreamPlayerConfig) => Promise; /** * Index scenes from the rtstream (flexible base method) * * This is the most flexible indexing method that allows full control over * extraction type and configuration. Use `indexVisuals()` or `indexAudio()` * for simpler use cases. * * @param config - Configuration for scene indexing * @param config.extractionType - Type of extraction: 'time_based', 'shot_based', or 'transcript' * @param config.extractionConfig - Configuration for extraction (varies by type) * @param config.prompt - Prompt for scene extraction (default: 'Describe the scene') * @param config.modelName - Name of the model (optional) * @param config.modelConfig - Configuration for the model (optional) * @param config.name - Name of the scene index (optional) * @param config.wsConnectionId - WebSocket connection ID for real-time updates (optional) * @returns RTStreamSceneIndex object * * @example * ```typescript * // Time-based extraction * const index = await rtstream.indexScenes({ * extractionType: 'time_based', * extractionConfig: { time: 2, frame_count: 5 }, * prompt: 'Describe what is happening', * }); * * // Transcript-based extraction * const index = await rtstream.indexScenes({ * extractionType: 'transcript', * extractionConfig: { segmenter: 'word', segmentation_value: 10 }, * prompt: 'Summarize this segment', * }); * ``` */ indexScenes: (config: { extractionType?: 'time_based' | 'shot_based' | 'transcript'; extractionConfig?: Record; prompt?: string; modelName?: string; modelConfig?: Record; name?: string; wsConnectionId?: string; }) => Promise; /** * Index visuals from the rtstream (scene indexing) * @param config - Configuration for visual indexing * @param config.batchConfig - Frame extraction config (optional) * @param config.batchConfig.type - Only "time" is supported * @param config.batchConfig.value - Window size in seconds * @param config.batchConfig.frameCount - Number of frames to extract per window * @param config.prompt - Prompt for scene description * @param config.modelName - Name of the model * @param config.modelConfig - Configuration for the model * @param config.name - Name of the visual index * @param config.socketId - WebSocket connection ID for real-time updates * @returns RTStreamSceneIndex object */ indexVisuals: (config?: Partial) => Promise; /** * List all scene indexes for the rtstream * @returns List of RTStreamSceneIndex objects */ listSceneIndexes: () => Promise; /** * Get a scene index by its ID * @param indexId - ID of the scene index * @returns RTStreamSceneIndex object */ getSceneIndex: (indexId: string) => Promise; /** * Index audio from the rtstream transcript * @param config - Configuration for audio indexing * @param config.batchConfig - Segmentation config (optional) * @param config.batchConfig.type - Segmentation type ("word", "sentence", or "time") * @param config.batchConfig.value - Segment length (words, sentences, or seconds) * @param config.prompt - Prompt for summarizing transcript segments * @param config.modelName - Name of the model * @param config.modelConfig - Configuration for the model * @param config.name - Name of the audio index * @param config.socketId - WebSocket connection ID for real-time updates * @param config.autoStartTranscript - Whether to auto-start transcript if not running (default: true) * @returns RTStreamSceneIndex object */ indexAudio: (config?: Partial) => Promise; /** * Get transcription data from the rtstream * @param config - Configuration for transcript retrieval * @param config.page - Page number (default: 1) * @param config.pageSize - Items per page (default: 100, max: 1000) * @param config.start - Start timestamp filter (optional) * @param config.end - End timestamp filter (optional) * @param config.since - For polling - only get transcriptions after this timestamp (optional) * @param config.engine - Transcription engine (optional) * @returns Transcription data with segments and metadata * * @example * ```typescript * const data = await rtstream.getTranscript({ page: 1, pageSize: 100 }); * console.log(data); * ``` */ getTranscript: (config?: { page?: number; pageSize?: number; start?: number; end?: number; since?: number; engine?: string; }) => Promise>; /** * Start transcription for the rtstream * @param socketId - WebSocket connection ID for real-time transcript updates (optional) * @param engine - Transcription engine (default: "assemblyai") * @returns Transcription status with start time */ startTranscript: (socketId?: string, engine?: string) => Promise>; /** * Stop transcription for the rtstream * @param mode - Stop mode: "graceful" (default) or "force" * @param engine - Transcription engine (default: "assemblyai") * @returns Transcription status with start and end time */ stopTranscript: (mode?: 'graceful' | 'force', engine?: string) => Promise>; /** * Search across scene index records for the rtstream * @param config - Search configuration * @returns RTStreamSearchResult object */ search: (config: RTStreamSearchConfig) => Promise; }