Go to file
Jeremy Thomerson b22c7d5d0a Version bump: 1.0.2
Note: the original v1.0.2 tag somehow was deleted without being pushed. We can
not find why or how that happened, so this is being recreated by re-tagging the
same commit that was originally tagged as v1.0.2. We will not re-publish the npm
v1.0.2 package because they would be equivalent. The version bump commit for this
v1.0.2 tag will not appear in the origin/master history because origin/master has
already had other commits (what will become v1.0.3) added to it after the commit
that formed the base of v1.0.2 (25c33b0ac1). All
that is lost on master is the version bump commit itself, which will be represented
by the tag for v1.0.2, so it will not be lost entirely, it will just not be
present on origin/master.
2017-11-22 10:39:08 -05:00
docs/demo PR Modification: Use 'selected' instead of 'isDefault' 2017-08-04 09:48:58 -04:00
src Fixes #7 Add localized control text to quality selector menu button 2017-10-25 11:49:27 -04:00
tests Initial commit 2017-06-20 20:43:49 -04:00
.eslintrc.json Initial commit 2017-06-20 20:43:49 -04:00
.gitignore Initial implementation 2017-08-03 09:21:16 -04:00
.npmignore Initial implementation 2017-08-03 09:21:16 -04:00
.travis.yml Initial commit 2017-06-20 20:43:49 -04:00
Gruntfile.js Add 'grunt develop' 2017-08-04 14:23:15 -04:00
LICENSE Initial commit 2017-06-20 20:43:49 -04:00
README.md Add initial plugin docs 2017-08-10 11:32:22 -04:00
package.json Version bump: 1.0.2 2017-11-22 10:39:08 -05:00

README.md

Silvermine VideoJS Quality/Resolution Selector

Build Status Coverage Status Dependency Status Dev Dependency Status

What is it?

A plugin for videojs versions 6+ that adds a button to the control bar which will allow the user to choose from available video qualities or resolutions.

How do I use it?

There are three primary steps to use this plug-in: (1) including, (2) providing sources, and (3) adding the component the to controlBar. Please see the following for information on each step.

Including/Requiring

Using <script> tag

The minified JS file can come from a downloaded copy or a CDN. When including it, make sure that the <script> tag for the plugin appears after the include for video.js (note that this plugin will look for videojs at window.videojs).

There is an example of this in docs/demo/index.html.

From local file:
<script src="./path/to/video.min.js"></script>
<script src="./path/to/silvermine-videojs-quality-selector.min.js"></script>
From unpkg:
<script src="./path/to/video.min.js"></script>
<script src="https://unpkg.com/silvermine-videojs-quality-selector/dist/js/silvermine-videojs-quality-selector.min.js"></script>

Using require

When using NPM/Browserify, first install the plugin.

npm install --save silvermine-videojs-quality-selector

For videojs to use the plug-in, the plugin needs to register itself with the instance of videojs. This can be accomplished by:

var videojs = require('videojs');

// The following registers the plugin with `videojs`
require('silvermine-videojs-quality-selector')(videojs);

Providing video sources

Sources can be provided with either the <source> tag or via the src function on the instance of a video.js player.

Using <source>

<video id="video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268" data-setup='{}'>
   <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">
</video>

Using player.src()

player.src([
   {
      src: 'https://example.com/video_720.mp4',
      type: 'video/mp4',
      label: '720P',
   },
   {
      src: 'https://example.com/video_480.mp4',
      type: 'video/mp4',
      label: '480P',
      selected: true,
   },
   {
      src: 'https://example.com/video_360.mp4',
      type: 'video/mp4',
      label: '360P',
   },
]);

Adding to the player

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');

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

var options, player;

options = {
   controlBar: {
      children: [
         'playToggle',
         'progressControl',
         'volumePanel',
         'qualitySelector',
         'fullscreenToggle',
      ],
   },
};

player = videojs('video_1', options);

How do I contribute?

We genuinely appreciate external contributions. See our extensive documentation on how to contribute.

License

This software is released under the MIT license. See the license file for more details.