Sha256: cb27faf4b5a22f9fb7bd223db9e1d2b7d6f9ae7ca3349c734b2f4f57ed9308a6
Contents?: true
Size: 1.12 KB
Versions: 12
Compression:
Stored size: 1.12 KB
Contents
WebVTT parser and validator =========================== https://github.com/w3c/webvtt.js Relevant links: * [Live WebVTT Validator](http://quuz.org/webvtt/). * [WebVTT Specification](https://w3c.github.io/webvtt/) ## Install You can 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 (`npm install webvtt-parser`). ## API 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: ```js import { WebVTTParser } from 'webvtt-parser'; const parser = new WebVTTParser(); const tree = parser.parse(someVTT, 'metadata'); ``` By default, the WebVTT parser only recognizes a small subset of named character entities. If you want the full spec-compliant behavior, pass the content of [[html-entities.json]] to the `WebVTTParser()` constructor. To serialize a WebVTT tree to string: ```js import { WebVTTSerializer } from 'webvtt-parser'; const seri = new WebVTTSerializer(); const tree = seri.serialize(vttTree.cues) ```
Version data entries
12 entries across 12 versions & 1 rubygems