Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisboustead committed Nov 10, 2017
0 parents commit f0a97f8
Show file tree
Hide file tree
Showing 23 changed files with 1,020 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# OS
Thumbs.db
ehthumbs.db
Desktop.ini
.DS_Store
._*

# Editors
*~
*.swp
*.tmproj
*.tmproject
*.sublime-*
.idea/
.project/
.settings/
.vscode/

# Logs
logs
*.log
npm-debug.log*

# Dependency directories
bower_components/
node_modules/

# Yeoman meta-data
.yo-rc.json

# Build-related directories
dist/
docs/api/
test/dist/
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Intentionally left blank, so that npm does not ignore anything by default,
# but relies on the package.json "files" array to explicitly define what ends
# up in the package.
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
sudo: false
dist: trusty
language: node_js
node_js:
- 'node'
- 'lts/argon'
before_script:

# Check if the current version is equal to the major version for the env.
- 'export IS_INSTALLED="$(npm list video.js | grep "video.js@$VJS")"'

# We have to add semicolons to the end of each line in the if as Travis runs
# this all on one line.
- 'if [ -z "$IS_INSTALLED" ]; then
echo "INSTALLING video.js@>=$VJS.0.0-RC.0 <$(($VJS+1)).0.0";
npm i "video.js@>=$VJS.0.0-RC.0 <\$(($VJS+1)).0.0";
else
echo "video.js@$VJS ALREADY INSTALLED";
fi'
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
env:
- VJS=5
- VJS=6
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
Empty file added CHANGELOG.md
Empty file.
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# CONTRIBUTING

We welcome contributions from everyone!

## Getting Started

Make sure you have NodeJS 0.10 or higher and npm installed.

1. Fork this repository and clone your fork
1. Install dependencies: `npm install`
1. Run a development server: `npm start`

### Making Changes

Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship.

When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository.

### Running Tests

Testing is a crucial part of any software project. For all but the most trivial changes (typos, etc) test cases are expected. Tests are run in actual browsers using [Karma][karma].

- In all available and supported browsers: `npm test`
- In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc.
- While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local]


[karma]: http://karma-runner.github.io/
[local]: http://localhost:9999/test/
[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) Chris Boustead <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# videojs-vtt-thumbnails

Video.js plugin that displays thumbnails on progress bar hover, driven by external VTT files. Based on the spec at: https://support.jwplayer.com/customer/portal/articles/1407439-adding-preview-thumbnails

Note: Plugin hides the default skin's mouse display timestamp on hover.

## Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Installation

