Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @silvermine/videojs-quality-selector with all npm packages installed. Try it out:

require("video.js/package.json"); // video.js is a peer dependency. var videojsQualitySelector = require("@silvermine/videojs-quality-selector")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@silvermine/videojs-quality-selector v1.2.4

video.js plugin for selecting a video quality or resolution

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.


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:
<link href="" rel="stylesheet">
<script src="./path/to/video.min.js"></script>
<script src=""></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`

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="" type="video/mp4" label="720P">
   <source src="" type="video/mp4" label="480P" selected="true">
   <source src="" type="video/mp4" label="360P">

Using player.src()

      src: '',
      type: 'video/mp4',
      label: '720P',
      src: '',
      type: 'video/mp4',
      label: '480P',
      selected: true,
      src: '',
      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:


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

var options, player;

options = {
   controlBar: {
      children: [

player = videojs('video_1', options);

How do I contribute?

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


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

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free