@stargate91/pill-player 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +382 -0
- package/assets/preview.png +0 -0
- package/dist/index.css +988 -0
- package/dist/index.d.mts +249 -0
- package/dist/index.d.ts +249 -0
- package/dist/index.js +1751 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1702 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Levente Gall (https://leventegall.dev)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# @stargate91/pill-player
|
|
2
|
+
|
|
3
|
+
> A futuristic HUD floating audio player component for React. Features an expandable console, 16-band spectrum visualizer, interactive seekbar, multi-provider playback (Local HTML5, SoundCloud, YouTube, Mixcloud), 8 cybernetic themes, and zero runtime UI dependencies.
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@stargate91/pill-player"><img src="https://img.shields.io/npm/v/@stargate91/pill-player?color=3794ff&label=npm&style=flat-square" alt="npm version" /></a>
|
|
7
|
+
<a href="https://bundlephobia.com/package/@stargate91/pill-player"><img src="https://img.shields.io/bundlephobia/minzip/@stargate91/pill-player?color=3794ff&label=minzipped&style=flat-square" alt="bundle size" /></a>
|
|
8
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-3794ff?style=flat-square" alt="license" /></a>
|
|
9
|
+
<img src="https://img.shields.io/badge/react-18%2B%20%7C%2019%2B-20232a?style=flat-square&logo=react&logoColor=61dafb" alt="React 18 / 19" />
|
|
10
|
+
<img src="https://img.shields.io/badge/typescript-strict-20232a?style=flat-square&logo=typescript&logoColor=3178c6" alt="TypeScript Strict" />
|
|
11
|
+
<img src="https://img.shields.io/badge/engines-HTML5%20%7C%20SC%20%7C%20YT%20%7C%20Mixcloud-20232a?style=flat-square" alt="Multi-Engine" />
|
|
12
|
+
<img src="https://img.shields.io/badge/ui%20deps-zero-10b981?style=flat-square" alt="Zero UI Dependencies" />
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="assets/preview.png" alt="Pill Player Preview" width="380" />
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **Multi-Engine Audio Playback**: Unified playback across **Local Audio** (.mp3, .wav, .ogg streams), **SoundCloud** tracks and sets, **YouTube** videos and streams, and **Mixcloud** DJ mixes.
|
|
25
|
+
- **Interactive HUD AudioSeekbar**: Real-time progress tracker with timestamps (`mm:ss` / `hh:mm:ss`), smooth mouse and touch scrubbing, and full keyboard navigation (Left/Right arrows for +/- 5s, PageUp/PageDown for +/- 30s).
|
|
26
|
+
- **Seamless Headless Mode (`embedMode: "seamless"`)**: Third-party iframe widgets (Mixcloud, SoundCloud, YouTube) can be concealed off-screen while playback, telemetry, and native HUD controls take over with a uniform sci-fi aesthetic.
|
|
27
|
+
- **16-Band DSP Spectrum Visualizer**: Real-time frequency analysis powered by Web Audio API for direct audio, with procedural BPM-synchronized pulse fallback.
|
|
28
|
+
- **Floating Capsule and HUD Console**: Compact, unobtrusive floating capsule with animated mini-equalizer bars that expands into a cybernetic HUD console.
|
|
29
|
+
- **8 Built-in Themes + Hex Custom Colors**: `stargate` (Electric Azure), `orbital` (Emerald/Cyan), `cyberpunk` (Neon Pink), `matrix` (Phosphor Green), `synthwave` (Sunset Orange), `amber` (Golden CRT), `nordic` (Polar Frost), and `minimal` (Monochrome). Override exact hex colors via the `colors` prop.
|
|
30
|
+
- **Dynamic Screen Docking**: Supports `bottom-right`, `bottom-left`, `top-right`, `top-left`, and `inline` docking with automatic expansion orientation.
|
|
31
|
+
- **Flexible Playlists**: Load tracks from in-memory arrays or directly from a local or remote JSON URL (`tracks="/playlist.json"`).
|
|
32
|
+
- **Zero-Dependency Icon Slots**: Ships with lightweight handcrafted SVGs, or plug in **Lucide**, **Phosphor**, **FontAwesome**, or pure CSS **UnoCSS / Tailwind** icons.
|
|
33
|
+
- **Accessible**: ARIA dialog and slider roles, keyboard shortcuts (Escape to close, arrows to seek), and screen reader support.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install @stargate91/pill-player
|
|
41
|
+
# or
|
|
42
|
+
yarn add @stargate91/pill-player
|
|
43
|
+
# or
|
|
44
|
+
pnpm add @stargate91/pill-player
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { PillPlayer } from "@stargate91/pill-player";
|
|
53
|
+
import "@stargate91/pill-player/dist/index.css";
|
|
54
|
+
|
|
55
|
+
// Multi-provider playlist: Mixcloud, SoundCloud, YouTube, and direct HTML5 audio
|
|
56
|
+
const tracks = [
|
|
57
|
+
{
|
|
58
|
+
id: "track-1",
|
|
59
|
+
title: "Synthwave Chill Radio",
|
|
60
|
+
code: "YT 01",
|
|
61
|
+
artist: "Lofi Girl",
|
|
62
|
+
genre: "Synthwave",
|
|
63
|
+
bpm: 128,
|
|
64
|
+
youtube: "https://www.youtube.com/watch?v=4xDzrJKXOOY", // YouTube stream or video ID
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "track-2",
|
|
68
|
+
title: "cast_01",
|
|
69
|
+
code: "CAST 01",
|
|
70
|
+
artist: "lvntex",
|
|
71
|
+
genre: "SoundCloud Set",
|
|
72
|
+
bpm: 135,
|
|
73
|
+
soundcloud: "https://soundcloud.com/lvntex/cast_01", // SoundCloud track or set URL
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "track-3",
|
|
77
|
+
title: "Critical Drum & Bass",
|
|
78
|
+
code: "Mix 07",
|
|
79
|
+
artist: "Stargate91",
|
|
80
|
+
genre: "Drum & Bass",
|
|
81
|
+
bpm: 174,
|
|
82
|
+
duration: "30 min",
|
|
83
|
+
feed: "/lvnte/nypox-podcast-drum-bass-phase-episode-7-critical-x-shogun/", // Mixcloud feed
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "track-4",
|
|
87
|
+
title: "Deep Space Atmosphere",
|
|
88
|
+
code: "Audio 01",
|
|
89
|
+
artist: "CyberLab DSP",
|
|
90
|
+
genre: "Direct MP3 Stream",
|
|
91
|
+
bpm: 120,
|
|
92
|
+
duration: "0:45",
|
|
93
|
+
src: "https://actions.google.com/sounds/v1/science_fiction/alien_hum.ogg", // Direct audio file
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
export default function App() {
|
|
98
|
+
return (
|
|
99
|
+
<PillPlayer
|
|
100
|
+
tracks={tracks}
|
|
101
|
+
theme="stargate"
|
|
102
|
+
position="bottom-right"
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Supported Audio Sources
|
|
111
|
+
|
|
112
|
+
Pill Player automatically detects the provider for each track in your list:
|
|
113
|
+
|
|
114
|
+
| Provider | Track Property | Example Value | Description |
|
|
115
|
+
| :--- | :--- | :--- | :--- |
|
|
116
|
+
| **Direct HTML5 Audio** | `src` | `"https://example.com/stream.mp3"` | Standard audio files (.mp3, .wav, .ogg, .aac, radio streams). Powers real-time Web Audio API frequency analysis. |
|
|
117
|
+
| **SoundCloud** | `soundcloud` | `"https://soundcloud.com/user/track"` | Any public SoundCloud track or set URL. Synced via official SoundCloud Widget API. |
|
|
118
|
+
| **YouTube** | `youtube` | `"dQw4w9WgXcQ"` or full URL | YouTube video ID, watch URL, youtu.be, or shorts link. Synced via YouTube IFrame API. |
|
|
119
|
+
| **Mixcloud** | `feed` | `"/user/mix-title/"` | Mixcloud cloudcast feed path. Synced via official Mixcloud Widget API. |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Embed Modes (`embedMode`)
|
|
124
|
+
|
|
125
|
+
Third-party widgets (like Mixcloud, SoundCloud, or YouTube) often have clashing colors or intrusive default UI. With `embedMode`, you decide how third-party streams render:
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<PillPlayer
|
|
129
|
+
tracks={tracks}
|
|
130
|
+
features={{
|
|
131
|
+
// "seamless": (Default) Hides third-party widgets off-screen.
|
|
132
|
+
// Audio plays through the futuristic HUD console with the native AudioSeekbar.
|
|
133
|
+
// "themed": Displays the official widget with dynamic theme-matched CSS filters.
|
|
134
|
+
// "widget": Shows the unstyled raw iframe widget.
|
|
135
|
+
embedMode: "seamless",
|
|
136
|
+
showSeekbar: true, // Active whenever widgets are hidden or for local files
|
|
137
|
+
}}
|
|
138
|
+
/>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
> Note: For local audio files (`src`), the native **AudioSeekbar** is **always active** because HTML5 audio has no visual widget.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Loading from JSON (Local or Remote)
|
|
146
|
+
|
|
147
|
+
Instead of hardcoding a JavaScript array, you can pass a local or remote JSON URL. Pill Player automatically fetches and caches the tracklist:
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
// Automatic fetch from a local file or remote API:
|
|
151
|
+
<PillPlayer tracks="/demo/tracks.json" theme="stargate" />
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Example `tracks.json` schema:
|
|
155
|
+
```json
|
|
156
|
+
[
|
|
157
|
+
{
|
|
158
|
+
"id": "yt-01",
|
|
159
|
+
"title": "Synthwave Chill Radio",
|
|
160
|
+
"code": "YT 01",
|
|
161
|
+
"artist": "Lofi Girl",
|
|
162
|
+
"genre": "Synthwave",
|
|
163
|
+
"bpm": 128,
|
|
164
|
+
"youtube": "https://www.youtube.com/watch?v=4xDzrJKXOOY"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"id": "sc-01",
|
|
168
|
+
"title": "cast_01",
|
|
169
|
+
"code": "CAST 01",
|
|
170
|
+
"artist": "lvntex",
|
|
171
|
+
"genre": "SoundCloud Set",
|
|
172
|
+
"bpm": 135,
|
|
173
|
+
"soundcloud": "https://soundcloud.com/lvntex/cast_01"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"id": "mix-07",
|
|
177
|
+
"title": "Critical Drum & Bass",
|
|
178
|
+
"code": "Mix 07",
|
|
179
|
+
"artist": "Stargate91",
|
|
180
|
+
"genre": "Drum & Bass",
|
|
181
|
+
"bpm": 174,
|
|
182
|
+
"feed": "/lvnte/nypox-podcast-drum-bass-phase-episode-7-critical-x-shogun/"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"id": "local-01",
|
|
186
|
+
"title": "Synthesizer Atmosphere",
|
|
187
|
+
"code": "Audio 01",
|
|
188
|
+
"artist": "CyberLab DSP",
|
|
189
|
+
"genre": "Direct MP3 Stream",
|
|
190
|
+
"bpm": 120,
|
|
191
|
+
"duration": "0:45",
|
|
192
|
+
"src": "https://actions.google.com/sounds/v1/science_fiction/alien_hum.ogg"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Themes & Custom Colors
|
|
200
|
+
|
|
201
|
+
### Built-in Themes (`theme`)
|
|
202
|
+
Pass any of the 8 pre-configured cybernetic themes:
|
|
203
|
+
|
|
204
|
+
| Theme | Accent | Glow / Mood | Best For |
|
|
205
|
+
| :--- | :--- | :--- | :--- |
|
|
206
|
+
| `"stargate"` | Electric Azure (`#3794ff`) | Cobalt Aura | Modern VS Code & sci-fi terminal interfaces |
|
|
207
|
+
| `"orbital"` | Cyan / Emerald (`#00f0ff`) | Space Station Glow | Deep space and electronic ambient |
|
|
208
|
+
| `"cyberpunk"` | Neon Pink (`#ff0055`) | Night City Neon | High contrast synthwave & cyberpunk |
|
|
209
|
+
| `"matrix"` | Phosphor Green (`#00ff66`) | Terminal CRT | Retro hacker aesthetics & dark terminals |
|
|
210
|
+
| `"synthwave"` | Sunset Orange (`#ff7700`) | Outrun Horizon | Retrowave, 80s vibes, and warm gradients |
|
|
211
|
+
| `"amber"` | Warm Amber (`#ffb000`) | Vintage CRT Monitor | Industrial telemetry and retro audio gear |
|
|
212
|
+
| `"nordic"` | Polar Frost (`#7aa2f7`) | Cool Ice & Arctic Blue | Clean minimalist dark palettes |
|
|
213
|
+
| `"minimal"` | Monochrome White (`#f0f0f0`) | Subtle Slate White | High-end minimal portfolios and neutral UIs |
|
|
214
|
+
|
|
215
|
+
### Custom Color Overrides (`colors`)
|
|
216
|
+
Override theme variables with custom hex / rgba values:
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
<PillPlayer
|
|
220
|
+
tracks={tracks}
|
|
221
|
+
colors={{
|
|
222
|
+
accent: "#3794ff", // Controls, active items, seekbar progress
|
|
223
|
+
secondary: "#9cdcfe", // Badges, LEDs, visualizer highlights
|
|
224
|
+
bg: "#121418", // Main HUD card & pill background
|
|
225
|
+
surface: "rgba(255, 255, 255, 0.04)", // Internal card surfaces
|
|
226
|
+
border: "rgba(55, 148, 255, 0.25)",
|
|
227
|
+
glow: "rgba(55, 148, 255, 0.4)",
|
|
228
|
+
text: "#ffffff",
|
|
229
|
+
textDim: "#858585",
|
|
230
|
+
}}
|
|
231
|
+
/>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Custom Icons
|
|
237
|
+
|
|
238
|
+
Pill Player has zero runtime icon dependencies by default. Supply custom icons via the `icons` prop using Lucide React, Phosphor, FontAwesome, or pure CSS UnoCSS / Tailwind classes:
|
|
239
|
+
|
|
240
|
+
### Using with `lucide-react`
|
|
241
|
+
```tsx
|
|
242
|
+
import { Play, Pause, SkipBack, SkipForward, Volume2, VolumeX, X, ExternalLink } from "lucide-react";
|
|
243
|
+
|
|
244
|
+
<PillPlayer
|
|
245
|
+
tracks={tracks}
|
|
246
|
+
icons={{
|
|
247
|
+
play: <Play size={15} fill="currentColor" />,
|
|
248
|
+
pause: <Pause size={15} fill="currentColor" />,
|
|
249
|
+
prev: <SkipBack size={16} />,
|
|
250
|
+
next: <SkipForward size={16} />,
|
|
251
|
+
mute: <Volume2 size={16} />,
|
|
252
|
+
unmute: <VolumeX size={16} />,
|
|
253
|
+
close: <X size={16} />,
|
|
254
|
+
external: <ExternalLink size={15} />,
|
|
255
|
+
}}
|
|
256
|
+
/>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Using with UnoCSS / Tailwind CSS (0 KB Runtime JS)
|
|
260
|
+
```tsx
|
|
261
|
+
<PillPlayer
|
|
262
|
+
tracks={tracks}
|
|
263
|
+
icons={{
|
|
264
|
+
play: <span className="i-lucide-play inline-block text-[15px]" />,
|
|
265
|
+
pause: <span className="i-lucide-pause inline-block text-[15px]" />,
|
|
266
|
+
prev: <span className="i-lucide-skip-back inline-block text-[16px]" />,
|
|
267
|
+
next: <span className="i-lucide-skip-forward inline-block text-[16px]" />,
|
|
268
|
+
mute: <span className="i-lucide-volume-2 inline-block text-[16px]" />,
|
|
269
|
+
unmute: <span className="i-lucide-volume-x inline-block text-[16px]" />,
|
|
270
|
+
close: <span className="i-lucide-x inline-block text-[15px]" />,
|
|
271
|
+
external: <span className="i-lucide-external-link inline-block text-[15px]" />,
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Complete API Reference
|
|
279
|
+
|
|
280
|
+
### `<PillPlayer />` Props
|
|
281
|
+
|
|
282
|
+
| Prop | Type | Default | Description |
|
|
283
|
+
| :--- | :--- | :--- | :--- |
|
|
284
|
+
| `tracks` | `AudioTrack[] | string` | **Required** | Array of track objects or URL path to a remote/local JSON playlist. |
|
|
285
|
+
| `theme` | `PillTheme` | `"orbital"` | Built-in theme (`"stargate"`, `"orbital"`, `"cyberpunk"`, `"matrix"`, `"synthwave"`, `"amber"`, `"nordic"`, `"minimal"`). |
|
|
286
|
+
| `colors` | `PillColors` | `undefined` | Optional hex/rgba overrides (`accent`, `secondary`, `bg`, `surface`, `border`, `glow`, `text`, `textDim`). |
|
|
287
|
+
| `position` | `PillPosition` | `"bottom-right"` | Screen anchor position: `"bottom-right"`, `"bottom-left"`, `"top-right"`, `"top-left"`, or `"inline"`. |
|
|
288
|
+
| `icons` | `PillIcons` | Built-in SVGs | Custom icon elements for play, pause, prev, next, mute, unmute, close, external. |
|
|
289
|
+
| `labels` | `Partial<PillLabels>` | English defaults | Custom i18n label dictionary for telemetry, buttons, and ARIA strings. |
|
|
290
|
+
| `features` | `PillFeatures` | `{}` | Toggleable feature flags (see table below). |
|
|
291
|
+
| `initialOpen` | `boolean` | `false` | Whether the HUD card starts expanded on page load. |
|
|
292
|
+
| `className` | `string` | `""` | Additional CSS class for the player anchor container. |
|
|
293
|
+
| `style` | `CSSProperties` | `undefined` | Additional inline style overrides. |
|
|
294
|
+
| `onTrackChange` | `(track: AudioTrack, index: number) => void` | `undefined` | Callback fired whenever the active track changes. |
|
|
295
|
+
| `onPlayStateChange` | `(isPlaying: boolean) => void` | `undefined` | Callback fired whenever playback toggles between play and pause. |
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
### `AudioTrack` Schema
|
|
300
|
+
|
|
301
|
+
| Field | Type | Description |
|
|
302
|
+
| :--- | :--- | :--- |
|
|
303
|
+
| `id` | `string` | **Required**. Unique track identifier. |
|
|
304
|
+
| `title` | `string` | **Required**. Track title displayed in HUD and playlist. |
|
|
305
|
+
| `code` | `string` | Optional short identifier code (e.g. `"Mix 01"`, `"YT 01"`, `"EP-02"`). |
|
|
306
|
+
| `artist` | `string` | Optional artist / creator name. |
|
|
307
|
+
| `genre` | `string` | Optional genre tag badge (e.g. `"Drum & Bass"`, `"Synthwave"`). |
|
|
308
|
+
| `bpm` | `number | string` | Optional BPM to drive procedural spectrum animation speed (e.g. `174`, `"128 BPM"`). |
|
|
309
|
+
| `duration` | `string` | Optional display duration (e.g. `"3:45"`, `"30 min"`). |
|
|
310
|
+
| `src` | `string` | Direct HTML5 audio stream or file URL (.mp3, .wav, .ogg, .aac). |
|
|
311
|
+
| `soundcloud` | `string` | SoundCloud track or set URL. |
|
|
312
|
+
| `youtube` | `string` | YouTube video ID (`"dQw4w9WgXcQ"`) or full video URL. |
|
|
313
|
+
| `feed` | `string` | Mixcloud feed path (e.g. `"/user/mix-title/"`). |
|
|
314
|
+
| `externalUrl` | `string` | Optional custom external link override. If omitted, provider URLs are automatically used. |
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
### `PillFeatures` Options
|
|
319
|
+
|
|
320
|
+
| Option | Type | Default | Description |
|
|
321
|
+
| :--- | :--- | :--- | :--- |
|
|
322
|
+
| `showSeekbar` | `boolean` | `true` | Displays the interactive HUD seekbar for local audio, SoundCloud, and headless streams. |
|
|
323
|
+
| `showSpectrum` | `boolean` | `true` | Displays the 16-band DSP Equalizer stage. |
|
|
324
|
+
| `showPlaylist` | `boolean` | `true` | Displays the tracklist selection area when more than 1 track is present. |
|
|
325
|
+
| `embedMode` | `"seamless" | "themed" | "widget"` | `"seamless"` | Stream embed mode: `"seamless"` (headless HUD + seekbar), `"themed"` (color-filtered iframe), `"widget"` (raw iframe). |
|
|
326
|
+
| `beaconGlow` | `boolean` | `false` | Adds a subtle periodic 4-second breathing dimming & opacity pulse to the HUD console. |
|
|
327
|
+
| `persistState` | `boolean` | `true` | Remembers the last selected track in browser `localStorage`. |
|
|
328
|
+
| `enableKeyboardShortcuts` | `boolean` | `true` | Enables Escape key to collapse HUD and Arrow keys to scrub audio. |
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
### `PillLabels` Localization Dictionary
|
|
333
|
+
|
|
334
|
+
Pass a partial dictionary to the `labels` prop to translate or customize any string:
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
<PillPlayer
|
|
338
|
+
tracks={tracks}
|
|
339
|
+
labels={{
|
|
340
|
+
badge: "AUDIO PLAYER",
|
|
341
|
+
openPlayer: "Open player",
|
|
342
|
+
closePlayer: "Close player",
|
|
343
|
+
play: "Play",
|
|
344
|
+
pause: "Pause",
|
|
345
|
+
prevTrack: "Previous",
|
|
346
|
+
nextTrack: "Next",
|
|
347
|
+
mute: "Mute",
|
|
348
|
+
unmute: "Unmute",
|
|
349
|
+
selectTrack: "PLAYLIST",
|
|
350
|
+
frequenciesActive: "PLAYING",
|
|
351
|
+
frequenciesStandby: "PAUSED",
|
|
352
|
+
spectrumHeader: "EQUALIZER",
|
|
353
|
+
subtitle: "Audio",
|
|
354
|
+
}}
|
|
355
|
+
/>
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Local Development & Demo
|
|
361
|
+
|
|
362
|
+
Clone the repository and start the interactive Vite dev server:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
cd pill-player
|
|
366
|
+
npm install
|
|
367
|
+
npm run dev
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Open `http://localhost:5173/` to test all themes, positions, custom color pickers, providers, and seekbar controls.
|
|
371
|
+
|
|
372
|
+
To compile the library bundle for distribution:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
npm run build
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## License
|
|
381
|
+
|
|
382
|
+
MIT (c) [Levente Gall](https://leventegall.dev)
|
|
Binary file
|