/srt2vtt.js

Convert .srt (application/x-subrip) into .vtt (text/vtt) for HTML using Javascript

Primary LanguageJavaScriptMIT LicenseMIT

srt2vtt.js

Convert .srt (application/x-subrip) into .vtt (text/vtt) for HTML using Javascript

Installation

Download the srt2vtt.js or Use these CDN

<script src="https://cdn.jsdelivr.net/gh/faizath/srt2vtt.js@main/srt2vtt.js"></script>

or

<script src="https://faizath.github.io/srt2vtt.js/srt2vtt.js"></script>

Usage

Convert srt string to webvtt string

srt2vtt.convert(SRT STRING);

Demo: https://faizath.github.io/srt2vtt.js/sample/convert

Create URL of webvtt file

srt2vtt.url(SRT STRING);

Demo: https://faizath.github.io/srt2vtt.js/sample/url

Automatically replace srt with webvtt URL*

srt2vtt.run();

*The srt file URL must be XMLHTTPREQUESTable

Contributing

  1. Fork it (https://github.com/faizath/srt2vtt.js/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new pull request