- [Installation](#installation)
- [Usage](#usage)
- [`<script>` Tag](#script-tag)
- [Browserify/CommonJS](#browserifycommonjs)
- [RequireJS/AMD](#requirejsamd)
- [License](#license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Installation

```sh
npm install --save videojs-vtt-thumbnails
```

## Usage

To include videojs-vtt-thumbnails on your website or web application, use any of the following methods.

### `<script>` Tag

This is the simplest case. Get the script in whatever way you prefer and include the plugin _after_ you include [video.js][videojs], so that the `videojs` global is available.

```html
<script src="//path/to/video.min.js"></script>
<script src="//path/to/videojs-vtt-thumbnails.min.js"></script>
<script>
var player = videojs('my-video');
player.vttThumbnails({
src: 'example/thumbs.vtt'
});
</script>
```

### Browserify/CommonJS

When using with Browserify, install videojs-vtt-thumbnails via npm and `require` the plugin as you would any other module.

```js
var videojs = require('video.js');

// The actual plugin function is exported by this module, but it is also
// attached to the `Player.prototype`; so, there is no need to assign it
// to a variable.
require('videojs-vtt-thumbnails');

var player = videojs('my-video');

player.vttThumbnails();
```

### RequireJS/AMD

When using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the plugin as you normally would:

```js
require(['video.js', 'videojs-vtt-thumbnails'], function(videojs) {
var player = videojs('my-video');

player.vttThumbnails();
});
```

## License

MIT. Copyright (c) Chris Boustead &lt;[email protected]&gt;


[videojs]: http://videojs.com/
Binary file added example/thumbs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions example/thumbs.vtt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
WEBVTT
00:00.000 --> 00:05.000
thumbs.jpg#xywh=0,0,160,70

00:05.000 --> 00:10.000
thumbs.jpg#xywh=160,0,160,70

00:10.000 --> 00:15.000
thumbs.jpg#xywh=0,70,160,70

00:15.000 --> 00:20.000
thumbs.jpg#xywh=160,70,160,70
30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>videojs-vtt-thumbnails Demo</title>
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
<link href="dist/videojs-vtt-thumbnails.css" rel="stylesheet">
</head>
<body>
<video id="videojs-vtt-thumbnails-player" class="video-js vjs-default-skin" controls>
<source src="//vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
<source src="//vjs.zencdn.net/v/oceans.webm" type='video/webm'>
</video>
<ul>
<li><a href="test/">Run unit tests in browser.</a></li>
<li><a href="docs/api/">Read generated docs.</a></li>
</ul>

<script src="node_modules/video.js/dist/video.js"></script>
<script src="dist/videojs-vtt-thumbnails.js"></script>
<script>
(function(window, videojs) {
var player = window.player = videojs('videojs-vtt-thumbnails-player');
player.vttThumbnails({
src: 'example/thumbs.vtt'
});
}(window, window.videojs));
</script>
</body>
</html>
3 changes: 3 additions & 0 deletions jsdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["plugins/markdown"]
}
107 changes: 107 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"name": "videojs-vtt-thumbnails",
"version": "0.0.0",
"description": "Display thumnails on progress bar hover, driven by external VTT files.",
"main": "dist/videojs-vtt-thumbnails.cjs.js",
"module": "dist/videojs-vtt-thumbnails.es.js",
"generator-videojs-plugin": {
"version": "5.0.3"
},
"scripts": {
"prebuild": "npm run clean",
"build": "npm-run-all -p build:*",
"build:css": "npm-run-all build:css:sass build:css:bannerize",
"build:css:bannerize": "bannerize dist/videojs-vtt-thumbnails.css --banner=scripts/banner.ejs",
"build:css:sass": "node-sass src/plugin.scss dist/videojs-vtt-thumbnails.css --output-style=compressed --linefeed=lf",
"build:js": "npm-run-all build:js:rollup-modules build:js:rollup-umd build:js:bannerize build:js:uglify",
"build:js:bannerize": "bannerize dist/videojs-vtt-thumbnails.js --banner=scripts/banner.ejs",
"build:js:rollup-modules": "rollup -c scripts/modules.rollup.config.js",
"build:js:rollup-umd": "rollup -c scripts/umd.rollup.config.js",
"build:js:uglify": "uglifyjs dist/videojs-vtt-thumbnails.js --comments --mangle --compress -o dist/videojs-vtt-thumbnails.min.js",
"build:test": "rollup -c scripts/test.rollup.config.js",
"clean": "rimraf dist test/dist",
"postclean": "mkdirp dist test/dist",
"docs": "npm-run-all docs:*",
"docs:api": "jsdoc src -r -c jsdoc.json -d docs/api",
"docs:toc": "doctoc README.md",
"lint": "vjsstandard",
"start": "npm-run-all -p start:server watch",
"start:server": "static -a 0.0.0.0 -p 9999 -H '{\"Cache-Control\": \"no-cache, must-revalidate\"}' .",
"pretest": "npm-run-all lint build",
"test": "karma start test/karma.conf.js",
"preversion": "npm test",
"version": "node scripts/version.js",
"watch": "npm-run-all -p watch:*",
"watch:css": "npm-run-all build:css:sass watch:css:sass",
"watch:css:sass": "node-sass src/plugin.scss dist/videojs-vtt-thumbnails.css --output-style=compressed --linefeed=lf --watch src/**/*.scss",
"watch:js-modules": "rollup -c scripts/modules.rollup.config.js -w",
"watch:js-umd": "rollup -c scripts/umd.rollup.config.js -w",
"watch:test": "rollup -c scripts/test.rollup.config.js -w",
"prepublish": "npm run build",
"prepush": "npm run lint",
"precommit": "npm run docs:toc && git add README.md"
},
"keywords": [
"videojs",
"videojs-plugin"
],
"author": "Chris Boustead <[email protected]>",
"license": "MIT",
"vjsstandard": {
"ignore": [
"dist",
"docs",
"test/dist",
"test/karma.conf.js"
]
},
"files": [
"CONTRIBUTING.md",
"dist/",
"docs/",
"index.html",
"scripts/",
"src/",
"test/"
],
"dependencies": {
"global": "^4.3.2",
"request": "^2.83.0",
"video.js": "^5.19.2"
},
"devDependencies": {
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-preset-es2015": "^6.14.0",
"bannerize": "^1.0.2",
"conventional-changelog-cli": "^1.3.1",
"conventional-changelog-videojs": "^3.0.0",
"doctoc": "^1.3.0",
"husky": "^0.13.3",
"jsdoc": "^3.4.3",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.1.1",
"karma-detect-browsers": "^2.2.5",
"karma-firefox-launcher": "^1.0.1",
"karma-ie-launcher": "^1.0.0",
"karma-qunit": "^1.2.1",
"karma-safari-launcher": "^1.0.0",
"mkdirp": "^0.5.1",
"node-sass": "4.5.3",
"node-static": "^0.7.9",
"npm-run-all": "^4.0.2",
"qunitjs": "^2.3.2",
"rimraf": "^2.6.1",
"rollup": "^0.50.0",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-json": "^2.1.1",
"rollup-plugin-multi-entry": "^2.0.1",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-watch": "^3.2.2",
"semver": "^5.3.0",
"sinon": "^2.2.0",
"uglify-js": "^3.0.7",
"videojs-standard": "^6.0.0"
}
}
6 changes: 6 additions & 0 deletions scripts/banner.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* <%- pkg.name %>
* @version <%- pkg.version %>
* @copyright <%- date.getFullYear() %> <%- pkg.author %>
* @license <%- pkg.license %>
*/
Loading

0 comments on commit f0a97f8

Please sign in to comment.