Skip to content

Commit 97847fd

Browse files
committed
Initial commit
0 parents  commit 97847fd

21 files changed

+814
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_style = space
8+
indent_size = 2
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.gitignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# OS
2+
Thumbs.db
3+
ehthumbs.db
4+
Desktop.ini
5+
.DS_Store
6+
._*
7+
8+
# Editors
9+
*~
10+
*.swp
11+
*.tmproj
12+
*.tmproject
13+
*.sublime-*
14+
.idea/
15+
.project/
16+
.settings/
17+
.vscode/
18+
19+
# Logs
20+
logs
21+
*.log
22+
npm-debug.log*
23+
24+
# Dependency directories
25+
bower_components/
26+
node_modules/
27+
28+
# Yeoman meta-data
29+
.yo-rc.json
30+
31+
# Build-related directories
32+
dist/
33+
docs/api/
34+
test/dist/

.npmignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Intentionally left blank, so that npm does not ignore anything by default,
2+
# but relies on the package.json "files" array to explicitly define what ends
3+
# up in the package.

.travis.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
sudo: false
2+
dist: trusty
3+
language: node_js
4+
node_js:
5+
- 'node'
6+
- 'lts/argon'
7+
before_script:
8+
9+
# Check if the current version is equal to the major version for the env.
10+
- 'export IS_INSTALLED="$(npm list video.js | grep "video.js@$VJS")"'
11+
12+
# We have to add semicolons to the end of each line in the if as Travis runs
13+
# this all on one line.
14+
- 'if [ -z "$IS_INSTALLED" ]; then
15+
echo "INSTALLING video.js@>=$VJS.0.0-RC.0 <$(($VJS+1)).0.0";
16+
npm i "video.js@>=$VJS.0.0-RC.0 <\$(($VJS+1)).0.0";
17+
else
18+
echo "video.js@$VJS ALREADY INSTALLED";
19+
fi'
20+
- export CHROME_BIN=/usr/bin/google-chrome
21+
- export DISPLAY=:99.0
22+
- sh -e /etc/init.d/xvfb start
23+
env:
24+
- VJS=5
25+
- VJS=6
26+
addons:
27+
firefox: latest
28+
apt:
29+
sources:
30+
- google-chrome
31+
packages:
32+
- google-chrome-stable

CHANGELOG.md

Whitespace-only changes.

CONTRIBUTING.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# CONTRIBUTING
2+
3+
We welcome contributions from everyone!
4+
5+
## Getting Started
6+
7+
Make sure you have NodeJS 0.10 or higher and npm installed.
8+
9+
1. Fork this repository and clone your fork
10+
1. Install dependencies: `npm install`
11+
1. Run a development server: `npm start`
12+
13+
### Making Changes
14+
15+
Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship.
16+
17+
When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository.
18+
19+
### Running Tests
20+
21+
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].
22+
23+
- In all available and supported browsers: `npm test`
24+
- In a specific browser: `npm run test:chrome`, `npm run test:firefox`, etc.
25+
- While development server is running (`npm start`), navigate to [`http://localhost:9999/test/`][local]
26+
27+
28+
[karma]: http://karma-runner.github.io/
29+
[local]: http://localhost:9999/test/
30+
[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) Chris Boustead ([email protected])
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# videojs-hls-quality-selector
2+
3+
Adds a quality selector menu for HLS sources played in videojs. Requires `videojs-contrib-hls` and videojs-contrib-quality-levels plugins.
4+
5+
## Table of Contents
6+
7+
<!-- START doctoc -->
8+
<!-- END doctoc -->
9+
## Installation
10+
11+
```sh
12+
npm install --save videojs-hls-quality-selector
13+
```
14+
15+
## Usage
16+
17+
To include videojs-hls-quality-selector on your website or web application, use any of the following methods.
18+
19+
### `<script>` Tag
20+
21+
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.
22+
23+
```html
24+
<script src="//path/to/video.min.js"></script>
25+
<script src="//path/to/videojs-hls-quality-selector.min.js"></script>
26+
<script>
27+
var player = videojs('my-video');
28+
29+
player.hlsQualitySelector();
30+
</script>
31+
```
32+
33+
### Browserify/CommonJS
34+
35+
When using with Browserify, install videojs-hls-quality-selector via npm and `require` the plugin as you would any other module.
36+
37+
```js
38+
var videojs = require('video.js');
39+
40+
// The actual plugin function is exported by this module, but it is also
41+
// attached to the `Player.prototype`; so, there is no need to assign it
42+
// to a variable.
43+
require('videojs-hls-quality-selector');
44+
45+
var player = videojs('my-video');
46+
47+
player.hlsQualitySelector();
48+
```
49+
50+
### RequireJS/AMD
51+
52+
When using with RequireJS (or another AMD library), get the script in whatever way you prefer and `require` the plugin as you normally would:
53+
54+
```js
55+
require(['video.js', 'videojs-hls-quality-selector'], function(videojs) {
56+
var player = videojs('my-video');
57+
58+
player.hlsQualitySelector();
59+
});
60+
```
61+
62+
## License
63+
64+
MIT. Copyright (c) Chris Boustead ([email protected])
65+
66+
67+
[videojs]: http://videojs.com/

