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 videojs-mobile-ui with all npm packages installed. Try it out:

var videojsMobileUi = require("videojs-mobile-ui")

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

videojs-mobile-ui v0.4.1

Tap controls for Video.js

videojs-mobile-ui

Mobile UI for Video.js.

Touch controls:

  • Double-tap the left side of the player to rewind ten seconds
  • Double-tap the right side of the player to fast-forward ten seconds
  • Single-tap the screen to show a play/pause toggle

Fullscreen control:

  • Rotate to landscape to enter Fullscreen
  • Lock to fullscreen on rotate

Table of Contents

## Installation ## Installation
npm install --save videojs-mobile-ui

Plugin Options

Default options

{
  fullscreen: {
    enterOnRotate: true,
    lockOnRotate: true
  },
  touchControls: {
    seekSeconds: 10,
    tapTimeout: 300,
    disableOnEnd: false
  }
};

Options

  • fullscreen.enterOnRotate boolean Whether to go fullscreen when rotating to landscape
  • fullscreen.lockOnRotate boolean Whether to lock to fullscreen when rotating to landscape
  • fullscreen.iOS boolean Whether to use fake fullscreen on iOS (needed for controls to work)
  • touchControls.seekSeconds int Seconds to seek when double-tapping
  • touchControls.tapTimeout int Milliseconds to consider a double-tap
  • touchControls.disableOnEnd boolean Whether to disable touch controls when the video has ended, e.g. if an endscreen is used. Automatically disables if the endscreen plugin is present when this plugin initialises

Usage

To include videojs-mobile-ui 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-mobile-ui.min.js"></script>
<script>
  var player = videojs('my-video');

  player.mobileUi();
</script>

Browserify/CommonJS

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

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

player.mobileUi();

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

  player.mobileUi();
});

License

MIT. Copyright (c) mister-ben <git@misterben.me>

Metadata

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