Exposes a list of quality levels available for the source.
npm install --save videojs-contrib-quality-levels
The npm installation is preferred, but Bower works, too.
bower install --save videojs-contrib-quality-levels
The list of
QualiyLevels can be accessed using
qualityLevels() on the Player object.
With this list, you can:
let player = ;let qualityLevels = player;// Loop through the list of quality levels and disable all qualities with more than// 720 horizontal lines of resolution.for let i = 0; i < qualityLevelslength; i++let qualityLevel = qualityLevelsi;if qualityLevelheight > 720qualityLevelenabled = false;elsequalityLevelenabled = true;let currentSelectedQualityLevelIndex = qualityLevelsselectedIndex;
Initially the list of quality levels will be empty. You can add quality levels to the list by using
QualityLevelList.addQualityLevel for each quality level specific to your source.
QualityLevelList.addQualityLevel takes in a
Representation object (or generic object with the required properties). All properties are required except
Representationid: stringwidth: numberheight: numberbitrate: number
enabled function should take an optional boolean to enable or disable the representation and return whether it is currently enabled.
Quality levels for an HLS source will be automatically populated when using videojs-contrib-hls version 4.1 or greater.
To include videojs-contrib-quality-levels on your website or web application, use any of the following methods.
This is the simplest case. Get the script in whatever way you prefer and include the plugin after you include video.js, so that the
videojs global is available.
When using with Browserify, install videojs-contrib-quality-levels via npm and
require the plugin as you would any other module.
var videojs = ;// 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.;var player = ;player;
When using with RequireJS (or another AMD library), get the script in whatever way you prefer and
require the plugin as you normally would:
Apache-2.0. Copyright (c) Brightcove, Inc.