@waveform-playlist/browser 14.0.0 → 15.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
@@ -1942,7 +1942,7 @@ var WaveformPlaylistProvider = ({
1942
1942
  tracksRef.current = tracks;
1943
1943
  const isEngineTracks = tracks === engineTracksRef.current;
1944
1944
  const prevTracks = prevTracksRef.current;
1945
- const isIncrementalAdd = engineRef.current !== null && prevTracks.length > 0 && tracks.length > prevTracks.length && prevTracks.every((pt) => {
1945
+ const isIncrementalAdd = engineRef.current !== null && tracks.length > prevTracks.length && prevTracks.every((pt) => {
1946
1946
  const current = tracks.find((t) => t.id === pt.id);
1947
1947
  return current === pt;
1948
1948
  });
@@ -2055,12 +2055,10 @@ var WaveformPlaylistProvider = ({
2055
2055
  setTrackStates([]);
2056
2056
  setPeaksDataArray([]);
2057
2057
  if (engineRef.current) {
2058
- engineRef.current.dispose();
2059
- engineRef.current = null;
2060
- adapterRef.current = null;
2058
+ engineRef.current.setTracks([]);
2059
+ prevTracksRef.current = tracks;
2060
+ return;
2061
2061
  }
2062
- prevTracksRef.current = tracks;
2063
- return;
2064
2062
  }
2065
2063
  const wasPlaying = isPlayingRef.current;
2066
2064
  const resumePosition = currentTimeRef.current;
@@ -3658,7 +3656,7 @@ import {
3658
3656
  SpectrogramLabels,
3659
3657
  CLIP_HEADER_HEIGHT
3660
3658
  } from "@waveform-playlist/ui-components";
3661
- import { audibleLatencySamples } from "@waveform-playlist/core";
3659
+ import { resolveRecordingOffsetSamples } from "@waveform-playlist/core";
3662
3660
 
3663
3661
  // src/components/AnimatedPlayhead.tsx
3664
3662
  import { useRef as useRef12, useEffect as useEffect8 } from "react";
@@ -4423,13 +4421,12 @@ var PlaylistVisualization = ({
4423
4421
  );
4424
4422
  }),
4425
4423
  (recordingState == null ? void 0 : recordingState.isRecording) && recordingState.trackId === track.id && ((_d2 = recordingState.peaks[0]) == null ? void 0 : _d2.length) > 0 && (() => {
4426
- const outputLatency = getOutputLatency();
4427
- const lookAhead = getLookAhead();
4428
- const latencyOffsetSamples = audibleLatencySamples(
4429
- outputLatency,
4430
- lookAhead,
4424
+ const latencyOffsetSamples = resolveRecordingOffsetSamples({
4425
+ overrideSeconds: recordingState.latencyOffset,
4426
+ outputLatency: getOutputLatency(),
4427
+ lookAhead: getLookAhead(),
4431
4428
  sampleRate
4432
- );
4429
+ });
4433
4430
  const latencyPixels = Math.floor(latencyOffsetSamples / samplesPerPixel);
4434
4431
  const skipPeakElements = latencyPixels * 2;
4435
4432
  const previewDuration = Math.max(