Code Monkey home page Code Monkey logo

slatt's Introduction

videojs-http-source-selector

VideoJS plugin that leverages videojs-contrib-quality-levels plugin to offer manual user-selectable level selection options for adaptive http streams.

Alt text

Test it with your stream

Fork this project, download it and then open Index.html in your browser Compatible with vjs 7 and up.

Labels:

Level labels are generated from the height and bitrate metadata parsed from the stream QualityLevels sources. If height isn't available in the stream metadata, the labels will default to bitrate.

Default settings:

You can configure a bias to lock playback to the highest or lowest resolution by default by passing one of the below plugin options into your videojs initializer.

Low:

httpSourceSelector:
{
  default: 'low'
}

High:

httpSourceSelector:
{
  default: 'high'
}

Auto:

httpSourceSelector:
{
  default: 'auto'
}

Installation

npm install --save videojs-contrib-quality-levels
npm install --save videojs-http-source-selector

Dependencies

Requires videojs-contrib-quality-levels

Usage

To include videojs-http-source-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. You can configure the plugin with the options described above.

<script src="//path/to/video.min.js"></script>
<script src="//path/to/videojs-http-source-selector.min.js"></script>
<script src="//path/to/videojs-contrib-quality-levels.min.js"></script>
<script>
  var options = 
  {
    plugins: {
      httpSourceSelector:
      {
        default: 'auto'
      }
    }
  };
  var player = videojs('my-video', options);
  player.httpSourceSelector();
</script>

Browserify/CommonJS

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

var videojs = require('video.js');
require('videojs-contrib-quality-levels');

// 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-http-source-selector');

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

player.httpSourceSelector();

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-contrib-quality-levels', 'videojs-http-source-selector'], function(videojs) {
  var player = videojs('my-video');

  player.httpSourceSelector();
});

License

MIT. Copyright (c) Justin Fujita;

slatt's People

Contributors

dependabot[bot] avatar jfujita1 avatar chunkyprogrammer avatar jfujita avatar bikegriffith avatar zarqman avatar pikachuexe avatar greenkeeper[bot] avatar leonklingele avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.