/** * A video provider for tests: jobs that finish after a set number of polls, and videos made of * bytes on the fly, as large as asked, streamed a chunk at a time. */ import type { VideoCallContext, VideoContent, VideoJobError, VideoJobRef, VideoJobState, VideoProvider, VideoProviderCapabilities, VideoProviderInfo, VideoProviderRequest } from './index.js'; /** One job the mock holds. */ export interface MockVideoJob { /** What was asked. */ request: VideoProviderRequest; /** Polls it has answered. */ polls: number; /** Set once it is cancelled. */ cancelled?: boolean; /** Set once its videos are deleted. */ removed?: boolean; } /** Options for `MockVideoProvider`. */ export interface MockVideoProviderOptions { /** Its name. Defaults to `mock`. */ name?: string; /** Its models. Defaults to `mock-video`. */ models?: readonly string[]; /** Overrides what it declares it supports. */ capabilities?: Partial; /** Polls a job answers `running` before it completes. Defaults to 1. */ pollsToComplete?: number; /** Fails each job with this error, or with what the function returns for its request. */ fail?: VideoJobError | ((request: VideoProviderRequest) => VideoJobError | undefined); /** Each video's size in bytes. Defaults to 64 KiB. */ bytes?: number; /** The size of each streamed chunk. Defaults to 64 KiB. */ chunkBytes?: number; /** Jobs shared between instances, as two processes share one provider. Defaults to the instance's own. */ jobs?: Map; } /** * A stand-in video backend. Its videos begin with an MP4 `ftyp` box and then hold a repeating * pattern, so they pass the conformance suite's checks without being playable. Pass one `jobs` map * to two instances to stand for two processes in front of one provider. */ export declare class MockVideoProvider implements VideoProvider { private readonly options; /** Provider name, capabilities, and models. */ readonly info: VideoProviderInfo; /** Every job, by id. */ readonly jobs: Map; /** Videos this instance has streamed. */ downloads: number; private nextId; constructor(options?: MockVideoProviderOptions); /** Starts a job. */ submit(request: VideoProviderRequest, context: VideoCallContext): Promise; /** Reads a job: running for `pollsToComplete` polls, then completed, or failed as `fail` says. */ poll(ref: VideoJobRef, context: VideoCallContext): Promise; /** Streams one video of `bytes` bytes, made a chunk at a time. */ download(ref: VideoJobRef, index: number, context: VideoCallContext): Promise; /** Cancels a job. */ cancel(ref: VideoJobRef): Promise; /** Deletes a job's videos. */ remove(ref: VideoJobRef): Promise; private job; }