@arraypress/waveform-player 1.1.4 → 1.1.5
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/README.md +78 -6
- package/package.json +25 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# WaveformPlayer
|
|
2
2
|
|
|
3
3
|
A lightweight, customizable audio player with waveform visualization. Under 6KB gzipped.
|
|
4
4
|
|
|
@@ -18,6 +18,7 @@ A lightweight, customizable audio player with waveform visualization. Under 6KB
|
|
|
18
18
|
- **Real Waveforms** - Actual audio analysis, not fake waves
|
|
19
19
|
- **No Dependencies** - No jQuery, no bloat, pure vanilla JS
|
|
20
20
|
- **Works Everywhere** - WordPress, Shopify, React, Vue, or plain HTML
|
|
21
|
+
- **Ecosystem** - Optional playlist and analytics addons available
|
|
21
22
|
|
|
22
23
|
## Quick Start
|
|
23
24
|
|
|
@@ -57,6 +58,42 @@ npm install @arraypress/waveform-player
|
|
|
57
58
|
- 🎵 **BPM Detection** - Automatic tempo detection (optional)
|
|
58
59
|
- 💾 **Waveform Caching** - Pre-generate waveforms for performance
|
|
59
60
|
- 🌐 **Framework Agnostic** - Works with React, Vue, Angular, or vanilla JS
|
|
61
|
+
- ⌨️ **Keyboard Controls** - Full keyboard navigation support
|
|
62
|
+
- 📱 **Media Session API** - System media controls, lock screen integration
|
|
63
|
+
- ⏩ **Speed Control** - Adjustable playback rate for podcasts/audiobooks
|
|
64
|
+
- 📍 **Chapter Markers** - Add clickable markers for navigation
|
|
65
|
+
- 🔄 **Dynamic Loading** - Load new tracks without page refresh
|
|
66
|
+
|
|
67
|
+
## Ecosystem
|
|
68
|
+
|
|
69
|
+
### WaveformPlaylist (Optional Addon)
|
|
70
|
+
Add playlist and chapter support with zero JavaScript:
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<div data-waveform-playlist data-continuous="true">
|
|
74
|
+
<div data-track data-url="song1.mp3" data-title="Track 1">
|
|
75
|
+
<div data-chapter data-time="0:00">Intro</div>
|
|
76
|
+
<div data-chapter data-time="2:30">Verse</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div data-track data-url="song2.mp3" data-title="Track 2"></div>
|
|
79
|
+
</div>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
[Learn more →](https://github.com/arraypress/waveform-playlist)
|
|
83
|
+
|
|
84
|
+
### WaveformTracker (Optional Addon)
|
|
85
|
+
Track meaningful audio engagement:
|
|
86
|
+
|
|
87
|
+
```javascript
|
|
88
|
+
WaveformTracker.init({
|
|
89
|
+
endpoint: '/api/analytics',
|
|
90
|
+
events: {
|
|
91
|
+
listen: 30 // Track after 30 seconds of listening
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
[Learn more →](https://github.com/arraypress/waveform-tracker)
|
|
60
97
|
|
|
61
98
|
## Comparison
|
|
62
99
|
|
|
@@ -68,6 +105,9 @@ npm install @arraypress/waveform-player
|
|
|
68
105
|
| Waveform Styles | 6 | 3 | N/A |
|
|
69
106
|
| Setup Time | 30 seconds | 5+ minutes | 5+ minutes |
|
|
70
107
|
| Real Waveforms | ✅ | ✅ | ❌ |
|
|
108
|
+
| Keyboard Controls | ✅ | ✅ | ❌ |
|
|
109
|
+
| Media Session API | ✅ | ❌ | ❌ |
|
|
110
|
+
| Speed Control | ✅ | ✅ | ❌ |
|
|
71
111
|
|
|
72
112
|
## Usage
|
|
73
113
|
|
|
@@ -77,7 +117,9 @@ npm install @arraypress/waveform-player
|
|
|
77
117
|
data-url="audio.mp3"
|
|
78
118
|
data-title="My Song"
|
|
79
119
|
data-subtitle="Artist Name"
|
|
80
|
-
data-waveform-style="mirror"
|
|
120
|
+
data-waveform-style="mirror"
|
|
121
|
+
data-show-playback-speed="true"
|
|
122
|
+
data-markers='[{"time": 30, "label": "Chorus"}]'>
|
|
81
123
|
</div>
|
|
82
124
|
```
|
|
83
125
|
|
|
@@ -90,7 +132,11 @@ const player = new WaveformPlayer('#player', {
|
|
|
90
132
|
waveformStyle: 'mirror',
|
|
91
133
|
height: 80,
|
|
92
134
|
barWidth: 2,
|
|
93
|
-
barSpacing: 1
|
|
135
|
+
barSpacing: 1,
|
|
136
|
+
markers: [
|
|
137
|
+
{time: 30, label: 'Verse', color: '#4ade80'},
|
|
138
|
+
{time: 60, label: 'Chorus', color: '#f59e0b'}
|
|
139
|
+
]
|
|
94
140
|
});
|
|
95
141
|
```
|
|
96
142
|
|
|
@@ -120,9 +166,14 @@ Choose from 6 built-in styles:
|
|
|
120
166
|
| `buttonColor` | string | `'rgba(255,255,255,0.9)'` | Play button color |
|
|
121
167
|
| `showTime` | boolean | `true` | Show time display |
|
|
122
168
|
| `showBPM` | boolean | `false` | Enable BPM detection |
|
|
169
|
+
| `showPlaybackSpeed` | boolean | `false` | Show speed control menu |
|
|
170
|
+
| `playbackRate` | number | `1` | Initial playback speed (0.5-2) |
|
|
123
171
|
| `autoplay` | boolean | `false` | Autoplay on load |
|
|
124
172
|
| `title` | string | `''` | Track title |
|
|
125
173
|
| `subtitle` | string | `''` | Track subtitle |
|
|
174
|
+
| `artwork` | string | `''` | Album artwork URL |
|
|
175
|
+
| `markers` | array | `[]` | Chapter markers array |
|
|
176
|
+
| `enableMediaSession` | boolean | `true` | Enable system media controls |
|
|
126
177
|
|
|
127
178
|
## API Methods
|
|
128
179
|
|
|
@@ -139,6 +190,12 @@ player.seekToPercent(0.5); // Seek to 50%
|
|
|
139
190
|
// Volume
|
|
140
191
|
player.setVolume(0.8); // 80% volume
|
|
141
192
|
|
|
193
|
+
// Speed
|
|
194
|
+
player.setPlaybackRate(1.5); // 1.5x speed
|
|
195
|
+
|
|
196
|
+
// Dynamic loading
|
|
197
|
+
await player.loadTrack('new-song.mp3', 'New Title', 'New Artist');
|
|
198
|
+
|
|
142
199
|
// Destroy
|
|
143
200
|
player.destroy();
|
|
144
201
|
```
|
|
@@ -158,6 +215,16 @@ new WaveformPlayer('#player', {
|
|
|
158
215
|
});
|
|
159
216
|
```
|
|
160
217
|
|
|
218
|
+
## Keyboard Controls
|
|
219
|
+
|
|
220
|
+
When a player is focused (click on it):
|
|
221
|
+
|
|
222
|
+
- `Space` - Play/pause
|
|
223
|
+
- `←/→` - Seek backward/forward 5 seconds
|
|
224
|
+
- `↑/↓` - Volume up/down
|
|
225
|
+
- `M` - Mute/unmute
|
|
226
|
+
- `0-9` - Jump to 0%-90% of track
|
|
227
|
+
|
|
161
228
|
## Advanced Usage
|
|
162
229
|
|
|
163
230
|
### Pre-generated Waveforms
|
|
@@ -178,14 +245,14 @@ new WaveformPlayer('#player', {
|
|
|
178
245
|
### Multiple Players
|
|
179
246
|
|
|
180
247
|
```javascript
|
|
181
|
-
// Pause all players
|
|
182
|
-
WaveformPlayer.pauseAll();
|
|
183
|
-
|
|
184
248
|
// Get all instances
|
|
185
249
|
const players = WaveformPlayer.getAllInstances();
|
|
186
250
|
|
|
187
251
|
// Find specific player
|
|
188
252
|
const player = WaveformPlayer.getInstance('my-player');
|
|
253
|
+
|
|
254
|
+
// Destroy all players
|
|
255
|
+
WaveformPlayer.destroyAll();
|
|
189
256
|
```
|
|
190
257
|
|
|
191
258
|
### Custom Styling
|
|
@@ -258,6 +325,11 @@ See the [live demo](https://waveformplayer.com) for:
|
|
|
258
325
|
- Player builder
|
|
259
326
|
- BPM detection
|
|
260
327
|
- Pre-generated waveforms
|
|
328
|
+
- Keyboard navigation
|
|
329
|
+
- Speed controls
|
|
330
|
+
- Chapter markers
|
|
331
|
+
- Playlist support
|
|
332
|
+
- Analytics tracking
|
|
261
333
|
|
|
262
334
|
## Development
|
|
263
335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arraypress/waveform-player",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Lightweight, customizable audio player with waveform visualization",
|
|
5
5
|
"main": "dist/waveform-player.js",
|
|
6
6
|
"module": "dist/waveform-player.esm.js",
|
|
@@ -33,7 +33,14 @@
|
|
|
33
33
|
"music",
|
|
34
34
|
"sound",
|
|
35
35
|
"html5",
|
|
36
|
-
"web-audio"
|
|
36
|
+
"web-audio",
|
|
37
|
+
"media-session",
|
|
38
|
+
"audio-player",
|
|
39
|
+
"waveform-visualization",
|
|
40
|
+
"soundcloud",
|
|
41
|
+
"podcast-player",
|
|
42
|
+
"audio-visualization",
|
|
43
|
+
"bpm-detection"
|
|
37
44
|
],
|
|
38
45
|
"author": "ArrayPress",
|
|
39
46
|
"license": "MIT",
|
|
@@ -44,9 +51,23 @@
|
|
|
44
51
|
"bugs": {
|
|
45
52
|
"url": "https://github.com/arraypress/waveform-player/issues"
|
|
46
53
|
},
|
|
47
|
-
"homepage": "https://
|
|
54
|
+
"homepage": "https://waveformplayer.com",
|
|
55
|
+
"funding": {
|
|
56
|
+
"type": "github",
|
|
57
|
+
"url": "https://github.com/sponsors/arraypress"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=14.0.0"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public",
|
|
64
|
+
"registry": "https://registry.npmjs.org/"
|
|
65
|
+
},
|
|
66
|
+
"sideEffects": [
|
|
67
|
+
"*.css"
|
|
68
|
+
],
|
|
48
69
|
"devDependencies": {
|
|
49
70
|
"concurrently": "^7.6.0",
|
|
50
71
|
"esbuild": "^0.25.0"
|
|
51
72
|
}
|
|
52
|
-
}
|
|
73
|
+
}
|