@omnimedia/omnitool
Version:
open source video processing tools
39 lines (38 loc) • 1.35 kB
TypeScript
import { CanvasSinkOptions, WrappedCanvas } from "mediabunny";
import { DecoderSource } from '../../driver/fns/schematic.js';
export declare class Filmstrip {
#private;
private duration;
private options;
private constructor();
static init(source: DecoderSource, options: FilmstripOptions): Promise<Filmstrip>;
get frequency(): number;
/**
* Updates filmstrip thumbnails when its range or frequency changes.
*
* @param update.range The current timeline viewport as a [start, end] tuple in seconds.
* Thumbnails preload slightly outside the visible range.
* @param update.frequency The granularity of filmstrip thumbnails in seconds.
*/
update({ range: visibleRange, frequency }: FilmstripUpdate): void;
/**
* Returns the cached thumbnail (if any) for a given timestamp.
* @param time - The timestamp to retrieve the canvas for.
*/
getThumbnail(time: number): WrappedCanvas | undefined;
}
export type TimeRange = [start: number, end: number];
export type FilmstripUpdate = {
range: TimeRange;
frequency: number;
};
interface FilmstripOptions {
frequency: number;
canvasSinkOptions?: CanvasSinkOptions;
onPlaceholders?: (timestamps: number[]) => void;
onChange: (tiles: {
time: number;
canvas: WrappedCanvas;
}[]) => void;
}
export {};