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

strataplayer

v1.2.23

Published

A modern, framework-agnostic media engine for the web. Supports HLS, DASH, MPEG-TS, and WebTorrent with a plugin-based architecture and React integration.

Readme

StrataPlayer

Introduction

StrataPlayer is a framework-agnostic media engine designed for web applications. It decouples playback logic from the UI, ensuring consistent performance during state updates.

Built on React 19 and TypeScript, it features a modular plugin architecture to support various streaming formats while keeping the core bundle size minimal.

Key Features

  • Universal Playback: Support for HLS, DASH, MPEG-TS/FLV, and WebTorrent (P2P).
  • Framework Agnostic: First-class React support with mounting helpers for Vue, Svelte, Angular, and Vanilla JS.
  • Network Handling: Automatic exponential backoff and retry logic.
  • Audio Engine: Integrated Web Audio API nodes for gain control and volume boosting.
  • UI System:
    • 4 built-in themes (Default, Pixel, Game, Hacker).
    • VTT/SRT subtitle support with user customization.
    • Picture-in-Picture & Google Cast integration.
  • State Management: Powered by NanoStore for isolated state updates.

Installation

Install the core player:

npm install strataplayer

Install the specific engines you need as peer dependencies:

# For HLS (.m3u8)
npm install hls.js

# For DASH (.mpd)
npm install dashjs

# For MPEG-TS / FLV
npm install mpegts.js

# For WebTorrent (Magnet links)
npm install webtorrent

Usage

1. Basic Usage (React)

For standard MP4/WebM files, no plugins are required.

import { StrataPlayer } from "strataplayer";
import "strataplayer/style.css";

const App = () => {
  return (
    <StrataPlayer
      src="https://example.com/video.mp4"
      theme="default"
      themeColor="#6366f1"
    />
  );
};

2. Universal Player (All Formats)

To support all formats, import the plugins and pass them to the player.

import { StrataPlayer } from "strataplayer";
import { HlsPlugin } from "strataplayer/hls";
import { DashPlugin } from "strataplayer/dash";
import { MpegtsPlugin } from "strataplayer/mpegts";
import { WebTorrentPlugin } from "strataplayer/webtorrent";
import "strataplayer/style.css";

// Initialize plugins once
const plugins = [
  new HlsPlugin(),
  new DashPlugin(),
  new MpegtsPlugin(),
  new WebTorrentPlugin(),
];

const App = () => {
  return (
    <StrataPlayer
      // Can be a magnet link, m3u8, mpd, or mp4
      src="magnet:?xt=urn:btih:..."
      plugins={plugins}
      theme="hacker"
      autoPlay={false}
    />
  );
};

3. Vanilla JS / Vue / Svelte

Use the mountStrataPlayer helper to render the player into any DOM node.

import { mountStrataPlayer } from "strataplayer";
import { HlsPlugin } from "strataplayer/hls";
import "strataplayer/style.css";

const container = document.getElementById("player-root");

const player = mountStrataPlayer(container, {
  src: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
  plugins: [new HlsPlugin()],
  theme: "game",
  themeColor: "#eab308",
});

// Update props later
// player.update({ theme: 'pixel' });

// Cleanup
// player.unmount();

Component Props & Options

The <StrataPlayer /> component accepts the following configuration options.

Source & Playback

| Prop | Type | Default | Description | | :--------------- | :------------------ | :------ | :------------------------------------------------------------ | | src | string | - | The primary media URL. | | sources | PlayerSource[] | [] | Array of sources for quality fallback or alternative formats. | | poster | string | - | URL for the poster image. | | thumbnails | string | - | URL to a VTT file for hover previews. | | textTracks | TextTrackConfig[] | [] | Array of subtitle/caption tracks. | | plugins | IPlugin[] | [] | Array of initialized plugin instances. | | autoPlay | boolean | false | Start playback automatically. | | loop | boolean | false | Loop playback. | | volume | number | 1 | Initial volume (0.0 to 1.0). | | muted | boolean | false | Initial mute state. | | audioGain | number | 1 | Audio boost level (e.g., 1.5 for 150%). | | playbackRate | number | 1 | Initial playback speed. | | isLive | boolean | false | Enable live stream UI mode. | | fetchTimeout | number | 30000 | Timeout (ms) for network requests (HLS segments, VTT, etc). |

