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

@radio-cloud/audio-player

v1.2.1

Published

Reusable audio player widget with waveform, level meters, and synced lyrics

Downloads

637

Readme

@radio-cloud/audio-player

Reusable audio player widget for React with waveform visualization, real-time level meters, and synced lyrics.

Install

npm install @radio-cloud/audio-player

Peer dependencies (must be installed in your app):

npm install react react-dom @radix-ui/react-dialog

Quick Start

import { useState } from 'react'
import { AudioPlayerDialog } from '@radio-cloud/audio-player'

function App() {
  const [open, setOpen] = useState(false)

  return (
    <>
      <button onClick={() => setOpen(true)}>Play</button>

      <AudioPlayerDialog
        src="https://example.com/track.mp3"
        title="Seventeen"
        artist="Alessia Cara"
        enableTranscript={false}
        open={open}
        onOpenChange={setOpen}
      />
    </>
  )
}

No CSS import needed — styles are embedded in the JavaScript bundle.

Components

AudioPlayerDialog

Full-featured audio player rendered as a popup/overlay dialog.

<AudioPlayerDialog
  src="https://example.com/track.mp3"
  title="Seventeen"
  artist="Alessia Cara"
  enableTranscript={true}
  open={isOpen}
  onOpenChange={setIsOpen}
/>

| Prop | Type | Required | Description | |------|------|----------|-------------| | src | string | ✅ | Audio file URL | | title | string | ✅ | Track title | | artist | string | ✅ | Artist name | | enableTranscript | boolean | ✅ | Enable lyrics/transcription panel | | open | boolean | ✅ | Dialog open state | | onOpenChange | (open: boolean) => void | ✅ | Callback when dialog opens/closes | | album | string | ❌ | Album name (improves lyrics search accuracy) | | transcription | string \| TranscriptionLine[] | ❌ | Manual transcription (overrides auto-fetch) | | onDownload | () => void | ❌ | Custom download handler |

AudioPlayerInline

Same player without the dialog overlay — renders inline in your layout.

import { AudioPlayerInline } from '@radio-cloud/audio-player'

<AudioPlayerInline
  src="https://example.com/track.mp3"
  title="Seventeen"
  artist="Alessia Cara"
  enableTranscript={false}
/>

Same props as AudioPlayerDialog except open and onOpenChange.

Lyrics / Transcription

Auto-fetch from LRCLIB

Set enableTranscript={true} without providing transcription — lyrics are fetched automatically from LRCLIB using the artist + title props.

<AudioPlayerDialog
  src="https://example.com/track.mp3"
  title="Apa Kabar Sayang"
  artist="Armada"
  enableTranscript={true}
  open={isOpen}
  onOpenChange={setIsOpen}
/>

If synced lyrics are available, they display karaoke-style with the active line highlighted and auto-scrolling. If only plain lyrics are found, they display as static text.

Manual transcription (plain text)

<AudioPlayerDialog
  src="https://example.com/news.mp3"
  title="Nachrichten"
  artist="Moderator"
  enableTranscript={true}
  transcription={`Erste Zeile der Transkription.
Zweite Zeile.
Dritte Zeile.`}
  open={isOpen}
  onOpenChange={setIsOpen}
/>

Manual transcription (synced / karaoke)

<AudioPlayerDialog
  src="https://example.com/news.mp3"
  title="Nachrichten"
  artist="Moderator"
  enableTranscript={true}
  transcription={[
    { time: 0, text: 'Erste Zeile beginnt bei Sekunde 0.' },
    { time: 4, text: 'Zweite Zeile beginnt bei Sekunde 4.' },
    { time: 8, text: 'Dritte Zeile beginnt bei Sekunde 8.' },
  ]}
  open={isOpen}
  onOpenChange={setIsOpen}
/>

Each line highlights when currentTime reaches its time value. Click a line to seek to that position.

Hooks

useAudioPlayer(src: string)

Low-level hook for building custom player UIs.

import { useAudioPlayer } from '@radio-cloud/audio-player'

const {
  audioRef,       // Ref for <audio> element
  canvasRef,      // Ref for waveform <canvas>
  analyserLeft,   // Web Audio AnalyserNode (L channel)
  analyserRight,  // Web Audio AnalyserNode (R channel)
  isPlaying,
  duration,
  currentTime,
  volume,
  playbackRate,
  waveformReady,
  togglePlay,
  seek,
  rewind10,
  forward10,
  setVolume,
  cyclePlaybackRate,
  skipForward,
} = useAudioPlayer('https://example.com/track.mp3')

useLyrics(options)

Fetch lyrics from LRCLIB.

import { useLyrics } from '@radio-cloud/audio-player'

const { syncedLines, plainLyrics, loading, error, instrumental } = useLyrics({
  trackName: 'Seventeen',
  artistName: 'Alessia Cara',
  enabled: true,
})

useAudioMetadata(src: string)

Read ID3 metadata (title, artist, album) from an audio file URL.

import { useAudioMetadata } from '@radio-cloud/audio-player'

const { metadata, loading } = useAudioMetadata('https://example.com/track.mp3')
// metadata.title, metadata.artist, metadata.album

Utilities

parseLRC(lrc: string): TranscriptionLine[]

Parse an LRC format string into timed lines.

import { parseLRC } from '@radio-cloud/audio-player'

const lines = parseLRC(`[00:05.00]First line
[00:10.00]Second line`)
// [{ time: 5, text: 'First line' }, { time: 10, text: 'Second line' }]

Features

  • Waveform visualization (decoded from audio via Web Audio API)
  • Real-time L/R level meters with peak hold
  • Transport controls: play/pause, rewind 10s, forward 10s, fast forward, skip, download
  • Volume control with popup slider
  • Playback rate cycling (1x → 1.25x → 1.5x → 2x → 0.5x → 0.75x)
  • Timeline ticks
  • Synced lyrics with auto-scroll and click-to-seek
  • Auto-fetch lyrics from LRCLIB API
  • ID3 metadata reader (title, artist, album from MP3 files)
  • Dark theme with teal/green accent
  • Zero CSS dependencies — all styles inline

Types

import type {
  AudioPlayerDialogProps,
  AudioPlayerProps,
  TranscriptionLine,
  Transcription,
  UseLyricsOptions,
  UseLyricsReturn,
  AudioMetadata,
  UseAudioPlayerReturn,
} from '@radio-cloud/audio-player'

License

MIT