@arraypress/waveform-player 1.16.0 → 1.16.1
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/dist/waveform-player.cjs +10 -0
- package/dist/waveform-player.cjs.map +2 -2
- package/dist/waveform-player.css +1 -1
- package/dist/waveform-player.esm.js +3 -3
- package/dist/waveform-player.esm.js.map +2 -2
- package/dist/waveform-player.js +10 -0
- package/dist/waveform-player.min.js +3 -3
- package/dist/waveform-player.min.js.map +2 -2
- package/package.json +1 -1
- package/src/css/waveform-player.css +6 -2
- package/src/js/core.js +14 -0
package/package.json
CHANGED
|
@@ -268,8 +268,12 @@
|
|
|
268
268
|
opacity: 1;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
/*
|
|
272
|
-
|
|
271
|
+
/* Briefly reveal the marker's label when the playhead reaches it. The player
|
|
272
|
+
adds `.show-label` on activation and removes it after ~2.5s, so the label
|
|
273
|
+
flashes then fades while the `.active` highlight stays. Override to taste —
|
|
274
|
+
e.g. `.waveform-marker.active .waveform-marker-tooltip { opacity: 1 }` to keep
|
|
275
|
+
it on, or `{ opacity: 0 !important }` to disable. */
|
|
276
|
+
.waveform-marker.show-label .waveform-marker-tooltip {
|
|
273
277
|
opacity: 1;
|
|
274
278
|
}
|
|
275
279
|
|
package/src/js/core.js
CHANGED
|
@@ -116,6 +116,7 @@ export class WaveformPlayer {
|
|
|
116
116
|
this.waveformData = [];
|
|
117
117
|
this.progress = 0;
|
|
118
118
|
this._activeMarkerIndex = -1;
|
|
119
|
+
this._markerLabelTimer = null;
|
|
119
120
|
this.isPlaying = false;
|
|
120
121
|
this.isLoading = false;
|
|
121
122
|
this.hasError = false;
|
|
@@ -1052,6 +1053,7 @@ export class WaveformPlayer {
|
|
|
1052
1053
|
this.markersContainer.innerHTML = '';
|
|
1053
1054
|
// Re-sync the active marker on the next progress tick (the DOM was wiped).
|
|
1054
1055
|
this._activeMarkerIndex = -1;
|
|
1056
|
+
clearTimeout(this._markerLabelTimer);
|
|
1055
1057
|
|
|
1056
1058
|
if (!this.options.showMarkers || !this.options.markers?.length) return;
|
|
1057
1059
|
|
|
@@ -1137,6 +1139,17 @@ export class WaveformPlayer {
|
|
|
1137
1139
|
if (active !== this._activeMarkerIndex) {
|
|
1138
1140
|
this._activeMarkerIndex = active;
|
|
1139
1141
|
this.setActiveMarker(active);
|
|
1142
|
+
// Flash the newly-active marker's label, then let it fade — the
|
|
1143
|
+
// highlight stays. Override via `.waveform-marker.show-label` CSS.
|
|
1144
|
+
clearTimeout(this._markerLabelTimer);
|
|
1145
|
+
els.forEach((el, i) => el.classList.toggle('show-label', i === active));
|
|
1146
|
+
if (active >= 0) {
|
|
1147
|
+
this._markerLabelTimer = setTimeout(() => {
|
|
1148
|
+
this.markersContainer
|
|
1149
|
+
?.querySelectorAll('.waveform-marker')
|
|
1150
|
+
.forEach((el) => el.classList.remove('show-label'));
|
|
1151
|
+
}, 2500);
|
|
1152
|
+
}
|
|
1140
1153
|
}
|
|
1141
1154
|
}
|
|
1142
1155
|
|
|
@@ -1831,6 +1844,7 @@ export class WaveformPlayer {
|
|
|
1831
1844
|
// Stop playback and animations
|
|
1832
1845
|
this.pause();
|
|
1833
1846
|
this.stopSmoothUpdate();
|
|
1847
|
+
clearTimeout(this._markerLabelTimer);
|
|
1834
1848
|
|
|
1835
1849
|
// Tear down every document/container/seek listener in one shot.
|
|
1836
1850
|
this._ac?.abort();
|