@waveform-playlist/ui-components 8.0.0 → 8.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
@@ -1311,7 +1311,8 @@ var PlayheadWithMarker = ({
1311
1311
  samplesPerPixel,
1312
1312
  sampleRate,
1313
1313
  controlsOffset,
1314
- getAudioContextTime
1314
+ getAudioContextTime,
1315
+ getPlaybackTime
1315
1316
  }) => {
1316
1317
  const containerRef = useRef3(null);
1317
1318
  const animationFrameRef = useRef3(null);
@@ -1319,9 +1320,15 @@ var PlayheadWithMarker = ({
1319
1320
  const updatePosition = () => {
1320
1321
  if (containerRef.current) {
1321
1322
  let time;
1322
- if (isPlaying && getAudioContextTime) {
1323
- const elapsed = getAudioContextTime() - (playbackStartTimeRef.current ?? 0);
1324
- time = (audioStartPositionRef.current ?? 0) + elapsed;
1323
+ if (isPlaying) {
1324
+ if (getPlaybackTime) {
1325
+ time = getPlaybackTime();
1326
+ } else if (getAudioContextTime) {
1327
+ const elapsed = getAudioContextTime() - (playbackStartTimeRef.current ?? 0);
1328
+ time = (audioStartPositionRef.current ?? 0) + elapsed;
1329
+ } else {
1330
+ time = currentTimeRef.current ?? 0;
1331
+ }
1325
1332
  } else {
1326
1333
  time = currentTimeRef.current ?? 0;
1327
1334
  }
@@ -1351,7 +1358,8 @@ var PlayheadWithMarker = ({
1351
1358
  currentTimeRef,
1352
1359
  playbackStartTimeRef,
1353
1360
  audioStartPositionRef,
1354
- getAudioContextTime
1361
+ getAudioContextTime,
1362
+ getPlaybackTime
1355
1363
  ]);
1356
1364
  useEffect3(() => {
1357
1365
  if (!isPlaying && containerRef.current) {