npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

vjs-downloader

v1.0.4

Published

A download button plugin for Video.js that adds a download button to the video player's control bar.

Readme

vjs-downloader

A download button plugin for Video.js that adds a download button to the video player's control bar.

Features

  • Adds a download button to Video.js player's control bar
  • Customizable download button position
  • Support for custom download URLs
  • Custom download handler support
  • Responsive design with flexible icon sizing

Installation

npm install vjs-downloader

Usage

Basic Usage

// Import the plugin
import vjsDownloader from 'vjs-downloader';
import 'vjs-downloader/dist/vjs-downloader.min.css';

// Register the plugin
videojs.registerPlugin('vjsDownloader', vjsDownloader);

// Initialize video.js player with the plugin
const player = videojs('my-video', {
  plugins: {
    vjsDownloader: {
      // Optional configuration
      controlText: 'Download Video',
      className: 'vjs-downloader'
    }
  }
});

HTML Example

<!DOCTYPE html>
<html>
<head>
  <link href="https://vjs.zencdn.net/8.10.0/video-js.css" rel="stylesheet" />
  <link href="path/to/vjs-downloader.min.css" rel="stylesheet" />
</head>
<body>
  <video
    id="my-video"
    class="video-js vjs-default-skin"
    controls
    preload="auto"
    width="800"
    height="450"
  >
    <source src="path/to/video.mp4" type="video/mp4" />
  </video>

  <script src="https://vjs.zencdn.net/8.10.0/video.min.js"></script>
  <script src="path/to/vjs-downloader.umd.js"></script>
  <script>
    videojs.registerPlugin("vjsDownloader", vjsDownloader);
    
    var player = videojs('my-video', {
      plugins: {
        vjsDownloader: {
          controlText: 'Download Video',
          className: 'vjs-downloader'
        }
      }
    });
  </script>
</body>
</html>

Vue Example

<template>
  <div class="video-container">
    <video
      ref="videoPlayer"
      class="video-js vjs-default-skin"
      controls
      preload="auto"
      width="800"
      height="450"
    >
      <source :src="videoSrc" type="video/mp4" />
    </video>
  </div>
</template>

<script>
import 'video.js/dist/video-js.css';
import '../dist/vjs-downloader.min.css';
import videojs from 'video.js';

export default {
  name: 'VideoPlayer',
  props: {
    videoSrc: {
      type: String,
      default: 'https://example.com/video.mp4'
    }
  },
  mounted() {
    this.player = videojs(this.$refs.videoPlayer, {
      plugins: {
        download: {
          controlText: 'Download Video',
          className: 'vjs-downloader'
        }
      }
    });
  },
  beforeDestroy() {
    if (this.player) {
      this.player.dispose();
    }
  }
};
</script>

Configuration Options

The plugin accepts the following configuration options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | beforeElement | String | "fullscreenToggle" | The name of the control bar element before which the download button should be inserted | | controlText | String | "Download" | The text to display for the download button | | downloadURL | String | null | Custom URL for downloading. If not provided, uses the current video source URL | | customDownload | Boolean | false | If true, triggers a custom download event instead of opening the URL | | className | String | 'vjs-downloader' | CSS class name for the download button |

Events

The plugin triggers the following events:

  • download: Triggered when the download button is clicked

Browser Support

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE11 (with polyfills)

License

ISC