index.html

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>videojs-hls-quality-selector Demo</title>
6+
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
7+
<link href="dist/videojs-hls-quality-selector.css" rel="stylesheet">
8+
</head>
9+
<body>
10+
<video id="videojs-hls-quality-selector-player" class="video-js vjs-default-skin" width="640" height="360" controls>
11+
<source src="https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8" type="application/x-mpegURL">
12+
<!--<source src="//vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>-->
13+
<!--<source src="//vjs.zencdn.net/v/oceans.webm" type='video/webm'>-->
14+
</video>
15+
<ul>
16+
<li><a href="test/">Run unit tests in browser.</a></li>
17+
<li><a href="docs/api/">Read generated docs.</a></li>
18+
</ul>
19+
20+
<script src="node_modules/video.js/dist/video.js"></script>
21+
<script src="node_modules/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script>
22+
<script src="node_modules/videojs-contrib-quality-levels/dist/videojs-contrib-quality-levels.js"></script>
23+
<script src="dist/videojs-hls-quality-selector.js"></script>
24+
<script>
25+
(function(window, videojs) {
26+
var player = window.player = videojs('videojs-hls-quality-selector-player');
27+
player.hlsQualitySelector();
28+
}(window, window.videojs));
29+
</script>
30+
</body>
31+
</html>

jsdoc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": ["plugins/markdown"]
3+
}

