Socket
Socket
Sign inDemoInstall

webvtt-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    webvtt-parser

WebVTT parser and validator


Version published
Weekly downloads
8K
decreased by-14.15%
Maintainers
1
Install size
82.1 kB
Created
Weekly downloads
 

Readme

Source

WebVTT parser and validator

Relevant links:

  • Live WebVTT Validator.
  • WebVTT Specification

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:

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:

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

Keywords

FAQs

Last updated on 17 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc