@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.
@@ -849,6 +849,7 @@ var WaveformPlayer = class _WaveformPlayer {
849
849
  this.waveformData = [];
850
850
  this.progress = 0;
851
851
  this._activeMarkerIndex = -1;
852
+ this._markerLabelTimer = null;
852
853
  this.isPlaying = false;
853
854
  this.isLoading = false;
854
855
  this.hasError = false;
@@ -1583,6 +1584,7 @@ var WaveformPlayer = class _WaveformPlayer {
1583
1584
  if (!this.markersContainer) return;
1584
1585
  this.markersContainer.innerHTML = "";
1585
1586
  this._activeMarkerIndex = -1;
1587
+ clearTimeout(this._markerLabelTimer);
1586
1588
  if (!this.options.showMarkers || !this.options.markers?.length) return;
1587
1589
  const duration = this.getSeekDuration();
1588
1590
  if (!duration) {
@@ -1652,6 +1654,13 @@ var WaveformPlayer = class _WaveformPlayer {
1652
1654
  if (active !== this._activeMarkerIndex) {
1653
1655
  this._activeMarkerIndex = active;
1654
1656
  this.setActiveMarker(active);
1657
+ clearTimeout(this._markerLabelTimer);
1658
+ els.forEach((el, i) => el.classList.toggle("show-label", i === active));
1659
+ if (active >= 0) {
1660
+ this._markerLabelTimer = setTimeout(() => {
1661
+ this.markersContainer?.querySelectorAll(".waveform-marker").forEach((el) => el.classList.remove("show-label"));
1662
+ }, 2500);
1663
+ }
1655
1664
  }
1656
1665
  }
1657
1666
  /**
@@ -2230,6 +2239,7 @@ var WaveformPlayer = class _WaveformPlayer {
2230
2239
  this._emit("waveformplayer:destroy", { player: this, url: this.options.url });
2231
2240
  this.pause();
2232
2241
  this.stopSmoothUpdate();
2242
+ clearTimeout(this._markerLabelTimer);
2233
2243
  this._ac?.abort();
2234
2244
  if (this.resizeObserver) {
2235
2245
  this.resizeObserver.disconnect();