UI & Appearance

| Prop | Type | Default | Description | | :------------- | :------------ | :---------- | :----------------------------------------------- | | theme | string | 'default' | 'default', 'pixel', 'game', or 'hacker'. | | themeColor | string | '#6366f1' | Primary accent color (Hex, RGB). | | iconSize | string | 'medium' | 'small', 'medium', or 'large'. | | backdrop | boolean | true | Enable background blur effects in menus. | | autoSize | boolean | false | Toggles object-fit: cover. (Legacy: use videoFit) | | videoFit | string | 'contain' | Sets initial video scaling (contain, cover, fill, none). | | brightness | number | 1 | Initial video brightness filter (0.0 to 2.0). | | highlight | Highlight[] | [] | Markers to display on the timeline. |

Functionality & Controls

| Prop | Type | Default | Description | | :--------------------- | :-------- | :------ | :---------------------------------------- | | hotKey | boolean | true | Enable keyboard shortcuts. | | screenshot | boolean | false | Show screenshot button. | | pip | boolean | true | Show Picture-in-Picture button. | | setting | boolean | true | Show Settings menu. | | fullscreen | boolean | true | Show Fullscreen button. | | fullscreenWeb | boolean | false | Show Web Fullscreen button. | | flip | boolean | true | Enable image flip controls in settings. | | aspectRatio | boolean | true | Enable aspect ratio controls in settings. | | lock | boolean | false | Show mobile lock button. | | fastForward | boolean | true | Enable long-press to 2x speed. | | autoOrientation | boolean | true | Lock landscape on mobile fullscreen. | | disablePersistence | boolean | false | Prevent saving settings to LocalStorage. | | centerControls | boolean | true | Show large center play/pause buttons. | | gestureSeek | boolean | false | Enable drag-to-seek on touch devices. |

Advanced Customization

Detailed documentation for configuring layers, controls, context menus, and custom settings is available in the full documentation.

| Prop | Type | Description | | :-------------- | :------------------ | :------------------------------------- | | controls | ControlItem[] | Custom control bar items. | | layers | LayerConfig[] | Custom UI layers overlaying the video. | | contextmenu | ContextMenuItem[] | Custom right-click menu items. | | settings | SettingItem[] | Custom menu entries. |

Plugin System

StrataPlayer uses a modular system. You only pay the bundle size cost for the formats you use.

| Plugin | Import Path | Dependency | Description | | :------------------- | :------------------------ | :----------- | :----------------------------------- | | HlsPlugin | strataplayer/hls | hls.js | Adaptive HTTP Live Streaming (.m3u8) | | DashPlugin | strataplayer/dash | dashjs | MPEG-DASH Streaming (.mpd) | | MpegtsPlugin | strataplayer/mpegts | mpegts.js | MPEG-TS and FLV live streams | | WebTorrentPlugin | strataplayer/webtorrent | webtorrent | P2P streaming via WebRTC |

Keyboard Shortcuts

| Key | Action | | ------------- | ----------------- | | Space / K | Play / Pause | | F | Toggle Fullscreen | | M | Toggle Mute | | Arrow Right | Seek Forward 5s | | Arrow Left | Seek Backward 5s | | Arrow Up | Increase Volume | | Arrow Down | Decrease Volume |

Development

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Start the dev server:
    npm run dev

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes.
  4. Push to the branch.
  5. Open a Pull Request.

License

Distributed under the MIT License. See LICENSE for more information.