/** * Storyboards — the scrub previews a source brings with it. * * A preview normally costs a seek and a decode, because the frame has to be * made. A storyboard is the other way round: the frames were made once, * ahead of time, and stitched into a grid — one JPEG holding dozens of tiny * pictures, one per few seconds of runtime. Hovering then costs arithmetic and * a crop, and the mosaic is an ordinary image the browser caches like any * other. It is what YouTube ("storyboard"), Netflix and every trick-play * implementation does, and what the DASH-IF and HLS image tracks carry. * * Two shapes are understood, because both are what people actually have: * * • a WebVTT thumbnail track — the interoperable form, cues whose payload is * an image URL with a media fragment: `sprite.jpg#xywh=160,0,160,90` * • a tile spec — rows, columns and a list of mosaics with their durations, * which is the shape YouTube publishes and yt-dlp reports */ /** One picture inside a mosaic. */ export interface StoryboardTile { url: string; x: number; y: number; width: number; height: number; /** * The whole mosaic's size, when it can be worked out — the spec states it, * and a VTT track gives it away through the extents of its own cues. A * caller painting the mosaic behind a window (rather than cropping it) needs * it to scale the image: a tile's size alone says nothing about the sheet * it sits in. */ sheetWidth?: number; sheetHeight?: number; } /** * Mosaics described by their grid, rather than cue by cue. * * Two ways to say it, because two are in use: * * • the mosaics listed outright, each with the stretch of video it covers — * what YouTube publishes and yt-dlp reports * • a sprite and a clock: one URL (optionally with an `{index}` placeholder * for a sequence), a tile size, a column count, and how many seconds a tile * stands for — the videojs-sprite-thumbnails configuration, tile for tile * * The second form needs the video's duration to know how many tiles there are, * so it is expanded when that is known rather than when it is set. */ export interface StoryboardSpec { /** Tiles across each mosaic. */ columns: number; /** * Tiles down each mosaic. Omitted in the sprite form means one sheet holds * the whole video, and the row count follows from its length. */ rows?: number; /** One tile's size in the mosaic. */ width: number; height: number; /** The mosaics in order, each covering `duration` seconds of the video. */ fragments?: Array<{ url: string; duration: number; }>; /** * Sprite form: the sheet's URL, with an optional `{index}` placeholder that * counts from 0 for a sequence of sheets. */ url?: string; /** Sprite form: seconds one tile stands for. Defaults to 1, as video.js does. */ interval?: number; } export declare class Storyboard { private readonly cues; /** Uniform cue length, when there is one — makes the lookup a division. */ private readonly step; readonly coverage: number; private constructor(); /** * Build from a WebVTT thumbnail track. Cue payloads are image URLs, resolved * against the track's own address, and the fragment names the rectangle: * `#xywh=x,y,w,h`. A cue without one takes the whole image. */ static parseVtt(text: string, baseUrl: string): Storyboard | null; /** * Build from a tile spec. Each mosaic covers its own stretch of the video and * holds `columns * rows` pictures, so a tile is one division and two * remainders away from any time. */ static fromSpec(spec: StoryboardSpec, duration?: number): Storyboard | null; /** * The mosaics a spec describes — listed outright, or worked out from a sprite * and an interval the way videojs-sprite-thumbnails does: a sheet holds * `columns × rows` tiles of `interval` seconds each, and `{index}` counts * sheets from zero. Without `rows` the sheet is however tall it needs to be * to hold the whole video, which is that plugin's single-sprite case. */ private static fragmentsOf; /** * The mosaics, in the order they cover the video. A caller that paints them * itself warms them from this — one image serves dozens of previews, and the * one after the pointer is the one about to be needed. */ sheets(): string[]; /** The picture that belongs to a moment, or null past the end of the board. */ tileAt(time: number): StoryboardTile | null; } //# sourceMappingURL=Storyboard.d.ts.map