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 🙏

© 2026 – Pkg Stats / Ryan Hefner

universal-video-player

v1.0.1

Published

Lightweight universal video player for web and smart TVs. Supports MP4, HLS (.m3u8), and DASH (.mpd) with a simple JavaScript API.

Downloads

30

Readme

🎬 universal-video-player

🔥 Lightweight HLS + DASH + MP4 Video Player for Web & Smart TVs

A lightweight, universal video player for the web.

Play MP4, HLS (.m3u8), and DASH (.mpd) videos seamlessly across:

  • 💻 Desktop
  • 📱 Mobile
  • 📺 Smart TVs (browser-based)

npm downloads license


✨ Why universal-video-player?

Building a video player is harder than it should be.

Different formats require different solutions:

  • MP4 → native HTML5
  • HLS → special handling
  • DASH → another library

👉 universal-video-player solves this with a single simple API.


🚀 Features

  • 🎥 Multi-format support (MP4, HLS, DASH)
  • 🔥 NEW: Subtitles support (WebVTT)
  • 📺 NEW: Fullscreen mode
  • 🎮 NEW: Custom controls with modern UX
  • 💥 NEW: Quality selector for HLS streams
  • 🎪 NEW: Event system (onPlay, onPause, onTimeUpdate, etc.)
  • ⚡ Simple and clean API
  • 📺 Compatible with Smart TVs (browser-based)
  • 🧠 TypeScript support
  • 📦 Lightweight and fast
  • 🔌 Extensible architecture

📦 Installation

npm install universal-video-player

⚡ Quick Start

import { VideoPlayer } from "universal-video-player"

const player = new VideoPlayer({
  src: "https://www.w3schools.com/html/mov_bbb.mp4",
  autoplay: true
})

player.mount("#app")

🎬 HTML Setup

<div id="app"></div>

🔌 Supported Formats

| Format | Example | Support | | ------ | ------- | ----------- | | MP4 | .mp4 | Native | | HLS | .m3u8 | via hls.js | | DASH | .mpd | via dash.js |


⚡ HLS Example

const player = new VideoPlayer({
  src: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
  autoplay: true
})

player.mount("#app")

⚡ DASH Example

const player = new VideoPlayer({
  src: "https://dash.akamaized.net/envivio/EnvivioDash3/manifest.mpd"
})

player.mount("#app")

🔥 Advanced Features

🎬 Subtitles (WebVTT)

const player = new VideoPlayer({
  src: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
  subtitles: [
    {
      src: "./subtitles-fr.vtt",
      label: "Français",
      language: "fr",
      default: true
    },
    {
      src: "./subtitles-en.vtt",
      label: "English",
      language: "en"
    }
  ]
})

player.mount("#app")

📺 Fullscreen Mode

const player = new VideoPlayer({
  src: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
  enableFullscreen: true
})

player.mount("#app")

🎮 Custom Controls

const player = new VideoPlayer({
  src: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
  customControls: true, // Replaces native controls with custom UI
  controls: false       // Disable native controls
})

player.mount("#app")

💥 Quality Selector (HLS)

const player = new VideoPlayer({
  src: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
  customControls: true // Quality selector appears in custom controls
})

player.mount("#app")

🎪 Event System

const player = new VideoPlayer({
  src: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
  onPlay: () => console.log("Video started playing"),
  onPause: () => console.log("Video paused"),
  onTimeUpdate: (currentTime) => console.log(`Current time: ${currentTime}s`),
  onLoadedData: () => console.log("Video loaded successfully"),
  onError: (error) => console.error("Video error:", error)
})

player.mount("#app")

⚙️ Options

const player = new VideoPlayer({
  src: "video.mp4",           // Video source URL
  autoplay: true,             // Auto-play on load
  controls: true,             // Show native controls
  customControls: false,      // Use custom controls UI
  enableFullscreen: false,    // Enable fullscreen button
  subtitles: [...],           // Array of subtitle tracks
  onPlay: () => {},           // Play event callback
  onPause: () => {},          // Pause event callback
  onTimeUpdate: (time) => {}, // Time update callback
  onLoadedData: () => {},     // Loaded data callback
  onError: (error) => {}      // Error callback
})

🎮 API

mount(selector: string)

Attach the player to a DOM element.

play()

Start playback.

pause()

Pause playback.

setVolume(volume: number)

Set audio volume (0.0 to 1.0).

getCurrentTime(): number

Get current playback time in seconds.

setCurrentTime(time: number)

Seek to specific time in seconds.

getDuration(): number

Get video duration in seconds.

destroy()

Remove the player and clean up resources.


🏗 Architecture

VideoPlayer
 ├── Native (MP4)
 ├── HLS (hls.js)
 └── DASH (dash.js)

📺 Smart TV Compatibility

Works on:

  • Samsung Tizen (browser)
  • LG WebOS (browser)
  • Android TV (WebView)

👉 As long as a browser is available.


🔮 Roadmap

  • Subtitles (VTT)
  • Fullscreen API
  • Custom UI (controls)
  • Events (onPlay, onPause)
  • Chromecast / AirPlay support
  • Quality selector

🛠 Development

npm install
npm run build

📄 License

MIT © Guillaume SERE


⭐ Support

If you find this project useful, consider giving it a star on GitHub.