subtitle-utils
A simple utils for subtitle such as SRT, WebVTT.
Example
const Subtitle = ; const exampleSRT = ` 1 00:02:17,440 --> 00:02:20,375 Senator, we're making our final approach into Coruscant. 2 00:02:20,476 --> 00:02:22,501 Very good, Lieutenant. `; Subtitle;
Installation
npm install subtitle-utils
API
static Subtitle.fromSRT(data: string): Subtitle
Create a Subtitle instance from SubRip SRT subtitle.
static Subtitle.fromVTT(data: string): Subtitle
Create a Subtitle instance from WebVTT subtitle.
Subtitle.subtitles: ISubtitle[]
Get array of subtitle object.
Subtitle.toSRT(data: string): string
Returns SubRip SRT subtitle value.
Subtitle.toVTT(data: string): string
Returns WebVTT subtitle value;