@waveform-playlist/ui-components 12.0.0 → 12.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/dist/index.mjs CHANGED
@@ -1487,6 +1487,7 @@ var PlayheadWithMarker = ({
1487
1487
  color = "#ff0000",
1488
1488
  isPlaying,
1489
1489
  currentTimeRef,
1490
+ visualTimeRef,
1490
1491
  playbackStartTimeRef,
1491
1492
  audioStartPositionRef,
1492
1493
  samplesPerPixel,
@@ -1501,7 +1502,9 @@ var PlayheadWithMarker = ({
1501
1502
  const updatePosition = () => {
1502
1503
  if (containerRef.current) {
1503
1504
  let time;
1504
- if (isPlaying) {
1505
+ if (visualTimeRef?.current !== void 0 && visualTimeRef.current !== null) {
1506
+ time = visualTimeRef.current;
1507
+ } else if (isPlaying) {
1505
1508
  if (getPlaybackTime) {
1506
1509
  time = getPlaybackTime();
1507
1510
  } else if (getAudioContextTime) {
@@ -1537,6 +1540,7 @@ var PlayheadWithMarker = ({
1537
1540
  samplesPerPixel,
1538
1541
  controlsOffset,
1539
1542
  currentTimeRef,
1543
+ visualTimeRef,
1540
1544
  playbackStartTimeRef,
1541
1545
  audioStartPositionRef,
1542
1546
  getAudioContextTime,
@@ -1544,7 +1548,7 @@ var PlayheadWithMarker = ({
1544
1548
  ]);
1545
1549
  useEffect3(() => {
1546
1550
  if (!isPlaying && containerRef.current) {
1547
- const time = currentTimeRef.current ?? 0;
1551
+ const time = visualTimeRef?.current ?? currentTimeRef.current ?? 0;
1548
1552
  const pos = time * sampleRate / samplesPerPixel + controlsOffset;
1549
1553
  containerRef.current.style.transform = `translate3d(${pos}px, 0, 0)`;
1550
1554
  }