package.json

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"name": "videojs-hls-quality-selector",
3+
"version": "0.0.1",
4+
"description": "Adds a quality selector menu for HLS sources played in videojs. Requires `videojs-contrib-hls` and videojs-contrib-quality-levels plugins.",
5+
"main": "dist/videojs-hls-quality-selector.cjs.js",
6+
"module": "dist/videojs-hls-quality-selector.es.js",
7+
"generator-videojs-plugin": {
8+
"version": "5.0.3"
9+
},
10+
"scripts": {
11+
"prebuild": "npm run clean",
12+
"build": "npm-run-all -p build:*",
13+
"build:css": "npm-run-all build:css:sass build:css:bannerize",
14+
"build:css:bannerize": "bannerize dist/videojs-hls-quality-selector.css --banner=scripts/banner.ejs",
15+
"build:css:sass": "node-sass src/plugin.scss dist/videojs-hls-quality-selector.css --output-style=compressed --linefeed=lf",
16+
"build:js": "npm-run-all build:js:rollup-modules build:js:rollup-umd build:js:bannerize build:js:uglify",
17+
"build:js:bannerize": "bannerize dist/videojs-hls-quality-selector.js --banner=scripts/banner.ejs",
18+
"build:js:rollup-modules": "rollup -c scripts/modules.rollup.config.js",
19+
"build:js:rollup-umd": "rollup -c scripts/umd.rollup.config.js",
20+
"build:js:uglify": "uglifyjs dist/videojs-hls-quality-selector.js --comments --mangle --compress -o dist/videojs-hls-quality-selector.min.js",
21+
"build:test": "rollup -c scripts/test.rollup.config.js",
22+
"clean": "rimraf dist test/dist",
23+
"postclean": "mkdirp dist test/dist",
24+
"docs": "npm-run-all docs:*",
25+
"docs:api": "jsdoc src -r -c jsdoc.json -d docs/api",
26+
"docs:toc": "doctoc README.md",
27+
"lint": "vjsstandard",
28+
"start": "npm-run-all -p start:server watch",
29+
"start:server": "static -a 0.0.0.0 -p 9999 -H '{\"Cache-Control\": \"no-cache, must-revalidate\"}' .",
30+
"pretest": "npm-run-all lint build",
31+
"test": "karma start test/karma.conf.js",
32+
"preversion": "npm test",
33+
"version": "node scripts/version.js",
34+
"watch": "npm-run-all -p watch:*",
35+
"watch:css": "npm-run-all build:css:sass watch:css:sass",
36+
"watch:css:sass": "node-sass src/plugin.scss dist/videojs-hls-quality-selector.css --output-style=compressed --linefeed=lf --watch src/**/*.scss",
37+
"watch:js-modules": "rollup -c scripts/modules.rollup.config.js -w",
38+
"watch:js-umd": "rollup -c scripts/umd.rollup.config.js -w",
39+
"watch:test": "rollup -c scripts/test.rollup.config.js -w",
40+
"prepublish": "npm run build",
41+
"prepush": "npm run lint",
42+
"precommit": "npm run docs:toc && git add README.md"
43+
},
44+
"keywords": [
45+
"videojs",
46+
"videojs-plugin"
47+
],
48+
"author": "Chris Boustead ([email protected])",
49+
"license": "MIT",
50+
"vjsstandard": {
51+
"ignore": [
52+
"dist",
53+
"docs",
54+
"test/dist",
55+
"test/karma.conf.js"
56+
]
57+
},
58+
"files": [
59+
"CONTRIBUTING.md",
60+
"dist/",
61+
"docs/",
62+
"index.html",
63+
"scripts/",
64+
"src/",
65+
"test/"
66+
],
67+
"dependencies": {
68+
"global": "^4.3.2",
69+
"video.js": "^5.19.2",
70+
"videojs-contrib-hls": "^5.12.2",
71+
"videojs-contrib-quality-levels": "^2.0.3"
72+
},
73+
"devDependencies": {
74+
"babel-plugin-external-helpers": "^6.22.0",
75+
"babel-plugin-transform-object-assign": "^6.8.0",
76+
"babel-preset-es2015": "^6.14.0",
77+
"bannerize": "^1.0.2",
78+
"conventional-changelog-cli": "^1.3.1",
79+
"conventional-changelog-videojs": "^3.0.0",
80+
"doctoc": "^1.3.0",
81+
"husky": "^0.13.3",
82+
"jsdoc": "^3.4.3",
83+
"karma": "^1.7.0",
84+
"karma-chrome-launcher": "^2.1.1",
85+
"karma-detect-browsers": "^2.2.5",
86+
"karma-firefox-launcher": "^1.0.1",
87+
"karma-ie-launcher": "^1.0.0",
88+
"karma-qunit": "^1.2.1",
89+
"karma-safari-launcher": "^1.0.0",
90+
"mkdirp": "^0.5.1",
91+
"node-sass": "4.5.3",
92+
"node-static": "^0.7.9",
93+
"npm-run-all": "^4.0.2",
94+
"qunitjs": "^2.3.2",
95+
"rimraf": "^2.6.1",
96+
"rollup": "^0.50.0",
97+
"rollup-plugin-babel": "^2.7.1",
98+
"rollup-plugin-commonjs": "^8.0.2",
99+
"rollup-plugin-json": "^2.1.1",
100+
"rollup-plugin-multi-entry": "^2.0.1",
101+
"rollup-plugin-node-resolve": "^3.0.0",
102+
"rollup-watch": "^3.2.2",
103+
"semver": "^5.3.0",
104+
"sinon": "^2.2.0",
105+
"uglify-js": "^3.0.7",
106+
"videojs-standard": "^6.0.0"
107+
}
108+
}

scripts/banner.ejs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* <%- pkg.name %>
3+
* @version <%- pkg.version %>
4+
* @copyright <%- date.getFullYear() %> <%- pkg.author %>
5+
* @license <%- pkg.license %>
6+
*/

0 commit comments

Comments
 (0)