add node-webvtt for parsing subtitles

This commit is contained in:
frost768 2023-03-09 20:06:34 +03:00
parent 935cb2427b
commit 7bf1d05f16
4 changed files with 3636 additions and 3617 deletions

View File

@ -16,6 +16,7 @@
"json5": "^2.2.0",
"lodash.throttle": "^4.1.1",
"nanoid": "^4.0.0",
"node-webvtt": "^1.9.4",
"ofetch": "^1.0.0",
"pako": "^2.1.0",
"react": "^17.0.2",

27
src/types/node_webtt.d.ts vendored Normal file
View File

@ -0,0 +1,27 @@
declare module "node-webvtt" {
interface Cue {
identifier: string;
start: number;
end: number;
text: string;
styles: string;
}
interface Options {
meta?: boolean;
strict?: boolean;
}
type ParserError = Error;
interface ParseResult {
valid: boolean;
strict: boolean;
cues: Cue[];
errors: ParserError[];
meta?: Map<string, string>;
}
interface Segment {
duration: number;
cues: Cue[];
}
function parse(text: string, options: Options): ParseResult;
function segment(input: string, segmentLength?: number): Segment[];
}

View File

@ -16,6 +16,7 @@
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": "./src",
"typeRoots": ["./src/types"],
"paths": {
"@/*": ["./*"]
},

7224
yarn.lock

File diff suppressed because it is too large Load Diff