//#region src/ass.d.ts type ASSOptions = { /** * The ass text string. * Can be omitted if `subUrl` is provided. */ assText?: string; /** * URL to fetch the ASS content from. */ subUrl?: string; /** * The video to display the subtile on. * Can be either an `HTMLVideoElement` or `string` (html query selector) */ video: HTMLVideoElement | string; /** * List of fonts to load. This ensures that all the fonts * needed for the rendering are present and loaded into the document */ fonts?: Font[]; /** * Corresponds to the `z-index` to placed the Canvas renderer * > The renderer will always be added right after the `video` element */ zIndex?: number; /** * A Callback that is invoked when the preprocess of the ass text by render is done */ onReady?: () => void; /** * Type of logging * - `DEBUG` only debug type log will be displayed * - `DISABLE` no logging will be emitted (default) * - `VERBOSE` every log will be shown * - `WARN` only warning will be shown */ logging?: LOGTYPE; }; type LOGTYPE = 'DISABLE' | 'VERBOSE' | 'DEBUG' | 'WARN'; type FontStyle = { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/ascentOverride) */ascentOverride: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/descentOverride) */ descentOverride: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/display) */ display: FontDisplay; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/family) */ family: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/featureSettings) */ featureSettings: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/lineGapOverride) */ lineGapOverride: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/stretch) */ stretch: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/style) */ style: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/unicodeRange) */ unicodeRange: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/variant) */ variant: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/weight) */ weight: string; }; type Font = { family: string; url: string; descriptors?: Partial; }; /** * @class ASS * * ASS is an ass/ssa subtitle renderer for HTML5 video. * * It creates a wrapper around the video element and overlays a canvas * to draw the subtitles with high performance. * * Usage: * ```javascript * const ass = new ASS({ * subUrl: '/path/to/subs.ass', * video: document.querySelector('video') * }); * await ass.render(); * ``` * */ declare class ASS { assText: string; subUrl?: string; private video; videoElement: HTMLVideoElement | null; private renderer; private ro; private fonts?; private zIndex?; private onReady?; private logging; private compiledAss; constructor(options: ASSOptions); /** * Start the ass rendering process */ render(): Promise; private fetchAss; private initRenderer; /** * Switch the ASS text content dynamically. * @param text The new ASS text content */ setAssText(text: string): Promise; /** * Switch the ASS text content from a URL. * @param url The URL to fetch the ASS content from */ setSubUrl(url: string): Promise; /** * Stop the rendering */ destroy(): void; private setCanvasSize; private loadFonts; private getFontUrl; private loadFont; } //#endregion export { ASS, ASS as default, ASSOptions, Font, FontStyle, LOGTYPE };