Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ec9b3aa
docs: Update README.md to include CSS instructions for npm
anstosa Dec 8, 2020
c9afd4d
Merge pull request #69 from anstosa/css-readme
jthomerson Apr 11, 2021
032b6e6
chore: update node to 12.22.1 and drop support for node 8
jimjenkins5 May 11, 2021
81670b0
chore: use standardization library
jimjenkins5 May 11, 2021
4fec3ec
chore: update eslint-config to 3.0.1
jimjenkins5 May 11, 2021
098ec73
chore: downgrade autoprefixer to v8.6.5
jimjenkins5 May 11, 2021
93e7525
chore: upgrade dependencies with vulnerabilities
jimjenkins5 May 11, 2021
be16b8a
chore: replace istanbul with nyc
jimjenkins5 May 11, 2021
3f3c4fd
Merge pull request #73 from jimjenkins5/jimjenkins5/package-vulnerabi…
jthomerson May 14, 2021
263b1f4
chore: version bump: 1.2.5
jthomerson May 14, 2021
99006b8
chore: upgrade standardization and configure markdownlint
pbredenberg Sep 10, 2021
8b1a082
Merge pull request #76 from pbredenberg/pb/chore-standardization-upgr…
onebytegone Sep 10, 2021
f607dda
chore: Move SCSS from sass to scss (#4)
izkmdz Feb 15, 2022
613e311
docs: Remove data-setup property to prevent double initialization (#70)
izkmdz Feb 22, 2022
df38cde
Merge pull request #83 from izkmdz/ismendoza/remove-data-setup
yokuze Apr 4, 2022
5cf15e5
chore: Replace node-sass with sass
izkmdz Feb 15, 2022
32fac40
Merge pull request #80 from izkmdz/ismendoza/update-sass
yokuze Apr 7, 2022
cc87e2c
chore: ignore intellij IDE config
pbredenberg Jun 16, 2022
e2b3735
chore: add @silvermine/standardization and configuration
pbredenberg Jun 16, 2022
de5ff2c
chore: upgrade Node to 16.15.0 and NPM to 8.5.5
pbredenberg Jul 8, 2022
dc6dc0a
Merge pull request #85 from pbredenberg/pb/upgrade-node
yokuze Dec 26, 2022
9c44e09
chore: update to @silvermine/standardization v2.0.0
crgwbr Jul 19, 2022
03c63ea
refactor: use es6 classes
crgwbr Jul 19, 2022
c416a31
Merge pull request #86 from crgwbr/crweber/es6_classes
yokuze Dec 27, 2022
738a1b2
build: prevent error thrown when installed from a git URL
yokuze Dec 27, 2022
a40e9a6
Merge pull request #91 from yokuze/yokuze/fix_install_from_git_hash_i…
onebytegone Dec 27, 2022
68eb394
refactor: Use ES6 classes instead of videojs.extend
absidue Jan 29, 2023
daf6f2a
chore: version bump: v1.3.0
onebytegone Mar 21, 2023
1d509cf
ci: add GitHub Actions configuration
pbredenberg Apr 20, 2023
889088f
chore: add commitlint NPM script to standards NPM script
pbredenberg Apr 20, 2023
4ceb44f
Merge pull request #96 from pbredenberg/pb/ci-migrate-to-github-actions
onebytegone Apr 21, 2023
d16842b
Merge pull request #93 from absidue/no-vjs-extend
yokuze Aug 1, 2023
f9f3230
docs: fix path to demo video sources
yokuze Nov 14, 2023
1209756
fix: use correct icon for Video.js 8
yokuze Nov 14, 2023
f77455f
docs: update demo source files to use Video.js 8
yokuze Nov 14, 2023
0e3e217
chore: update caniuse database for latest browser usage stats
yokuze Nov 14, 2023
99b43e5
docs: add warning to README about ES5 compatibility
yokuze Nov 14, 2023
db9791a
Merge pull request #103 from yokuze/fix_demo_sources
onebytegone Nov 15, 2023
4433638
Merge pull request #104 from yokuze/support_videojs_8
onebytegone Nov 15, 2023
a985caf
docs: fix path to polyfilled/transpiled JS file
yokuze Nov 15, 2023
f50f2f7
Merge pull request #105 from yokuze/fix_path_to_js_in_readme
onebytegone Nov 15, 2023
2787591
chore: update changelog for v1.3.1
onebytegone Nov 15, 2023
520c685
Merge pull request #106 from silvermine/changelog-v1.3.1
yokuze Nov 15, 2023
a89750e
chore: version bump: v1.3.1
onebytegone Nov 15, 2023
6550599
Show selector with single source
omarroth Mar 2, 2020
294c48d
Add the ability to hide quality options
unixfox Apr 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .browserslistrc
1 change: 1 addition & 0 deletions .editorconfig
5 changes: 2 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{

"extends": "@silvermine/eslint-config/node"

"extends": "@silvermine/eslint-config/node",
"parser": "babel-eslint"
}
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history
-
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: npm i -g [email protected]
- run: npm ci
- run: npm run standards
test:
needs: [ build ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [ 14, 16, 'lts/*', 'latest' ]
steps:
- uses: actions/checkout@v3
-
name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g [email protected]
- run: npm ci # Reinstall the dependencies to ensure they install with the current version of node
- run: npm test
- name: Coveralls
uses: coverallsapp/github-action@v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.DS_Store
node_modules
coverage
.nyc_output
dist
.idea
3 changes: 3 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/@silvermine/standardization/.markdownlint.json"
}
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
Gruntfile.js
tests/**
docs
.nyc_output
coverage
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.14.0
16.15.0
16 changes: 16 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"include": [
"src/**/*.js"
],
"extension": [
".js"
],
"reporter": [
"text-summary",
"html",
"lcov"
],
"instrument": true,
"sourceMap": true,
"all": true
}
1 change: 1 addition & 0 deletions .stylelintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: ./node_modules/@silvermine/standardization/.stylelintrc.yml
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Silvermine VideoJS Quality/Resolution Selector Change Log
# Changelog

