@types/videojs-vtt.js
TypeScript icon, indicating that this package has built-in type declarations

0.15.3 • Public • Published

Installation

npm install --save @types/videojs-vtt.js

Summary

This package contains type definitions for videojs-vtt.js (https://github.com/videojs/vtt.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/videojs-vtt.js.

index.d.ts

type TimeInSeconds = number;
type VttText = string;
type DecoderFn = (data: string) => string;
interface Decoder {
    decode: DecoderFn;
}

export function shim(): void;
export function restore(): void;

interface VttParser {
    buffer: string;
    decoder: Decoder;
    regionList: string[];
    state: "INITIAL" | "BADCUE" | "HEADER" | "NOTE" | "ID" | "CUETEXT" | null;
    vttjs: {};
    window: Window;

    onregion: (region: VTTRegion) => void;
    oncue: (cue: VTTCue) => void;
    onflush: () => void;
    onparsingerror: (e: Error) => void;
    parse: (moreData?: VttText) => VttParser;
    flush: () => void;
}

interface VttParserConstructor {
    new(window: Window, stringDecoder?: ReturnType<typeof WebVTT.StringDecoder>): VttParser;
}

export namespace WebVTT {
    const Parser: VttParserConstructor;
    function StringDecoder(): Decoder;
    function processCues(window: Window, cues: VTTCue[], overlay: HTMLElement | null): void;
    function convertCueToDOMTree(window: Window, text: string): HTMLElement;
}

export const VTTCue: {
    prototype: VTTCue;
    new(startTime: TimeInSeconds, endTime: TimeInSeconds, text: string): VTTCue;

    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state
    displayState?: any;
    hasBeenReset?: boolean;
};

export const VTTRegion: {
    prototype: VTTRegion;
    new(): VTTRegion;

    fromJSON(json: any): VTTRegion;
    create(options: any): VTTRegion;
};

export {};

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by David Ko.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/videojs-vtt.js

Weekly Downloads

970

Version

0.15.3

License

MIT

Unpacked Size

5.57 kB

Total Files

5

Last publish

Collaborators

  • types