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

@peaseernest/videoplayer

v1.0.0

Published

A unified video player library with HLS streaming support, built on video.js and hls.js

Readme

@peaseernest/videoplayer

A unified, easy-to-use video player library with HLS streaming support. Built on top of video.js and hls.js, this library abstracts away all complexity and provides a simple configuration API.

Features

Simple Configuration - One config object controls everything
🎬 HLS Streaming - Adaptive bitrate streaming with hls.js
🎨 Video.js UI - Professional, customizable player controls
📱 Picture-in-Picture - Built-in PIP support
📝 Captions - WebVTT subtitle support
Buffer Control - Configurable buffering settings
🔊 Volume Controls - Volume slider with keyboard shortcuts
☀️ Brightness Control - Adjust video brightness
🎭 Theater Mode - Widescreen viewing mode
⌨️ Keyboard Shortcuts - Full keyboard navigation
🖱️ Context Menu - Right-click menu with advanced options
🔁 Loop Control - Loop video playback
⚙️ Quality Selector - Manual quality selection for HLS
Playback Speed - 0.5x to 2x speed control
📊 Stats Display - Technical video information

Installation

npm install @peaseernest/videoplayer

Or with yarn:

yarn add @peaseernest/videoplayer

Usage

1. HTML Setup

Add a container div with the data-videoplayer attribute:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="node_modules/@peaseernest/videoplayer/dist/videoplayer.css">
</head>
<body>
  <div data-videoplayer="main-video"></div>
  
  <script src="node_modules/@peaseernest/videoplayer/dist/videoplayer.min.js"></script>
  <script src="app.js"></script>
</body>
</html>

2. JavaScript Configuration

// Import the library
import videoplayer from '@peaseernest/videoplayer';

// Configure your player
const config = {
  sourceUrl: 'https://example.com/video/stream.m3u8',
  stream: true,              // Enable HLS streaming
  volume: true,              // Show volume controls
  pip: true,                 // Enable Picture-in-Picture
  buffering: 60,             // Buffer size in MB
  captions: true,            // Enable captions
  captionLink: 'https://example.com/captions/english.vtt'
};

// Initialize the player
videoplayer.init(config);

ES6 Module

import videoplayer from '@peaseernest/videoplayer';
import '@peaseernest/videoplayer/dist/videoplayer.css';

videoplayer.init({
  sourceUrl: 'https://example.com/video.m3u8',
  stream: true,
  volume: true,
  pip: true,
  buffering: 100,
  captions: true,
  captionLink: 'https://example.com/subtitles.vtt'
});

CommonJS

const videoplayer = require('@peaseernest/videoplayer');

videoplayer.init({ /* config */ });

CDN Usage

<link rel="stylesheet" href="https://unpkg.com/@peaseernest/videoplayer/dist/videoplayer.css">
<script src="https://unpkg.com/@peaseernest/videoplayer/dist/videoplayer.min.js"></script>

<div data-videoplayer="my-video"></div>

<script>
  PeaseErnestPlayer.init({
    sourceUrl: 'https://example.com/video.m3u8',
    stream: true
  });
</script>

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | sourceUrl | string | required | URL to your video file (MP4 or M3U8) | | stream | boolean | false | Enable HLS streaming for M3U8 files | | volume | boolean | true | Show volume controls | | pip | boolean | true | Enable Picture-in-Picture button | | buffering | number | 60 | Buffer size in megabytes | | captions | boolean | false | Enable subtitle support | | captionLink | string | null | URL to WebVTT caption file | | autoplay | boolean | false | Auto-play video on load | | shortcuts | object | see below | Keyboard shortcut configuration |

Keyboard Shortcuts Configuration

shortcuts: {
  playPause: ' ',           // Space bar - Play/Pause
  seekForward: 'ArrowRight', // Seek forward
  seekBackward: 'ArrowLeft', // Seek backward
  volumeUp: 'ArrowUp',      // Increase volume
  volumeDown: 'ArrowDown',   // Decrease volume
  mute: 'm',                // Mute/Unmute
  fullscreen: 'f',          // Toggle fullscreen
  theater: 't',             // Toggle theater mode
  seekForwardAmount: 10,    // Seconds to seek forward
  seekBackwardAmount: 10    // Seconds to seek backward
}

Default Keyboard Shortcuts

| Key | Action | |-----|--------| | Space / K | Play/Pause | | / L | Skip forward 10 seconds | | / J | Skip backward 10 seconds | | | Volume up | | | Volume down | | M | Mute/Unmute | | F | Fullscreen | | T | Theater mode | | 0-9 | Jump to 0%-90% of video |

Multiple Players

You can have multiple players on the same page:

<div data-videoplayer="video1"></div>
<div data-videoplayer="video2"></div>
// All containers with data-videoplayer will use the same config
videoplayer.init({
  sourceUrl: 'https://example.com/video.m3u8',
  stream: true
});

API Methods

init(config)

Initialize all video players on the page.

videoplayer.init({
  sourceUrl: 'https://example.com/video.m3u8',
  stream: true
});

getPlayer(playerId)

Get a specific player instance by ID.

const player = videoplayer.getPlayer('peaseernest-main-video-1234567890');
player.play();
player.pause();
player.currentTime(30); // Seek to 30 seconds
player.volume(0.5); // Set volume to 50%

destroy()

Destroy all players and clean up resources.

videoplayer.destroy();

Custom Controls

Built-in UI Controls

  • Play/Pause - Click or use spacebar
  • Volume Slider - Drag or use arrow keys
  • Progress Bar - Click to seek, drag for scrubbing
  • Brightness - Click sun icon to adjust (0-200%)
  • Theater Mode - Click film icon or press 'T'
  • Loop - Click loop icon to enable/disable
  • Playback Speed - Select from 0.5x to 2x
  • Quality - Auto-select or manual for HLS streams
  • Fullscreen - Click or press 'F'
  • Picture-in-Picture - Click PIP icon

Right-Click Context Menu

Right-click on the video to access:

  • Loop - Enable/disable video loop
  • Speed - Change playback speed
  • Copy Video URL - Copy source URL to clipboard
  • Copy Current Time - Copy current timestamp
  • Stats for Nerds - View technical details
  • About - Library version info

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 11+
  • Edge 79+
  • iOS Safari 11+
  • Android Chrome 60+

HLS Streaming

The library automatically detects HLS support:

  • Uses native HLS in Safari
  • Uses hls.js for other browsers
  • Falls back gracefully if streaming is not supported

Development

# Install dependencies
npm install

# Build the library
npm run build

# Watch mode for development
npm run dev

Project Structure

@peaseernest/videoplayer/
├── src/
│   └── index.js          # Main library code
├── dist/                 # Built files (generated)
│   ├── videoplayer.js    # UMD bundle
│   ├── videoplayer.min.js
│   ├── videoplayer.esm.js
│   ├── videoplayer.cjs.js
│   └── videoplayer.css
├── package.json
├── rollup.config.js
└── README.md

License

MIT © Pease Ernest

Credits

Built with: