Icontem

File: usage.txt

Recommend this page to a friend!
  Classes of Andras Toth  >  JS Subtitle Grabber  >  usage.txt  >  Download  
File: usage.txt
Role: Documentation
Content type: text/plain
Description: example usage
Class: JS Subtitle Grabber
Download and extract subtitles from videos
Author: By
Last change: optimize code, fix minor bugs
Date: 3 years ago
Size: 582 bytes
 

Contents

Class file image Download
Usage:

/**
 * selector: string or video element
 */

var grabber = new SubtitleGrabber(selector);

/**
 * return TextTrack Array
 */

grabber.getTextTracks();

/**
 * index: selected track index, encoding: character encoding
 * callBack: function
 */

grabber.getSrtLines(index, encoding, callBack);
grabber.getSrtLines(0, 'utf-8', function(lines){console.log(lines);});

/**
 * download video
 */

grabber.downloadVideo();

/**
 * download srt file
 */

grabber.downloadSrt(index, encoding, filename);
grabber.downloadSrt(0, 'utf-8', 'video.srt');