Custom-made audio player delivered as a Web Component with first-class wrappers for React, Vue 3 and Angular.
Beautiful Player
Custom-made audio player delivered as a Web Component with first-class wrappers for React, Vue 3 and Angular.
Roadmap · upcoming modules
• Video player 📹 • Voice recorder 🎙 • Stories / playlists 📚
1 · Installation
npm i beautiful-player
CDN (no build-step):
<script type="module" src="https://unpkg.com/beautiful-player/dist/beautiful-player.esm.js"></script>
2 · Web Component usage
Full example
<beautiful-audio src="song.mp3" speeds="0.75,1,1.25,1.5" primary-color="#ff006e" icon-play="▶" icon-pause="⏸" icon-download="⬇" hide-buttons="volume" autoplay ></beautiful-audio>
Attributes (Web Component)
| Attribute | Type | Default | Description | |-----------|------|---------|-------------| |
src
type
audio/ogg
speeds
1,1.5,2
autoplay
false
primary-color
#222375
icon-size
48
icon-color
--primary
width
height
hide-buttons
speed,volume,download
hide-speed
hide-volume
hide-download
icon-play
icon-pause
icon-download
tooltips
true
false
crossorigin
Events
All native
<audio>
download
document.querySelector('beautiful-audio') .addEventListener('download', e => { console.log(e.detail.url) // audio file // e.preventDefault() // cancel native download })
Custom tooltip example
<beautiful-audio src="song.mp3" icon-size="40" tooltips='{"play":"<strong>Play</strong>","download":"<em>Save file</em>"}'> </beautiful-audio>
3 · Official wrappers
| Framework | Import | Quick example | |-----------|--------|---------------| | React |
import { BeautifulAudio } from 'beautiful-player/wrappers/react'
<BeautifulAudio src="song.mp3" speeds={[1,1.5,2]} />
import { BeautifulAudio } from 'beautiful-player/wrappers/vue'
<BeautifulAudio :src="'song.mp3'" :speeds="[1,1.5,2]" />
import { BeautifulPlayerModule } from 'beautiful-player/wrappers/beautiful-player.module'
<beautiful-audio src="song.mp3"></beautiful-audio>
4 · Common Props (Wrappers)
All wrappers (React, Vue, Angular) accept the same set of props/attributes. Only the syntax changes according to the framework.
| Prop | Type | Default | Description / Example | |--------------|--------------------------------------|--------------|----------------------| |
src
type
audio/ogg
speeds
[1,1.5,2]
[1,1.25,1.5]
autoplay
false
primaryColor
#222375
iconColor
--primary
iconSize
48
width
height
hideButtons
{ speed?, volume?, download? }
icons
{ play?, pause?, download?, volumeMute?, ... }
tooltips
true
false
onDownload
CustomEvent<{url:string}>
controls
loop
preload
Example (React):
<BeautifulAudio src="song.mp3" speeds={[1, 1.25, 1.5]} type="audio/ogg" primaryColor="#222375" iconColor="#ff006e" iconSize={40} width={400} height={80} hideButtons={{ volume: true }} icons={{ play: <MyPlayIcon />, pause: '<svg>...</svg>', download: '⬇' }} tooltips={{ play: <strong>Play</strong>, download: 'Save file', volume: () => <span>🔊</span> }} controls preload="auto" onDownload={e => console.log(e.detail.url)} />
Example (Vue):
<BeautifulAudio src="song.mp3" :speeds="[1,1.5,2]" icon-color="#ff006e" icon-size="40" :icons="{ play: '<svg>...</svg>' }" :tooltips="{ volume: 'Volume', download: '<em>Salvar</em>' }" controls preload="auto" @download="handleDl" />
Example (Angular):
<beautiful-audio src="song.mp3" icon-size="40" icon-color="#ff006e" tooltips='{"download":"Save"}' hide-speed controls preload="auto" (download)="onDl($event)"></beautiful-audio>
Notes:
- All wrappers forward any unknown prop/attribute to the underlying element.
<audio>
- You can use any SVG, string, or imported icon for the prop.
icons
- Tooltips accept text, HTML, React/Vue elements, HTMLElements, or functions returning any of these.
- For advanced theming, use CSS variables (,
--primary
,--icon-color
) or--btn-size
selectors (coming soon).::part
👨💻 Author
Samuel Ramos
- NPM: samuelramos.dev
- GitHub: @samuelrms
- Website: samuelramos.dev
🤝 Contributing
All contributions are welcome — from bug reports and feature requests to pull requests or documentation improvements!
How to contribute:
- Open an issue: Found a bug, have a question, or want to suggest a feature? Open an issue.
- Fork & PR: Fork the repo, create a branch, and submit a pull request. We review quickly!
- Improve docs: Even typo fixes or better examples are valuable.
- Show your work: Share your use case or integration in Discussions or via an issue.
Where to find us:
- NPM profile: samuelramos.dev on npm
- GitHub: github.com/samuelrms/beautiful-player
Why contribute?
- Help shape a modern, framework-agnostic audio player for everyone.
- Get your name in the contributors list.
- Make open source better for the next dev!