WebVTT parser and validator
JavaScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


WebVTT parser and validator

Relevant links:


You can simply load the parser.js file into your HTML page and the API will become available on window. Alternatively you can install it using bower (webvtt) or npm (webvtt-parser).


This module exports classes to either through window or require()/import; the ones you are likely to need are WebVTTParser and WebVTTSerializer.

To parse a WebVTT string:

import { WebVTTParser } from 'webvtt-parser';
const parser = new WebVTTParser();
const tree = parser.parse(someVTT, 'metadata');

To serialize a WebVTT tree to string:

import { WebVTTSerializer } from 'webvtt-parser';
const seri = new WebVTTSerializer();
const tree = seri.serialize(vttTree.cues)