First release

This commit is contained in:
Owen Quinlan 2021-07-02 19:29:34 +10:00
commit fa6c85266e
2339 changed files with 761050 additions and 0 deletions

191
node_modules/videojs-vtt.js/LICENSE generated vendored Normal file
View file

@ -0,0 +1,191 @@
Copyright Brightcove, Inc. and contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

563
node_modules/videojs-vtt.js/README.md generated vendored Normal file
View file

@ -0,0 +1,563 @@
# videojs-vtt.js
[![npm-version](http://img.shields.io/npm/v/videojs-vtt.js.svg)](https://www.npmjs.org/package/videojs-vtt.js) [![Dependency Status](https://david-dm.org/videojs/vtt.js.svg?theme=shields.io)](https://david-dm.org/videojs/vtt.js) [![devDependency Status](https://david-dm.org/videojs/vtt.js/dev-status.svg?theme=shields.io)](https://david-dm.org/videojs/vtt.js#info=devDependencies)
Implementation of the [WebVTT](https://developer.mozilla.org/en-US/docs/HTML/WebVTT) spec in JavaScript.
This is a fork of [Mozilla's vtt.js](http://github.com/mozilla/vtt.js) (which is used for parsing and processing WebVTT files in Firefox/Gecko) with some changes that are used by [Video.js](http://github.com/videojs/video.js).
## Table of Contents
- [Spec Compliance](#spec-compliance)
- [API](#api)
- [WebVTT.Parser](#webvttparser)
- [parse(data)](#parsedata)
- [flush()](#flush)
- [onregion(region)](#onregionregion)
- [oncue(cue)](#oncuecue)
- [onflush()](#onflush)
- [onparsingerror(error)](#onparsingerrorerror)
- [ontimestampmap(timestampmap)](#ontimestampmaptimestampmap)
- [WebVTT.convertCueToDOMTree(window, cuetext)](#webvttconvertcuetodomtreewindow-cuetext)
- [WebVTT.processCues(window, cues, overlay)](#webvttprocesscueswindow-cues-overlay)
- [ParsingError](#parsingerror)
- [VTTCue](#vttcue)
- [Extended API](#extended-api)
- [toJSON()](#tojson)
- [VTTCue.fromJSON(json)](#vttcuefromjsonjson)
- [VTTCue.create(options)](#vttcuecreateoptions)
- [VTTRegion](#vttregion)
- [Extended API](#extended-api-1)
- [VTTRegion.fromJSON(json)](#vttregionfromjsonjson)
- [VTTRegion.create(options)](#vttregioncreateoptions)
- [Browser](#browser)
- [Building Yourself](#building-yourself)
- [Bower](#bower)
- [Usage](#usage)
- [Node](#node)
- [vtt.js](#vttjs-1)
- [node-vtt](#node-vtt)
- [Developing vtt.js](#developing-vttjs)
- [Tests](#tests)
- [Writing Tests](#writing-tests)
- [Grunt Run Task](#grunt-run-task)
# Spec Compliance
- [Parsing](http://dev.w3.org/html5/webvtt/#webvtt-file-format-parsing) (Completed)
- [File](http://dev.w3.org/html5/webvtt/#webvtt-file-parsing) (Completed)
- [Region](http://dev.w3.org/html5/webvtt/#webvtt-region-settings-parsing) (Completed)
- [Cue Timings and Settings](http://dev.w3.org/html5/webvtt/#webvtt-cue-timings-and-settings-parsing) (Completed)
- [WebVTT Cue Text](http://dev.w3.org/html5/webvtt/#dfn-webvtt-cue-text-parsing-rules) (Completed)
- [Cue DOM Construction](http://dev.w3.org/html5/webvtt/#webvtt-cue-text-dom-construction-rules) (Completed)
- [Rendering](http://dev.w3.org/html5/webvtt/#rendering) (In Progress)
- [Processing Model](http://dev.w3.org/html5/webvtt/#processing-model) (In Progress) ***No VTTRegion or vertical text support***
- [Apply WebVTT Cue Settings](http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings) (In Progress)
- Steps 1 - 11 (Completed)
- Step 12 (In progress)
- [Applying CSS Properties](http://dev.w3.org/html5/webvtt/#applying-css-properties-to-webvtt-node-objects) (Completed)
- [CSS Extensions](http://dev.w3.org/html5/webvtt/#css-extensions) **(Won't Implement)**
- [WebVTT API Shim](http://dev.w3.org/html5/webvtt/#webvtt-api-for-browsers) (Completed)
- [VTTCue](http://dev.w3.org/html5/webvtt/#vttcue-interface) (Completed) ***Shims the TextTrackCue interface as well***
- [VTTRegion](http://dev.w3.org/html5/webvtt/#vttregion-interface) (Completed)
## Notes
Our processing model portion of the specification makes use of a custom property, `hasBeenReset`. It allows us to detect
when a VTTCue is dirty, i.e. one of its properties that affects display has changed and so we need to recompute its display
state. This allows us to reuse a cue's display state if it has already been computed and nothing has changed to effect its
position.
# API
## WebVTT.Parser
The parser has a simple API:
```javascript
var parser = new WebVTT.Parser(window, stringDecoder);
parser.onregion = function(region) {};
parser.oncue = function(cue) {};
parser.onflush = function() {};
parser.onparsingerror = function(e) {};
parser.parse(moreData);
parser.parse(moreData);
parser.flush();
```
The Parser constructor is passed a window object with which it will create new
VTTCues and VTTRegions as well as an optional StringDecoder object which
it will use to decode the data that the `parse()` function receives. For ease of
use, a StringDecoder is provided via `WebVTT.StringDecoder()`. If a custom
StringDecoder object is passed in it must support the API specified by the
[#whatwg string encoding](http://encoding.spec.whatwg.org/#api) spec.
### parse(data)
Hands data in some format to the parser for parsing. The passed data format
is expected to be decodable by the StringDecoder object that it has. The parser
decodes the data and reassembles partial data (streaming), even across line breaks.
```javascript
var parser = new WebVTT.Parser(window, WebVTT.StringDecoder());
parser.parse("WEBVTT\n\n");
parser.parse("00:32.500 --> 00:33.500 align:start size:50%\n");
parser.parse("<v.loud Mary>That's awesome!");
parser.flush();
```
### flush()
Indicates that no more data is expected and will force the parser to parse any
unparsed data that it may have. Will also trigger [onflush](#onflush).
### onregion(region)
Callback that is invoked for every region that is correctly parsed. Returns a [VTTRegion](#http://dev.w3.org/html5/webvtt/#dfn-vttregion)
object.
```js
parser.onregion = function(region) {
console.log(region);
};
```
### oncue(cue)
Callback that is invoked for every cue that is fully parsed. In case of streaming parsing oncue is
delayed until the cue has been completely received. Returns a [VTTCue](#http://dev.w3.org/html5/webvtt/#vttcue-interface) object.
```js
parser.oncue = function(cue) {
console.log(cue);
};
```
### onflush()
Is invoked in response to `flush()` and after the content was parsed completely.
```js
parser.onflush = function() {
console.log("Flushed");
};
```
### onparsingerror(error)
Is invoked when a parsing error has occurred. This means that some part of the
WebVTT file markup is badly formed. See [ParsingError](#parsingerror) for more
information.
```js
parser.onparsingerror = function(e) {
console.log(e);
};
```
### ontimestampmap(timestampmap)
Is invoked when an `X-TIMESTAMP-MAP` metadata header ([defined here](https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5)) is parsed. This header maps WebVTT cue timestamps to MPEG-2 (PES) timestamps in other Renditions of the Variant Stream.
```js
parser.ontimestampmap = function(timestamp) {
console.log('LOCAL:', timestamp.LOCAL);
console.log('MPEGTS:', timestamp.MPEGTS);
};
```
## WebVTT.convertCueToDOMTree(window, cuetext)
Parses the cue text handed to it into a tree of DOM nodes that mirrors the internal WebVTT node structure of
the cue text. It uses the window object handed to it to construct new HTMLElements and returns a tree of DOM
nodes attached to a top level div.
```javascript
var div = WebVTT.convertCueToDOMTree(window, cuetext);
```
## WebVTT.processCues(window, cues, overlay)
Converts the cuetext of the cues passed to it to DOM trees&mdash;by calling convertCueToDOMTree&mdash;and
then runs the processing model steps of the WebVTT specification on the divs. The processing model applies the necessary
CSS styles to the cue divs to prepare them for display on the web page. During this process the cue divs get added
to a block level element (overlay). The overlay should be a part of the live DOM as the algorithm will use the
computed styles (only of the divs to do overlap avoidance.
```javascript
var divs = WebVTT.processCues(window, cues, overlay);
```
## ParsingError
A custom JS error object that is reported through the
[onparsingerror](#onparsingerror) callback. It has a `name`, `code`, and
`message` property, along with all the regular properties that come with a
JavaScript error object.
```json
{
"name": "ParsingError",
"code": "SomeCode",
"message": "SomeMessage"
}
```
There are two error codes that can be reported back currently:
- 0 BadSignature
- 1 BadTimeStamp
**Note:** Exceptions other then `ParsingError` will be thrown and not reported.
## VTTCue
A DOM shim for the VTTCue. See the [spec](http://dev.w3.org/html5/webvtt/#vttcue-interface)
for more information. Our VTTCue shim also includes properties of its abstract base class
[TextTrackCue](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#texttrackcue).
```js
var cue = new window.VTTCue(0, 1, "I'm a cue.");
```
**Note:** Since this polyfill doesn't implement the track specification directly the `onenter`
and `onexit` events will do nothing and do not exist on this shim.
### Extended API
There is also an extended version of this shim that gives a few convenience methods
for converting back and forth between JSON and VTTCues. If you'd like to use these
methods then use `vttcue-extended.js` instead of `vttcue.js`. This isn't normally
built into the `vtt.js` distributable so you will have to build a custom distribution
instead of using bower.
#### toJSON()
Converts a cue to JSON.
```js
var json = cue.toJSON();
```
#### VTTCue.fromJSON(json)
Create and initialize a VTTCue from JSON.
```js
var cue = VTTCue.fromJSON(json);
```
#### VTTCue.create(options)
Initializes a VTTCue from an options object where the properties in the option
objects are the same as the properties on the VTTCue.
```js
var cue = VTTCue.create(options);
```
## VTTRegion
A DOM shim for the VTTRegion. See the [spec](http://dev.w3.org/html5/webvtt/#vttregion-interface)
for more information.
```js
var region = new window.VTTRegion(0, 1, "I'm a region.");
cue.region = region;
```
### Extended API
There is also an extended version of this shim that gives a few convenience methods
for converting back and forth between JSON and VTTRegions. If you'd like to use these
methods then us `vttregion-extended.js` instead of `vttregion.js`. This isn't normally
built into the `vtt.js` distributable so you will have to build a custom distribution
instead of using bower.
#### VTTRegion.fromJSON(json)
Creates and initializes a VTTRegion from JSON.
```js
var region = VTTRegion.fromJSON(json);
```
#### VTTRegion.create(options)
Creates a VTTRegion from an options object where the properties on the options
object are the same as the properties on the VTTRegion.
```js
var region = VTTRegion.create(options);
```
# Browser
In order to use the `vtt.js` in a browser, you need to get the built distribution of vtt.js. The distribution
contains polyfills for [TextDecoder](http://encoding.spec.whatwg.org/), [VTTCue](http://dev.w3.org/html5/webvtt/#vttcue-interface),
and [VTTRegion](http://dev.w3.org/html5/webvtt/#vttregion-interface) since not all browsers currently
support them.
## Building Yourself
Building a browser-ready version of the library is done using `grunt` (if you haven't installed
`grunt` globally, you can run it from `./node_modules/.bin/grunt` after running `npm install`):
```bash
$ grunt build
$ Running "uglify:dist" (uglify) task
$ File "dist/vtt.min.js" created.
$ Running "concat:dist" (concat) task
$ File "dist/vtt.js" created.
$ Done, without errors.
```
Your newly built `vtt.js` now lives in `dist/vtt.min.js`, or alternatively, `dist/vtt.js` for an
unminified version.
## Bower
You can also get the a prebuilt distribution from [Bower](http://bower.io/). Either run the shell
command:
```bash
$ bower install vtt.js
```
Or include `vtt.js` as a dependency in your `bower.json` file. `vtt.js` should now
live in `bower_components/vtt.js/vtt.min.js`. There is also an unminified
version included with bower at `bower_components/vtt.js/vtt.js`.
## Usage
To use `vtt.js` you can just include the script on an HTML page like so:
```html
<html>
<head>
<meta charset="utf-8">
<title>vtt.js in the browser</title>
<script src="bower_components/vtt.js/vtt.min.js"></script>
</head>
<body>
<script>
var vtt = "WEBVTT\n\nID\n00:00.000 --> 00:02.000\nText",
parser = new WebVTT.Parser(window, WebVTT.StringDecoder()),
cues = [],
regions = [];
parser.oncue = function(cue) {
cues.push(cue);
};
parser.onregion = function(region) {
regions.push(region);
}
parser.parse(vtt);
parser.flush();
var div = WebVTT.convertCueToDOMTree(window, cues[0].text);
var divs = WebVTT.processCues(window, cues, document.getElementById("overlay"));
</script>
<div id="overlay" style="position: relative; width: 300px; height: 150px"></div>
</body>
</html>
```
# Node
You have a couple of options if you'd like to run the library from Node.
## vtt.js
`vtt.js` is on npm. Just do:
```
npm install vtt.js
```
Require it and use it:
```js
var vtt = require("vtt.js"),
WebVTT = vtt.WebVTT,
VTTCue = vtt.VTTCue,
VTTRegion = vtt.VTTRegion;
var parser = new WebVTT.Parser(window);
parser.parse();
// etc
var elements = WebVTT.processCues(window, cues, overlay);
var element = WebVTT.convertCueToDOMTree(window, cuetext);
var cue = new VTTCue(0, 1, "I'm a cue.");
var region = new VTTRegion();
```
See the [API](#api) for more information on how to use it.
**Note:** If you use this method you will have to provide your own window object
or a shim of one with the necessary functionality for either the parsing or processing
portion of the spec. The only shims that are provided to you are `VTTCue` and `VTTRegion`
which you can attach to your global that is passed into the various functions.
## node-vtt
Use [node-vtt](https://github.com/mozilla/node-vtt). Node-vtt runs `vtt.js` on a PhantomJS page
from Node so it has access to a full DOM and CSS layout engine which means you can run any part
of the library you want. See the [node-vtt](https://github.com/mozilla/node-vtt) repo for more
information.
# Developing vtt.js
A few things to note:
* When bumping the version remember to use the `grunt release` task as this will
bump `package.json` + `bower.json` and build the `dist` files for `vtt.js` in one
go.
* The [Grunt Run Task](#grunt-run-task) tool is handy for running the library without having
to run the whole test suite or set of tests.
## Tests
Tests are written and run using [Mocha](https://mochajs.org/) on node.js.
To run all the tests, do the following:
```bash
$ npm test
```
If you want to run individual tests, you can install the [Mocha](https://mochajs.org/) command-line
tool globally, and then run tests per-directory:
```bash
$ npm install -g mocha
$ cd tests/some/sub/dir
$ mocha --reporter spec --timeout 200000
```
See the [usage docs](https://mochajs.org/#usage) for further usage info.
### Writing Tests
Tests are done by comparing live parsed output to a last-known-good JSON file. The JSON files
can be easily generated using `vtt.js`, so you don't need to write these by hand
(see details below about [Grunt Run Task](#grunt-run-task)).
#### TestRunner
There's a prebuilt API in place for testing different parts of `vtt.js`. Simply
require the [TestRunner](https://github.com/videojs/vtt.js/blob/master/tests/test-runner.js)
module in the `lib` directory and start writing tests using `mocha`. See an example of a test file
[here](https://github.com/videojs/vtt.js/blob/master/tests/cue-settings/align/test.js)
with its first test's WebVTT file [here](https://github.com/videojs/vtt.js/blob/master/tests/cue-settings/align/bad-align.vtt)
and its corresponding [parsing JSON file](https://github.com/videojs/vtt.js/blob/master/tests/cue-settings/align/bad-align.json)
and [processing JSON file](https://github.com/videojs/vtt.js/blob/master/tests/cue-settings/align/bad-align-proc.json).
You can also check out the [tests](https://github.com/videojs/vtt.js/tree/master/tests)
directory for more examples on how to write tests.
#### jsonEqual(vttFile, jsonRefFile, message, onDone)
First parses the WebVTT file as UTF8 and compares it to the reference JSON file
and then parses the WebVTT file as a string and compares it to the reference JSON
file.
#### jsonEqualStreaming(vttFile, jsonRefFile, message, onDone)
Simulates parsing the file while streaming by splitting the WebVTT file into
chunks. Will simulate parsing like this `n` times for a single WebVTT file where
`n` is the length in unicode characters of the file, so use this only on small
files or else you will get a timeout failure on your test.
#### jsonEqualParsing(vttFile, jsonRefFile, message, onDone)
Runs `jsonEqual` and `jsonEqualStreaming` in one go.
#### jsonEqualProcModel(vttFile, jsonRefFile, message, onDone)
Runs the processing model over the `VTTCues` and `VTTRegions` that are returned
from parsing the WebVTT file.
#### jsonEqualAll(vttFile, jsonRefFile, message, onDone)
Runs `jsonEqualParsing` and `jsonEqualProcModel`. Note that `jsonRefFile` should
contain JSON that is generated from parsing. The processing model test will compare
its results to a JSON file located at `[vttFile]-proc.json`. Therefore, if you
have a WebVTT file named `basic.vtt` the JSON reference file for the processing
model tests will be `basic-proc.json`.
#### jsonEqualAllNoStream(vttFile, jsonRefFile, message, onDone)
Runs `jsonEqual` and `jsonEqualProcModel` use this if you want to do parsing
and processing tests, but do not want to simulate streaming because you
have too big of a WebVTT file.
## Grunt Run Task
You can automatically generate a JSON file for a given `.vtt` file using the
`run` Grunt task.
To get parsed JSON output from some WebVTT file do:
```bash
$ grunt run:my-vtt-file.vtt
$ grunt run:my-vtt-file.vtt > my-json-file.json
```
To get processed output from the WebVTT file do:
```bash
$ grunt run:my-vtt-file.vtt:p
$ grunt run:my-vtt-file.vtt:p > my-json-file.json
```
By passing the `c` flag you can automatically copy the output into a JSON file
with the same name as the WebVTT file:
```bash
$ grunt run:my-vtt-file.vtt:c
$ grunt run:my-vtt-file.vtt:pc
```
The parsed JSON output now lives in `my-vtt-file.json` and the processing JSON
output lives in `my-vtt-file-proc.json`.
You can also run it over a directory copying the output of parsing or
processing each WebVTT file to a corresponding JSON file like so:
```bash
$ grunt run:my-vtt-file-directory
$ grunt run:my-vtt-file-directory:p
```
This is useful when you've modified how `vtt.js` works and each JSON file needs
a slight change.
The `run` task utilizes a script called `cue2json`, but
does a few other things for you before each run like building a development
build for `cue2json` to use. It's also a bit easier to type in the CL options
for the task. If you want to know more about `cue2json` you can run it directly
like so:
```bash
$ ./bin/cue2json.js
$ Generate JSON test files from a reference VTT file.
$ Usage: node ./bin/cue2json.js [options]
$
$ Options:
$ -v, --vtt Path to VTT file.
$ -d, --dir Path to test directory. Will recursively find all JSON files with matching VTT files and rewrite them.
$ -c, --copy Copies the VTT file to a JSON file with the same name.
$ -p, --process Generate a JSON file of the output returned from the processing model.
```
**Notes:**
* `cue2json` utilizes the last development build done. This is why the Grunt `run` task is
good as you don't have to remember to build it yourself. If you don't build it yourself then you could
potentially get incorrect results from it.
* Since `cue2json` uses the actual parser to generate these JSON files there is the possibility that
the generated JSON will contain bugs. Therefore, always check the generated JSON files to check that the
parser actually parsed according to spec.

1870
node_modules/videojs-vtt.js/dist/vtt.global.js generated vendored Normal file

File diff suppressed because it is too large Load diff

2
node_modules/videojs-vtt.js/dist/vtt.global.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1870
node_modules/videojs-vtt.js/dist/vtt.js generated vendored Normal file

File diff suppressed because it is too large Load diff

2
node_modules/videojs-vtt.js/dist/vtt.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

50
node_modules/videojs-vtt.js/lib/browser-index.js generated vendored Normal file
View file

@ -0,0 +1,50 @@
/**
* Copyright 2013 vtt.js Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Default exports for Node. Export the extended versions of VTTCue and
// VTTRegion in Node since we likely want the capability to convert back and
// forth between JSON. If we don't then it's not that big of a deal since we're
// off browser.
var window = require('global/window');
var vttjs = module.exports = {
WebVTT: require("./vtt.js"),
VTTCue: require("./vttcue.js"),
VTTRegion: require("./vttregion.js")
};
window.vttjs = vttjs;
window.WebVTT = vttjs.WebVTT;
var cueShim = vttjs.VTTCue;
var regionShim = vttjs.VTTRegion;
var nativeVTTCue = window.VTTCue;
var nativeVTTRegion = window.VTTRegion;
vttjs.shim = function() {
window.VTTCue = cueShim;
window.VTTRegion = regionShim;
};
vttjs.restore = function() {
window.VTTCue = nativeVTTCue;
window.VTTRegion = nativeVTTRegion;
};
if (!window.VTTCue) {
vttjs.shim();
}

17
node_modules/videojs-vtt.js/lib/browser.js generated vendored Normal file
View file

@ -0,0 +1,17 @@
(function(root) {
var vttjs = root.vttjs = {};
var cueShim = vttjs.VTTCue;
var regionShim = vttjs.VTTRegion;
var oldVTTCue = root.VTTCue;
var oldVTTRegion = root.VTTRegion;
vttjs.shim = function() {
vttjs.VTTCue = cueShim;
vttjs.VTTRegion = regionShim;
};
vttjs.restore = function() {
vttjs.VTTCue = oldVTTCue;
vttjs.VTTRegion = oldVTTRegion;
};
}(this));

25
node_modules/videojs-vtt.js/lib/index.js generated vendored Normal file
View file

@ -0,0 +1,25 @@
/**
* Copyright 2013 vtt.js Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Default exports for Node. Export the extended versions of VTTCue and
// VTTRegion in Node since we likely want the capability to convert back and
// forth between JSON. If we don't then it's not that big of a deal since we're
// off browser.
module.exports = {
WebVTT: require("./vtt.js").WebVTT,
VTTCue: require("./vttcue-extended.js").VTTCue,
VTTRegion: require("./vttregion-extended.js").VTTRegion
};

1349
node_modules/videojs-vtt.js/lib/vtt.js generated vendored Normal file

File diff suppressed because it is too large Load diff

60
node_modules/videojs-vtt.js/lib/vttcue-extended.js generated vendored Normal file
View file

@ -0,0 +1,60 @@
/**
* Copyright 2013 vtt.js Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// If we're in Node.js then require VTTCue so we can extend it, otherwise assume
// VTTCue is on the global.
if (typeof module !== "undefined" && module.exports) {
this.VTTCue = this.VTTCue || require("./vttcue").VTTCue;
}
// Extend VTTCue with methods to convert to JSON, from JSON, and construct a
// VTTCue from an options object. The primary purpose of this is for use in the
// vtt.js test suite (for testing only properties that we care about). It's also
// useful if you need to work with VTTCues in JSON format.
(function(root) {
root.VTTCue.prototype.toJSON = function() {
var cue = {},
self = this;
// Filter out getCueAsHTML as it's a function and hasBeenReset and displayState as
// they're only used when running the processing model algorithm.
Object.keys(this).forEach(function(key) {
if (key !== "getCueAsHTML" && key !== "hasBeenReset" && key !== "displayState") {
cue[key] = self[key];
}
});
return cue;
};
root.VTTCue.create = function(options) {
if (!options.hasOwnProperty("startTime") || !options.hasOwnProperty("endTime") ||
!options.hasOwnProperty("text")) {
throw new Error("You must at least have start time, end time, and text.");
}
var cue = new root.VTTCue(options.startTime, options.endTime, options.text);
for (var key in options) {
if (cue.hasOwnProperty(key)) {
cue[key] = options[key];
}
}
return cue;
};
root.VTTCue.fromJSON = function(json) {
return this.create(JSON.parse(json));
};
}(this));

286
node_modules/videojs-vtt.js/lib/vttcue.js generated vendored Normal file
View file

@ -0,0 +1,286 @@
/**
* Copyright 2013 vtt.js Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var autoKeyword = "auto";
var directionSetting = {
"": 1,
"lr": 1,
"rl": 1
};
var alignSetting = {
"start": 1,
"center": 1,
"end": 1,
"left": 1,
"right": 1,
"auto": 1,
"line-left": 1,
"line-right": 1
};
function findDirectionSetting(value) {
if (typeof value !== "string") {
return false;
}
var dir = directionSetting[value.toLowerCase()];
return dir ? value.toLowerCase() : false;
}
function findAlignSetting(value) {
if (typeof value !== "string") {
return false;
}
var align = alignSetting[value.toLowerCase()];
return align ? value.toLowerCase() : false;
}
function VTTCue(startTime, endTime, text) {
/**
* Shim implementation specific properties. These properties are not in
* the spec.
*/
// Lets us know when the VTTCue's data has changed in such a way that we need
// to recompute its display state. This lets us compute its display state
// lazily.
this.hasBeenReset = false;
/**
* VTTCue and TextTrackCue properties
* http://dev.w3.org/html5/webvtt/#vttcue-interface
*/
var _id = "";
var _pauseOnExit = false;
var _startTime = startTime;
var _endTime = endTime;
var _text = text;
var _region = null;
var _vertical = "";
var _snapToLines = true;
var _line = "auto";
var _lineAlign = "start";
var _position = "auto";
var _positionAlign = "auto";
var _size = 100;
var _align = "center";
Object.defineProperties(this, {
"id": {
enumerable: true,
get: function() {
return _id;
},
set: function(value) {
_id = "" + value;
}
},
"pauseOnExit": {
enumerable: true,
get: function() {
return _pauseOnExit;
},
set: function(value) {
_pauseOnExit = !!value;
}
},
"startTime": {
enumerable: true,
get: function() {
return _startTime;
},
set: function(value) {
if (typeof value !== "number") {
throw new TypeError("Start time must be set to a number.");
}
_startTime = value;
this.hasBeenReset = true;
}
},
"endTime": {
enumerable: true,
get: function() {
return _endTime;
},
set: function(value) {
if (typeof value !== "number") {
throw new TypeError("End time must be set to a number.");
}
_endTime = value;
this.hasBeenReset = true;
}
},
"text": {
enumerable: true,
get: function() {
return _text;
},
set: function(value) {
_text = "" + value;
this.hasBeenReset = true;
}
},
"region": {
enumerable: true,
get: function() {
return _region;
},
set: function(value) {
_region = value;
this.hasBeenReset = true;
}
},
"vertical": {
enumerable: true,
get: function() {
return _vertical;
},
set: function(value) {
var setting = findDirectionSetting(value);
// Have to check for false because the setting an be an empty string.
if (setting === false) {
throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");
}
_vertical = setting;
this.hasBeenReset = true;
}
},
"snapToLines": {
enumerable: true,
get: function() {
return _snapToLines;
},
set: function(value) {
_snapToLines = !!value;
this.hasBeenReset = true;
}
},
"line": {
enumerable: true,
get: function() {
return _line;
},
set: function(value) {
if (typeof value !== "number" && value !== autoKeyword) {
throw new SyntaxError("Line: an invalid number or illegal string was specified.");
}
_line = value;
this.hasBeenReset = true;
}
},
"lineAlign": {
enumerable: true,
get: function() {
return _lineAlign;
},
set: function(value) {
var setting = findAlignSetting(value);
if (!setting) {
console.warn("lineAlign: an invalid or illegal string was specified.");
} else {
_lineAlign = setting;
this.hasBeenReset = true;
}
}
},
"position": {
enumerable: true,
get: function() {
return _position;
},
set: function(value) {
if (value < 0 || value > 100) {
throw new Error("Position must be between 0 and 100.");
}
_position = value;
this.hasBeenReset = true;
}
},
"positionAlign": {
enumerable: true,
get: function() {
return _positionAlign;
},
set: function(value) {
var setting = findAlignSetting(value);
if (!setting) {
console.warn("positionAlign: an invalid or illegal string was specified.");
} else {
_positionAlign = setting;
this.hasBeenReset = true;
}
}
},
"size": {
enumerable: true,
get: function() {
return _size;
},
set: function(value) {
if (value < 0 || value > 100) {
throw new Error("Size must be between 0 and 100.");
}
_size = value;
this.hasBeenReset = true;
}
},
"align": {
enumerable: true,
get: function() {
return _align;
},
set: function(value) {
var setting = findAlignSetting(value);
if (!setting) {
throw new SyntaxError("align: an invalid or illegal alignment string was specified.");
}
_align = setting;
this.hasBeenReset = true;
}
}
});
/**
* Other <track> spec defined properties
*/
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state
this.displayState = undefined;
}
/**
* VTTCue methods
*/
VTTCue.prototype.getCueAsHTML = function() {
// Assume WebVTT.convertCueToDOMTree is on the global.
return WebVTT.convertCueToDOMTree(window, this.text);
};
module.exports = VTTCue;

43
node_modules/videojs-vtt.js/lib/vttregion-extended.js generated vendored Normal file
View file

@ -0,0 +1,43 @@
/**
* Copyright 2013 vtt.js Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// If we're in Node.js then require VTTRegion so we can extend it, otherwise assume
// VTTRegion is on the global.
if (typeof module !== "undefined" && module.exports) {
this.VTTRegion = require("./vttregion").VTTRegion;
}
// Extend VTTRegion with methods to convert to JSON, from JSON, and construct a
// VTTRegion from an options object. The primary purpose of this is for use in the
// vtt.js test suite. It's also useful if you need to work with VTTRegions in
// JSON format.
(function(root) {
root.VTTRegion.create = function(options) {
var region = new root.VTTRegion();
for (var key in options) {
if (region.hasOwnProperty(key)) {
region[key] = options[key];
}
}
return region;
};
root.VTTRegion.fromJSON = function(json) {
return this.create(JSON.parse(json));
};
}(this));

135
node_modules/videojs-vtt.js/lib/vttregion.js generated vendored Normal file
View file

@ -0,0 +1,135 @@
/**
* Copyright 2013 vtt.js Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var scrollSetting = {
"": true,
"up": true
};
function findScrollSetting(value) {
if (typeof value !== "string") {
return false;
}
var scroll = scrollSetting[value.toLowerCase()];
return scroll ? value.toLowerCase() : false;
}
function isValidPercentValue(value) {
return typeof value === "number" && (value >= 0 && value <= 100);
}
// VTTRegion shim http://dev.w3.org/html5/webvtt/#vttregion-interface
function VTTRegion() {
var _width = 100;
var _lines = 3;
var _regionAnchorX = 0;
var _regionAnchorY = 100;
var _viewportAnchorX = 0;
var _viewportAnchorY = 100;
var _scroll = "";
Object.defineProperties(this, {
"width": {
enumerable: true,
get: function() {
return _width;
},
set: function(value) {
if (!isValidPercentValue(value)) {
throw new Error("Width must be between 0 and 100.");
}
_width = value;
}
},
"lines": {
enumerable: true,
get: function() {
return _lines;
},
set: function(value) {
if (typeof value !== "number") {
throw new TypeError("Lines must be set to a number.");
}
_lines = value;
}
},
"regionAnchorY": {
enumerable: true,
get: function() {
return _regionAnchorY;
},
set: function(value) {
if (!isValidPercentValue(value)) {
throw new Error("RegionAnchorX must be between 0 and 100.");
}
_regionAnchorY = value;
}
},
"regionAnchorX": {
enumerable: true,
get: function() {
return _regionAnchorX;
},
set: function(value) {
if(!isValidPercentValue(value)) {
throw new Error("RegionAnchorY must be between 0 and 100.");
}
_regionAnchorX = value;
}
},
"viewportAnchorY": {
enumerable: true,
get: function() {
return _viewportAnchorY;
},
set: function(value) {
if (!isValidPercentValue(value)) {
throw new Error("ViewportAnchorY must be between 0 and 100.");
}
_viewportAnchorY = value;
}
},
"viewportAnchorX": {
enumerable: true,
get: function() {
return _viewportAnchorX;
},
set: function(value) {
if (!isValidPercentValue(value)) {
throw new Error("ViewportAnchorX must be between 0 and 100.");
}
_viewportAnchorX = value;
}
},
"scroll": {
enumerable: true,
get: function() {
return _scroll;
},
set: function(value) {
var setting = findScrollSetting(value);
// Have to check for false as an empty string is a legal value.
if (setting === false) {
console.warn("Scroll: an invalid or illegal string was specified.");
} else {
_scroll = setting;
}
}
}
});
}
module.exports = VTTRegion;

101
node_modules/videojs-vtt.js/package.json generated vendored Normal file
View file

@ -0,0 +1,101 @@
{
"_from": "videojs-vtt.js@^0.15.3",
"_id": "videojs-vtt.js@0.15.3",
"_inBundle": false,
"_integrity": "sha512-5FvVsICuMRx6Hd7H/Y9s9GDeEtYcXQWzGMS+sl4UX3t/zoHp3y+isSfIPRochnTH7h+Bh1ILyC639xy9Z6kPag==",
"_location": "/videojs-vtt.js",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "videojs-vtt.js@^0.15.3",
"name": "videojs-vtt.js",
"escapedName": "videojs-vtt.js",
"rawSpec": "^0.15.3",
"saveSpec": null,
"fetchSpec": "^0.15.3"
},
"_requiredBy": [
"/video.js"
],
"_resolved": "https://registry.npmjs.org/videojs-vtt.js/-/videojs-vtt.js-0.15.3.tgz",
"_shasum": "84260393b79487fcf195d9372f812d7fab83a993",
"_spec": "videojs-vtt.js@^0.15.3",
"_where": "F:\\Documents\\websites\\BMM\\node_modules\\video.js",
"author": {
"name": "Andreas Gal",
"email": "gal@mozilla.com"
},
"bugs": {
"url": "https://github.com/videojs/vtt.js/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Gary Katsevman",
"email": "me@gkatsev.com"
}
],
"dependencies": {
"global": "^4.3.1"
},
"deprecated": false,
"description": "A JavaScript implementation of the WebVTT specification, forked from vtt.js for use with Video.js",
"devDependencies": {
"async": "0.9.0",
"browserify": "^14.3.0",
"deumdify": "^1.2.4",
"difflet": "git://github.com/humphd/difflet.git#714b82706ad39d75275a886aeff637df5097626f",
"dive": "0.3.1",
"grunt": "0.4.1",
"grunt-bump": "0.0.14",
"grunt-cli": "0.1.9",
"grunt-contrib-concat": "0.4.0",
"grunt-contrib-jshint": "0.10.0",
"grunt-contrib-uglify": "0.5.0",
"grunt-mocha-test": "0.11.0",
"json-stable-stringify": "1.0.0",
"mocha": "1.20.1",
"node-vtt": "1.1.7",
"optimist": "0.6.1",
"text-encoding": "0.1.0",
"underscore": "1.6.0",
"watchify": "^3.9.0"
},
"files": [
"dist/",
"lib/browser.js",
"lib/index.js",
"lib/vtt.js",
"lib/vttcue.js",
"lib/vttcue-extended.js",
"lib/vttregion.js",
"lib/vttregion-extended.js"
],
"homepage": "https://github.com/videojs/vtt.js",
"keywords": [
"vtt",
"webvtt",
"track",
"captions",
"subtitles",
"text track"
],
"license": "Apache-2.0",
"main": "lib/browser-index.js",
"name": "videojs-vtt.js",
"repository": {
"type": "git",
"url": "git+https://github.com/videojs/vtt.js.git"
},
"scripts": {
"build": "npm run build-umd && npm run build-global",
"build-global": "browserify -s vttjs -p deumdify . -o dist/vtt.global.js",
"build-umd": "browserify -s vttjs . -o dist/vtt.js",
"minify": "grunt uglify:dist uglify:global",
"postbuild": "npm run minify",
"prepublishOnly": "npm run build",
"test": "grunt"
},
"version": "0.15.3"
}