MCPcopy Index your code
hub / github.com/AwesomeWebProjects/react-player

github.com/AwesomeWebProjects/react-player @v2.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.1 ↗ · + Follow
82 symbols 151 edges 30 files 0 documented · 0% updated 23d agov2.1.1 · 2026-06-08★ 106
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

@awesome-web-projects/react-player

A React audio player component with circular frequency visualization powered by the Web Audio API and Canvas.

Listed on Awesome Audio Visualization. Layout inspired by Alex Permyakov's CodePen.

Features

  • Circular audio frequency visualizer rendered on Canvas
  • Streaming audio loading via Web Workers for smooth playback
  • Partial loading — starts playing in seconds, preloads the full song in the background
  • Keyboard shortcuts (Space, N, B)
  • Configurable colors, volume, and visualization
  • Zero runtime dependencies (besides React and Lucide icons)
  • Full TypeScript support with exported types
  • CSS Modules for style isolation

Installation

npm install @awesome-web-projects/react-player

Usage

import { AudioPlayer } from '@awesome-web-projects/react-player';
import '@awesome-web-projects/react-player/styles.css';

function App() {
  return (
    <AudioPlayer
      tracks={[
        { name: 'My Song', artist: 'Artist', url: '/song.mp3' },
        { name: 'Another', artist: 'Band', url: '/another.mp3' },
      ]}
      initialVolume={0.5}
      enableKeyboard
      enableVisualization
      visualizerColor="rgba(97, 218, 251, 0.8)"
      onTrackChange={(track, index) => console.log('Now playing:', track.name)}
    />
  );
}

Props

Prop Type Default Description
tracks Track[] required Array of tracks to play
thread 'main' \| 'worker' 'worker' Audio fetching strategy
initialVolume number 0.5 Initial volume (0-1)
enableKeyboard boolean true Enable keyboard shortcuts
enableVisualization boolean true Enable canvas visualizer
visualizerColor string 'rgba(97, 218, 251, 0.8)' Primary color for the visualizer
className string Additional CSS class
onTrackChange (track, index) => void Called when track changes
onPlayStateChange (playing) => void Called on play/pause
onTimeUpdate (time, duration) => void Called as playback progresses

Track

interface Track {
  name: string;
  artist: string;
  url: string;
}

Keyboard Shortcuts

Key Action
Space Play / Pause
N Next track
B Previous track

Development

# Install dependencies
npm install

# Start demo dev server
npm run dev

# Build library
npm run build

# Type check
npm run typecheck

License

MIT

Extension points exported contracts — how you extend this code

AudioPlayerProps (Interface)
(no doc)
src/types.ts
WaveformOptions (Interface)
(no doc)
src/views/waveform/use-waveform-visualizer.ts
KeyboardHandlers (Interface)
(no doc)
src/hooks/use-keyboard.ts
GlassVisualizerOptions (Interface)
(no doc)
src/views/glass/use-glass-visualizer.ts
PlaybackTimeState (Interface)
(no doc)
src/hooks/use-playback-time.ts
VisualizerOptions (Interface)
(no doc)
src/views/circular/use-visualizer.ts
PlayerControllerState (Interface)
(no doc)
src/hooks/use-player-controller.ts
TickCoord (Interface)
(no doc)
src/views/circular/use-visualizer.ts

Core symbols most depended-on inside this repo

colorWithAlpha
called by 6
src/views/waveform/use-waveform-visualizer.ts
colorWithAlpha
called by 5
src/views/circular/use-visualizer.ts
usePlayerController
called by 5
src/hooks/use-player-controller.ts
colorWithAlpha
called by 4
src/views/glass/use-glass-visualizer.ts
useAnimatedProgressBar
called by 3
src/views/shared/use-animated-progress.ts
readAudioStream
called by 2
src/worker/audio-worker.ts
configureSize
called by 2
src/views/waveform/use-waveform-visualizer.ts
seekFromEvent
called by 2
src/views/waveform/use-waveform-visualizer.ts

Shape

Function 69
Interface 13

Languages

TypeScript100%

Modules by API surface

src/views/circular/use-visualizer.ts18 symbols
src/views/waveform/use-waveform-visualizer.ts10 symbols
src/views/minimal/MinimalPlayer.tsx6 symbols
src/views/glass/use-glass-visualizer.ts6 symbols
src/views/circular/VolumeControl.tsx6 symbols
src/worker/audio-worker.ts5 symbols
src/views/waveform/WaveformPlayer.tsx5 symbols
src/views/vinyl/VinylPlayer.tsx4 symbols
src/views/glass/GlassPlayer.tsx4 symbols
src/hooks/use-player-controller.ts3 symbols
src/hooks/use-keyboard.ts3 symbols
src/views/shared/use-animated-progress.ts2 symbols

For agents

$ claude mcp add react-player \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact