import { ReframeMode, ReframePreset } from '../constants'; import type { IVideo, VideoBase } from '../interfaces/core'; import { Image } from '../core/image'; import { SceneCollection } from '../core/scene'; import { SceneCollectionData } from '../types/response'; import type { Timeline, Transcript } from '../types/video'; import { SnakeKeysToCamelCase } from '../utils'; import { HttpClient } from '../utils/httpClient'; import { SearchResult } from './search/searchResult'; import { ExtractSceneConfig, IndexSceneConfig, SubtitleStyleProps } from '../types/config'; import { SearchType, IndexType } from '../types/search'; import { SceneIndexRecords, SceneIndexes } from '../types'; /** * The base Video class * @remarks * Use this to initialize a video stored in videoDB */ export declare class Video implements IVideo { #private; readonly id: string; readonly collectionId: string; readonly length: number; name: string; readonly description?: string; readonly size: string; readonly streamUrl: string; readonly userId: string; readonly playerUrl: string; thumbnail?: string; transcript?: Transcript; /** * Initializes a videoDB Instance * @param http - HttpClient object * @param data - Data needed to initialize a video instance */ constructor(http: HttpClient, data: VideoBase); /** * Search for a query in the video * @param query - Search query * @param searchType - [optional] Type of search to be performed * @param indexType - [optional] Index Type * @param resultThreshold - [optional] Result Threshold * @param scoreThreshold - [optional] Score Threshold * @param dynamicScorePercentage - [optional] Percentage of dynamic score to consider * @param filter - [optional] Additional metadata filters * @param sortDocsOn - [optional] Sort docs within each video by "score" or "start" */ search: (query: string, searchType?: SearchType, indexType?: IndexType, resultThreshold?: number, scoreThreshold?: number, dynamicScorePercentage?: number, filter?: Array>, sortDocsOn?: string) => Promise; /** * Update the video's metadata * @param options - Fields to update * @param options.name - New name for the video */ update: (options: { name?: string; }) => Promise; /** * Returns an empty promise that resolves when the video is deleted * @returns A promise that resolves when delete is successful * @throws an InvalidRequestError if the request fails */ delete: () => Promise>>; /** * Generates a new streaming URL with the given timeline. * @param timeline - Of the format [[start, end], [start, end]...] * @returns a streaming URL */ generateStream: (timeline?: Timeline) => Promise; /** * Generate the thumbnail of the video * @param time - Optional time in seconds to generate thumbnail at specific frame * @returns Image object if time is provided, else the thumbnail URL string */ generateThumbnail: (time?: number) => Promise; /** * Fetches the transcript of the video if it exists, generates one * if it doesn't. * @param start - Start time in seconds (must be >= 0 and <= end) * @param end - End time in seconds (must be >= 0 and >= start) * @param segmenter - How to split the transcript into segments. * Must be one of `Segmenter.word` (default, one segment per word), * `Segmenter.sentence` (one segment per sentence), or * `Segmenter.time` (fixed-duration segments controlled by `length`) * @param length - Duration in seconds for each segment when * segmenter is `Segmenter.time` (default 1) * @param force - Force re-fetch transcript from the server, bypassing the local cache * @throws {VideodbError} If segmenter is not a valid value, or if * start/end are negative or start > end * @returns The transcript data */ getTranscript: (start?: number, end?: number, segmenter?: string, length?: number, force?: boolean) => Promise; /** * Generate transcript for the video using POST method * @param force - Force generate new transcript even if one exists * @returns Success status or transcript data */ generateTranscript: (force?: boolean, languageCode?: string) => Promise<{ success: boolean; message: string; } | Transcript>; /** * Semantic indexing of spoken words in the video * @param languageCode - Language code of the video (optional) * @param segmentationType - Segmentation type used for indexing (optional, default: sentence) * @param force - Force to index the video (optional) * @param callbackUrl - URL to receive the callback (optional) * @returns Whether the process was successful */ indexSpokenWords: (languageCode?: string, segmentationType?: string, force?: boolean, callbackUrl?: string) => Promise<{ success: boolean; message?: string; }>; /** Camelcase version of SceneCollectionData after HttpClient conversion */ _formatSceneCollectionData: (sceneCollectionData: SnakeKeysToCamelCase) => SceneCollection; extractScenes: (config?: Partial) => Promise; listSceneCollection: () => Promise<{ config: object; sceneCollectionId: string; status: string; }[]>; getSceneCollection: (sceneCollectionId: string) => Promise; deleteSceneCollection: (sceneCollectionId: string) => Promise>; /** * Index the scenes of the video * @param config.extractionType - The type of extraction (shot_based, time_based, transcript) * @param config.extractionConfig - Configuration parameters for extraction * @param config.prompt - The prompt for the extraction * @param config.metadata - Additional metadata for the scene index * @param config.modelName - The model name for the extraction * @param config.modelConfig - The model configuration for the extraction * @param config.name - The name of the scene index * @param config.scenes - The scenes to be indexed * @param config.callbackUrl - The callback url * @returns The scene index id */ indexScenes: (config?: Partial) => Promise; listSceneIndex: () => Promise; getSceneIndex: (sceneIndexId: string) => Promise; deleteSceneIndex: (sceneIndexId: string) => Promise>; /** * Index visuals (scenes) from the video * @param prompt - Prompt for scene description * @param batchConfig - Frame extraction config with keys: * - type: Extraction type ("time" or "shot"). Default is "time". * - value: Window size in seconds (for time) or threshold (for shot). Default is 10. * - frameCount: Number of frames to extract per window. Default is 1. * - selectFrames: Which frames to select (e.g., ["first", "middle", "last"]). Default is ["first"]. * @param modelName - Name of the model * @param modelConfig - Configuration for the model * @param name - Name of the visual index * @param callbackUrl - URL to receive the callback (optional) * @returns The scene index id */ indexVisuals: (config?: { prompt?: string; batchConfig?: { type?: 'time' | 'shot'; value?: number; frameCount?: number; selectFrames?: string[]; }; modelName?: string; modelConfig?: Record; name?: string; callbackUrl?: string; }) => Promise; /** * Index audio by processing transcript segments through an LLM * * Segments the video transcript, processes each segment with the given * prompt using the specified model, and indexes the results as scene * records for semantic search. * * @param prompt - Prompt for processing transcript segments (optional) * @param modelName - LLM tier to use (e.g. "basic", "pro", "ultra") (optional) * @param modelConfig - Model configuration (optional) * @param languageCode - Language code for transcription (optional) * @param batchConfig - Segmentation config with keys: * - type: Segmentation type ("word", "sentence", or "time") * - value: Segment length (words, sentences, or seconds) * Defaults to { type: "word", value: 10 } * @param name - Name for the scene index (optional) * @param callbackUrl - URL to receive the callback (optional) * @returns The scene index id */ indexAudio: (config?: { prompt?: string; modelName?: string; modelConfig?: Record; languageCode?: string; batchConfig?: { type?: 'word' | 'sentence' | 'time'; value?: number; }; name?: string; callbackUrl?: string; }) => Promise; /** * Overlays subtitles on top of a video * @returns an awaited stream url for subtitled overlayed video * */ addSubtitle: (config?: Partial) => Promise; /** * Generates a new playable stream URL with the given timeline. * @returns a URL that can be opened in browser */ play: () => string; /** * Remove the video storage * @returns A promise that resolves when the removal is successful */ removeStorage: () => Promise>>; /** * Get all the thumbnails of the video * @returns List of Image objects */ getThumbnails: () => Promise; /** * Get plain text transcript for the video * @param start - Start time in seconds * @param end - End time in seconds * @returns Full transcript text as string */ getTranscriptText: (start?: number, end?: number) => Promise; /** * Translate transcript of a video to a given language * @param language - Language to translate the transcript * @param additionalNotes - Additional notes for the style of language * @param callbackUrl - URL to receive the callback (optional) * @returns List of translated transcript */ translateTranscript: (language: string, additionalNotes?: string, callbackUrl?: string) => Promise; /** * Insert a video into another video at a specific timestamp * @param insertVideo - The video to be inserted * @param timestamp - The timestamp where the video should be inserted * @returns The stream url of the combined video */ insertVideo: (insertVideo: Video, timestamp: number) => Promise; /** * Get meeting information associated with the video * @returns Meeting object if meeting is associated, null otherwise */ getMeeting: () => Promise; /** * Reframe video to a new aspect ratio with optional object tracking * @param start - Start time in seconds (optional) * @param end - End time in seconds (optional) * @param target - Target format - preset string or {width, height} * @param mode - Reframing mode - "simple" or "smart" * @param callbackUrl - URL to receive callback when processing completes * @returns Video object if no callbackUrl, undefined otherwise */ reframe: (options?: { start?: number; end?: number; target?: (typeof ReframePreset)[keyof typeof ReframePreset] | { width: number; height: number; }; mode?: (typeof ReframeMode)[keyof typeof ReframeMode]; callbackUrl?: string; }) => Promise