Skip to content

Adds a quality selector menu with customizable label for HLS sources played in videojs. Requires `videojs-contrib-hls` and `videojs-contrib-quality-levels` plugins.

License

Notifications You must be signed in to change notification settings

praem90/videojs-hls-quality-selector

 
 

Repository files navigation

videojs-hls-quality-selector

Adds a quality selector menu for HLS sources played in videojs. Requires videojs-contrib-hls and videojs-contrib-quality-levels plugins.

Table of Contents

Installation

Installation

npm install --save videojs-hls-quality-selector

Usage

To include videojs-hls-quality-selector on your website or web application, use any of the following methods.

<script> Tag

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.

<script src="//path/to/video.min.js"></script>
<script src="//path/to/videojs-hls-quality-selector.min.js"></script>
<script>
  var player = videojs('my-video');

  player.hlsQualitySelector();
</script>

Browserify/CommonJS

When using with Browserify, install videojs-hls-quality-selector via npm and require the plugin as you would any other module.

var videojs = require('video.js');

// 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.
require('videojs-hls-quality-selector');

var player = videojs('my-video');

player.hlsQualitySelector({
    mapLavel: function (level) {
        //@return Representation transformed level 
        return level;
    },
    labelCallback: function (level) {
        // return string label 
        return 'custom label';
    }
});

RequireJS/AMD

When using with RequireJS (or another AMD library), get the script in whatever way you prefer and require the plugin as you normally would:

require(['video.js', 'videojs-hls-quality-selector'], function(videojs) {
  var player = videojs('my-video');

  player.hlsQualitySelector();
});

License

MIT. Copyright (c) Chris Boustead (chris@forgemotion.com)

About

Adds a quality selector menu with customizable label for HLS sources played in videojs. Requires `videojs-contrib-hls` and `videojs-contrib-quality-levels` plugins.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 86.5%
  • HTML 12.4%
  • CSS 1.1%