Very basic and experimental Node.js/JavaScript library to generate VTT open subtitles files
With NPM:
npm install --save vtt-creator
or with Bower:
With NPM:
bower install --save vtt-creator
To include Vtt in your Node.js project simply use:
var Vtt = require('vtt-creator');
or in a fronted app using bower (Vtt
will be available as a global instance):
<script src="bower_components/vtt-creator/dist/vtt.min.js"></script>
Usage:
var v = new Vtt();
v.add(1.05, 4, 'Never drink liquid nitrogen.', 'align:middle line:84%');
v.add(5, 9, ['It will perforate your stomach.', 'You could die.']);
console.log(v.toString());
the previous snippet will generate:
WEBVTT
1
00:00:01.050 --> 00:00:04.000 align:middle line:84%
Never drink liquid nitrogen.
2
00:00:05.000 --> 00:00:09.000
It will perforate your stomach.
You could die.
Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub.
Licensed under MIT License. © Luciano Mammino.