
Its results to a JSON file located at -proc.json. Note that jsonRefFile shouldĬontain JSON that is generated from parsing. Runs jsonEqualParsing and jsonEqualProcModel. jsonEqualAll(vttFile, jsonRefFile, message, onDone) Runs the processing model over the VTTCues and VTTRegions that are returnedįrom parsing the WebVTT file. jsonEqualProcModel(vttFile, jsonRefFile, message, onDone) Runs jsonEqual and jsonEqualStreaming in one go. jsonEqualParsing(vttFile, jsonRefFile, message, onDone) N is the length in unicode characters of the file, so use this only on smallįiles or else you will get a timeout failure on your test. Will simulate parsing like this n times for a single WebVTT file where Simulates parsing the file while streaming by splitting the WebVTT file intoĬhunks. jsonEqualStreaming(vttFile, jsonRefFile, message, onDone) jsonEqual(vttFile, jsonRefFile, message, onDone)įirst parses the WebVTT file as UTF8 and compares it to the reference JSON fileĪnd then parses the WebVTT file as a string and compares it to the reference JSONįile.
#Webvtt files with moviecaptioner how to#
See an example of a test fileĭirectory for more examples on how to write tests. Module in the lib directory and start writing tests using mocha. There's a prebuilt API in place for testing different parts of vtt.js. (see details below about Grunt Run Task).

The JSON filesĬan be easily generated using vtt.js, so you don't need to write these by hand Tests are done by comparing live parsed output to a last-known-good JSON file. See the usage docs for further usage info. Tests are written and run using Mocha on node.js. To run the whole test suite or set of tests. The Grunt Run Task tool is handy for running the library without having.When bumping the version remember to use the grunt release task as this willīump package.json + bower.json and build the dist files for vtt.js in one.
#Webvtt files with moviecaptioner full#
Node-vtt runs vtt.js on a PhantomJS pageįrom Node so it has access to a full DOM and CSS layout engine which means you can run any part Which you can attach to your global that is passed into the various functions. The only shims that are provided to you are VTTCue and VTTRegion Or a shim of one with the necessary functionality for either the parsing or processing Note: If you use this method you will have to provide your own window object See the API for more information on how to use it. convertCueToDOMTree ( window, cuetext ) var cue = new VTTCue ( 0, 1, "I'm a cue." ) var region = new VTTRegion ( ) processCues ( window, cues, overlay ) var element = WebVTT. Var vtt = require ( "vtt.js" ), WebVTT = vtt. This allows us to reuse a cue's display state if it has already been computed and nothing has changed to effect its one of its properties that affects display has changed and so we need to recompute its display Our processing model portion of the specification makes use of a custom property, hasBeenReset. VTTCue (Completed) Shims the TextTrackCue interface as well.Apply WebVTT Cue Settings (In Progress).Processing Model (In Progress) No VTTRegion or vertical text support.

This is a fork of Mozilla's vtt.js (which is used for parsing and processing WebVTT files in Firefox/Gecko) with some changes that are used by Video.js.

Implementation of the WebVTT spec in JavaScript.
