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

@peakchao/react-media

v0.0.1

Published

A beautiful React media player component library with video and audio players

Readme

React Media 🎬

npm version license

A beautiful, feature-rich media player component library for React. Includes customizable Video and Audio players with modern UI, dark mode support, and full TypeScript integration.

✨ Features

  • 🎥 Video Player - Full-featured video player with progress bar, volume control, playback speed, and fullscreen
  • 🎵 Audio Player - Elegant audio player with cover art, waveform progress, and track info display
  • 🌙 Dark Mode - Built-in dark mode support
  • 🎨 Customizable - Easily customize primary color and themes
  • 📱 Responsive - Works great on all screen sizes
  • Accessible - Full keyboard and screen reader support
  • 🔧 TypeScript - Complete type definitions included
  • Lightweight - No external dependencies

📦 Installation

# npm
npm install @peakchao/react-media

# yarn
yarn add @peakchao/react-media

# pnpm
pnpm add @peakchao/react-media

🚀 Quick Start

Import Styles

// main.tsx or App.tsx
import '@peakchao/react-media/style'

// Or use the full path
// import '@peakchao/react-media/dist/react-media.css'

Use Components

import { VideoPlayer, AudioPlayer } from '@peakchao/react-media'

function App() {
  return (
    <>
      {/* Video Player */}
      <VideoPlayer
        src="https://example.com/video.mp4"
        poster="https://example.com/poster.jpg"
      />

      {/* Audio Player */}
      <AudioPlayer
        src="https://example.com/audio.mp3"
        title="Song Title"
        artist="Artist Name"
        cover="https://example.com/cover.jpg"
      />
    </>
  )
}

📹 VideoPlayer

A modern video player with all the controls you need.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | src | string | required | Video source URL | | poster | string | - | Poster image URL | | autoplay | boolean | false | Auto-play video on load | | loop | boolean | false | Loop video playback | | muted | boolean | false | Mute video by default | | controls | boolean | true | Show player controls | | width | string \| number | '100%' | Player width | | height | string \| number | 'auto' | Player height | | primaryColor | string | '#6366f1' | Theme primary color | | darkMode | boolean | false | Enable dark mode | | playbackRates | number[] | [0.5, 0.75, 1, 1.25, 1.5, 2] | Available playback speeds | | preload | 'auto' \| 'metadata' \| 'none' | 'metadata' | Preload behavior | | keyboardShortcuts | boolean | true | Enable keyboard shortcuts | | globalKeyboardShortcuts | boolean | false | Enable global keyboard shortcuts | | showPiP | boolean | true | Show Picture-in-Picture button | | showSpeed | boolean | true | Show playback speed button | | showFullscreen | boolean | true | Show fullscreen button | | showThumbnailPreview | boolean | true | Show thumbnail on progress bar hover | | touchGestures | boolean | true | Enable touch gestures | | miniPlayer | boolean | false | Enable mini player when scrolled out of view | | miniPlayerPosition | string | 'bottom-right' | Mini player position | | backgroundColor | string | 'transparent' | Player background color |

Keyboard Shortcuts

| Key | Action | |-----|--------| | Space | Play/Pause | | / | Seek ±5 seconds | | / | Volume ±10% | | M | Mute/Unmute | | F | Toggle Fullscreen | | Escape | Exit Fullscreen/PiP |

Event Callbacks

| Prop | Payload | Description | |------|---------|-------------| | onPlay | - | Fired when playback starts | | onPause | - | Fired when playback pauses | | onEnded | - | Fired when playback ends | | onTimeUpdate | { currentTime, duration, percentage } | Fired during playback | | onVolumeChange | { volume, muted } | Fired when volume changes | | onLoadedMetadata | { duration } | Fired when metadata loads | | onError | { code, message } | Fired on playback error |

Ref Methods

import { useRef } from 'react'
import { VideoPlayer, VideoPlayerRef } from '@peakchao/react-media'

function App() {
  const playerRef = useRef<VideoPlayerRef>(null)

  const handleControls = () => {
    playerRef.current?.play()
    playerRef.current?.pause()
    playerRef.current?.seek(30) // Seek to 30 seconds
    playerRef.current?.setVolume(0.5) // Set volume to 50%
    playerRef.current?.setPlaybackRate(1.5) // Set speed to 1.5x
    playerRef.current?.toggleFullscreen()
    playerRef.current?.togglePiP()
    const state = playerRef.current?.getState()
  }

  return <VideoPlayer ref={playerRef} src="video.mp4" />
}

🎵 AudioPlayer

An elegant audio player with cover art and track info display.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | src | string | required | Audio source URL | | title | string | - | Track title | | artist | string | - | Artist name | | cover | string | - | Cover image URL | | autoplay | boolean | false | Auto-play audio on load | | loop | boolean | false | Loop audio playback | | primaryColor | string | '#6366f1' | Theme primary color | | darkMode | boolean | false | Enable dark mode | | preload | 'auto' \| 'metadata' \| 'none' | 'metadata' | Preload behavior |

Ref Methods

import { useRef } from 'react'
import { AudioPlayer, AudioPlayerRef } from '@peakchao/react-media'

function App() {
  const playerRef = useRef<AudioPlayerRef>(null)

  return (
    <AudioPlayer
      ref={playerRef}
      src="audio.mp3"
      title="Amazing Song"
      artist="Great Artist"
    />
  )
}

🎨 Theming

Both players support custom theming through the primaryColor and darkMode props.

{/* Custom purple theme with dark mode */}
<VideoPlayer
  src="video.mp4"
  primaryColor="#8b5cf6"
  darkMode={true}
/>

{/* Custom blue theme */}
<AudioPlayer
  src="audio.mp3"
  primaryColor="#3b82f6"
/>

📝 TypeScript Support

Full TypeScript definitions are included. Import types as needed:

import type {
  VideoPlayerProps,
  AudioPlayerProps,
  VideoPlayerRef,
  AudioPlayerRef,
  TimeUpdatePayload,
  VolumeChangePayload,
  MediaError,
  MediaState
} from '@peakchao/react-media'

📄 License

MIT © peakchao