@svta/common-media-library
Version:
A common library for media playback in JavaScript
73 lines • 2.06 kB
TypeScript
import type { TimestampMap } from './TimestampMap.js';
import type { WebVttCue } from './WebVttCue.js';
import type { WebVttParserOptions } from './WebVttParserOptions.js';
import { WebVttParsingError } from './WebVttParsingError.js';
import type { WebVttRegion } from './WebVttRegion.js';
/**
* A WebVTT parser.
*
* @group WebVTT
*
* @beta
*
* @example
* {@includeCode ../../test/webvtt/WebVttParser.test.ts#example}
*
* @see {@link https://www.w3.org/TR/webvtt1/ | WebVTT Specification}
*/
export declare class WebVttParser {
private state;
private buffer;
private regionList;
private regionSettings;
private style;
private cue;
private createCue;
private createRegion;
/**
* A callback function that is called when a parsing error occurs.
*/
onparsingerror?: (error: WebVttParsingError) => void;
/**
* A callback function that is called when a region is parsed.
*/
onregion?: (region: WebVttRegion) => void;
/**
* A callback function that is called when a timestamp map is parsed.
*/
ontimestampmap?: (timestampMap: TimestampMap) => void;
/**
* A callback function that is called when a cue is parsed.
*/
oncue?: (cue: WebVttCue) => void;
/**
* A callback function that is called when a style is parsed.
*/
onstyle?: (style: string) => void;
/**
* A callback function that is called when the parser is flushed.
*/
onflush?: () => void;
/**
* Create a new WebVTT parser.
*
* @param options - The options to use for the parser.
*/
constructor(options?: WebVttParserOptions);
/**
* Parse the given data.
*
* @param data - The data to parse.
* @param reuseCue - Whether to reuse the cue.
* @returns The parser.
*/
parse(data?: string, reuseCue?: boolean): WebVttParser;
/**
* Flush the parser.
*
* @returns The parser.
*/
flush(): WebVttParser;
private reportOrThrowError;
}
//# sourceMappingURL=WebVttParser.d.ts.map