UNPKG

libpgs

Version:

Renderer for graphical subtitles (PGS) in the browser.

48 lines (47 loc) 1.64 kB
/** * The base for handling pgs loading and rendering. There are different ways to render a subtitle file. Modern browser * support a more efficient asynchrone method using a web-worker. But if this isn't working for the current browser * a more compatible implementation can be used. */ export declare abstract class PgsRendererImpl { private updateTimestamps; private previousTimestampIndex; /** * Is called when the timestamps were updated. */ onTimestampsUpdated?: () => void; /** * Sets the update timestamps and invokes an update event. * @param updateTimestamps The new array of update timestamps. */ protected setUpdateTimestamps(updateTimestamps: number[]): void; /** * Renders the subtitle for the given timestamp. * @param time The timestamp in seconds. */ renderAtTimestamp(time: number): void; /** * Renders the subtitle at the given timestamp index. * @param index The timestamp index. */ renderAtIndex(index: number): void; /** * Renders the subtitle at the given timestamp index. Internal render method to overwrite. * @param index The timestamp index. */ protected abstract render(index: number): void; /** * Loads the subtitle file from the given url. * @param url The url to the PGS file. */ abstract loadFromUrl(url: string): void; /** * Loads the subtitle file from the given buffer. * @param buffer The PGS data. */ abstract loadFromBuffer(buffer: ArrayBuffer): void; /** * Disposes the renderer. */ abstract dispose(): void; }