JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31
  • Score
    100M100P100Q53932F
  • License MIT

A simple audio player for React

Package Exports

  • @clxrity/react-audio
  • @clxrity/react-audio/index.css

Readme

@clxrity/react-audio

A react audio player component library.

MIT license view on npm

BUILD npm module downloads


Node version

Peer Dependencies:

react react-dom

npm i @clxrity/react-audio
pnpm add @clxrity/react-audio
yarn add @clxrity/react-audio

Documentation Changelog


Dynamic import example with Next.js

'use client' // (REQUIRED)
import dynamic from 'next/dynamic'
import '@clxrity/react-audio/index.css' // (optional) import the styles

/**
 * You can also import the CSS within your `globals.css` or `index.css` file like so:
 * ```css
 * @import "@clxrity/react-audio/index.css";
 * ```
 */

const Player = dynamic(
    () => import('@clxrity/react-audio').then((mod) => mod.Player),
    { ssr: false }
)

export default function Component() {
    const track = {
        src: '/loop.wav', // (REQUIRED) audio file path (public/loop.wav)
        title: 'Loop',
        artist: {
            name: 'Clxrity',
            url: 'https://wav.clxrity.xyz',
        },
    }

    return <Player track={track} showTrackInfo={true} />
}