Socket
Book a DemoInstallSign in
Socket

videojs-responsive-controls

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videojs-responsive-controls

Adapts controls to different player sizes

1.0.1
latest
npmnpm
Version published
Weekly downloads
14
-68.18%
Maintainers
1
Weekly downloads
 
Created
Source

videojs-responsive-controls

Adapts Video.js controls to different player sizes.

Table of contents

Installation

npm install --save videojs-responsive-controls

Basics

Basic usage:

import 'videojs-responsive-controls';

player.responsiveControls({
    controls: {
      remainingTimeDisplay: { mini: false, small: false },
      'vjs-resolution-button': { mini: false },
      'vjs-language-container': { mini: false }
    }
});

Allows controlling both Video.js native plugins and legacy plugins (via their class names).

Defaults

Default breakpoints are:

  • mini: <450px,
  • small: <600px,
  • default: any higher resolution

Default settings are:

currentTimeDisplay: {
  mini: false,
},
timeDivider: {
  mini: false,
},
durationDisplay: {
  mini: false,
},
remainingTimeDisplay: {
  mini: false,
  small: false,
},
captionsButton: {
  mini: false,
},

Features

Visible by default

If user did not specified visibility for given plugin/breakpoint, and the visibility is also not specified in default settings - the plugin will be visible.

Specifying own breakpoints

You can specify own breakpoints like this:

player.responsiveControls({
    sizes: {
        custom: 1024,
    },
    controls: {
        remainingTimeDisplay: { custom: false }
    }
});

Default breakpoints will be overwritten by this setting, therefore if you wish to use defaults too you'll have to specify default breakpoints along with your custom ones like so:

player.responsiveControls({
    sizes: {
        mini: 450,
        small: 600,
        custom: 1024,
    },
    controls: {
        remainingTimeDisplay: { custom: false }
    }
});

Breakpoints are mobile-up so specified value is a maximum size video player can have to be affected by this breakpoint.

To hide element by default use default breakpoint:

player.responsiveControls({
    controls: {
        remainingTimeDisplay: { default: false, mini: true }
    }
});

Using with legacy plugins

Legacy plugins does not register in videojs.controlBar space but you can still manage them throught this script passing class name in options, like this:

player.responsiveControls({
    controls: {
        'vjs-language-container': { mini: false }
    }
});

Bundling with legacy systems

To include videojs-responsive-controls on your website or web application, use any of the following legacy 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-responsive-controls.min.js"></script>
<script>
  var player = videojs('my-video');

  player.responsiveControls();
</script>

Browserify/CommonJS

When using with Browserify, install videojs-responsive-controls 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-responsive-controls');

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

player.responsiveControls();

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-responsive-controls'], function(videojs) {
  var player = videojs('my-video');

  player.responsiveControls();
});

License

MIT. Copyright (c) Tomasz Janiczek <tjaniczek@twig-world.com>

Keywords

videojs

FAQs

Package last updated on 22 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.