All notable changes to this project will be documented in this file.
See [our coding standards][commit-messages] for commit guidelines.

### [1.3.1](https://github.com/silvermine/videojs-quality-selector/compare/v1.3.0...v1.3.1) (2023-11-15)


### Bug Fixes

* use correct icon for Video.js 8 ([1209756](https://github.com/silvermine/videojs-quality-selector/commit/1209756616af52843f55ac53e2c7fbe29df63541))

In general, this project adheres to [Semantic Versioning](http://semver.org/). If for some
reason we do something that's not strictly semantic, it will be clearly called out below.

## 1.2.3

Expand Down
58 changes: 35 additions & 23 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@
* Copyright (c) 2017 Jeremy Thomerson
* Licensed under the MIT license.
*/

'use strict';

var path = require('path'),
getCodeVersion = require('silvermine-serverless-utils/src/get-code-version');

const sass = require('node-sass');
const sass = require('sass');

module.exports = function(grunt) {

var DEBUG = !!grunt.option('debug'),
config;
pkgJSON = grunt.file.readJSON('package.json'),
config, versionInfo;

try {
versionInfo = getCodeVersion.both();
} catch(e) {
// When this package is installed as a git URL, getCodeVersion throws an error and
// is not able to find the git version for this package. So, we fall back to using
// the version number from package.json
versionInfo = pkgJSON.version;
}

config = {
js: {
Expand All @@ -22,7 +29,7 @@ module.exports = function(grunt) {
},

sass: {
base: path.join(__dirname, 'src', 'sass'),
base: path.join(__dirname, 'src', 'scss'),
all: [ 'src/**/*.scss' ],
},

Expand All @@ -44,14 +51,34 @@ module.exports = function(grunt) {

grunt.initConfig({

pkg: grunt.file.readJSON('package.json'),
versionInfo: getCodeVersion.both(),
pkg: pkgJSON,
versionInfo: versionInfo,
config: config,

browserify: {
main: {
src: config.js.standalone,
dest: config.dist.js.bundle,
options: {
transform: [
[
'babelify',
{
presets: [
[
'@babel/preset-env',
{
debug: true,
useBuiltIns: 'usage',
shippedProposals: true,
corejs: 3,
},
],
],
},
],
],
},
},
},

Expand Down Expand Up @@ -109,17 +136,6 @@ module.exports = function(grunt) {
dist: config.dist.base,
},

eslint: {
target: config.js.all,
},

sasslint: {
options: {
configFile: path.join(__dirname, 'node_modules', '@silvermine/sass-lint-config', 'sass-lint.yml'),
},
target: config.sass.all,
},

watch: {
grunt: {
files: [ 'Gruntfile.js' ],
Expand All @@ -136,19 +152,15 @@ module.exports = function(grunt) {
tasks: [ 'build-css' ],
},
},

});

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-sass-lint');

grunt.registerTask('standards', [ 'eslint', 'sasslint' ]);
grunt.registerTask('build-js', [ 'browserify', 'uglify' ]);
grunt.registerTask('build-css', [ 'sass', 'postcss' ]);
grunt.registerTask('build', [ 'build-js', 'build-css' ]);
Expand Down
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ for `videojs` at `window.videojs`).
There is an example of this in
[`docs/demo/index.html`](./docs/demo/index.html).

##### From local file:
##### From local file

```js
<script src="./path/to/video.min.js"></script>
<script src="./path/to/silvermine-videojs-quality-selector.min.js"></script>
```

##### From [`unpkg`](https://unpkg.com/@silvermine/videojs-quality-selector/):
##### From [`unpkg`](https://unpkg.com/@silvermine/videojs-quality-selector/)

```js
<link href="https://unpkg.com/@silvermine/videojs-quality-selector/dist/css/quality-selector.css" rel="stylesheet">
Expand All @@ -50,7 +50,7 @@ There is an example of this in

When using NPM/Browserify, first install the plugin.

```
```bash
npm install --save @silvermine/videojs-quality-selector
```

Expand All @@ -64,6 +64,23 @@ var videojs = require('videojs');
require('@silvermine/videojs-quality-selector')(videojs);
```

Remember to also add the CSS to your build. With most bundlers you can:

```js
require('@silvermine/videojs-quality-selector/dist/css/quality-selector.css')
```

> [!WARNING]
> This plugin's source code uses ES6+ syntax and keywords, such as `class` and `static`.
> If you need to support [browsers that do not support newer JavaScript
> syntax](https://caniuse.com/es6), you will need to use a tool like
> [Babel](https://babeljs.io/) to transpile and polyfill your code.
>
> Alternatively, you can
> `require('@silvermine/videojs-quality-selector/dist/js/silvermine-videojs-quality-selector.js')`
> to use a JavaScript file that has already been polyfilled/transpiled down to ES5
> compatibility.

### Providing video sources

Sources can be provided with either the `<source>` tag or via the `src` function on the
Expand All @@ -72,7 +89,7 @@ instance of a `video.js` player.
#### Using `<source>`

```html
<video id="video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268" data-setup='{}'>
<video id="video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268">
<source src="https://example.com/video_720.mp4" type="video/mp4" label="720P">
<source src="https://example.com/video_480.mp4" type="video/mp4" label="480P" selected="true">
<source src="https://example.com/video_360.mp4" type="video/mp4" label="360P">
Expand Down Expand Up @@ -107,13 +124,17 @@ player.src([
There are at least two ways to add the quality selector control to the player's control
bar. The first is directly adding it via `addChild`. For example:

```
player.controlBar.addChild('QualitySelector');
```js
videojs('video_1', {}, function() {
var player = this;

player.controlBar.addChild('QualitySelector');
});
```

The second option is to add the control via the player's options, for instance:

```
```js
var options, player;

options = {
Expand Down
4 changes: 1 addition & 3 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

module.exports = {
extends: [ '@silvermine/eslint-config/commitlint.js' ],
extends: [ '@silvermine/standardization/commitlint.js' ],
};
16 changes: 8 additions & 8 deletions docs/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
<head>
<meta charset=utf-8 />
<title>videojs-quality-selector Demo</title>
<link href="https://unpkg.com/video.js@7.5.4/dist/video-js.css" rel="stylesheet">
<script src="https://unpkg.com/video.js@7.5.4/dist/video.js"></script>
<link href="https://unpkg.com/video.js@8.6.1/dist/video-js.css" rel="stylesheet">
<script src="https://unpkg.com/video.js@8.6.1/dist/video.js"></script>
<script src="../../dist/js/silvermine-videojs-quality-selector.min.js"></script>
<link href="../../dist/css/quality-selector.css" rel="stylesheet">
</head>
<body>
<h1>Demo of <code>videojs-quality-selector</code></h1>

<video id="video_1" class="video-js vjs-default-skin" controls preload="auto" data-setup='{}'>
<source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/a/ab/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm.720p.webm" type="video/webm" label="720P">
<source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/a/ab/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm.480p.webm" type="video/webm" label="480P" selected="true">
<source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/a/ab/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm.360p.webm" type="video/webm" label="360P">
<source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/a/ab/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm.240p.webm" type="video/webm" label="240P">
<video id="video_1" class="video-js vjs-default-skin" controls preload="auto">
<source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/a/ab/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm.720p.vp9.webm" type="video/webm" label="720P">
<source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/a/ab/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm.480p.vp9.webm" type="video/webm" label="480P" selected="true">
<source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/a/ab/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm.360p.vp9.webm" type="video/webm" label="360P">
<source src="https://upload.wikimedia.org/wikipedia/commons/transcoded/a/ab/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm/Caminandes_3_-_Llamigos_-_Blender_Animated_Short.webm.240p.vp9.webm" type="video/webm" label="240P">
</video>

<script>
videojs("video_1", {}, function() {
videojs('video_1', {}, function() {
var player = this;

player.controlBar.addChild('QualitySelector');
Expand Down
Loading