@waveform-playlist/browser 14.0.0 → 15.0.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.d.mts CHANGED
@@ -961,6 +961,12 @@ interface WaveformProps {
961
961
  durationSamples: number;
962
962
  peaks: (Int8Array | Int16Array)[];
963
963
  bits: 8 | 16;
964
+ /**
965
+ * Latency offset (seconds) to skip in the live preview. Absolute replacement
966
+ * for the auto-computed outputLatency + lookAhead value. Pass the same value
967
+ * given to useIntegratedRecording so preview and finalized clip match.
968
+ */
969
+ latencyOffset?: number;
964
970
  };
965
971
  }
966
972
  /**
@@ -1116,6 +1122,12 @@ interface PlaylistVisualizationProps {
1116
1122
  durationSamples: number;
1117
1123
  peaks: (Int8Array | Int16Array)[];
1118
1124
  bits: 8 | 16;
1125
+ /**
1126
+ * Latency offset (seconds) to skip in the live preview. Absolute replacement
1127
+ * for the auto-computed outputLatency + lookAhead value. Pass the same value
1128
+ * given to useIntegratedRecording so preview and finalized clip match.
1129
+ */
1130
+ latencyOffset?: number;
1119
1131
  };
1120
1132
  }
1121
1133
  /**
package/dist/index.d.ts CHANGED
@@ -961,6 +961,12 @@ interface WaveformProps {
961
961
  durationSamples: number;
962
962
  peaks: (Int8Array | Int16Array)[];
963
963
  bits: 8 | 16;
964
+ /**
965
+ * Latency offset (seconds) to skip in the live preview. Absolute replacement
966
+ * for the auto-computed outputLatency + lookAhead value. Pass the same value
967
+ * given to useIntegratedRecording so preview and finalized clip match.
968
+ */
969
+ latencyOffset?: number;
964
970
  };
965
971
  }
966
972
  /**
@@ -1116,6 +1122,12 @@ interface PlaylistVisualizationProps {
1116
1122
  durationSamples: number;
1117
1123
  peaks: (Int8Array | Int16Array)[];
1118
1124
  bits: 8 | 16;
1125
+ /**
1126
+ * Latency offset (seconds) to skip in the live preview. Absolute replacement
1127
+ * for the auto-computed outputLatency + lookAhead value. Pass the same value
1128
+ * given to useIntegratedRecording so preview and finalized clip match.
1129
+ */
1130
+ latencyOffset?: number;
1119
1131
  };
1120
1132
  }
1121
1133
  /**
package/dist/index.js CHANGED
@@ -2024,7 +2024,7 @@ var WaveformPlaylistProvider = ({
2024
2024
  tracksRef.current = tracks;
2025
2025
  const isEngineTracks = tracks === engineTracksRef.current;
2026
2026
  const prevTracks = prevTracksRef.current;
2027
- const isIncrementalAdd = engineRef.current !== null && prevTracks.length > 0 && tracks.length > prevTracks.length && prevTracks.every((pt) => {
2027
+ const isIncrementalAdd = engineRef.current !== null && tracks.length > prevTracks.length && prevTracks.every((pt) => {
2028
2028
  const current = tracks.find((t) => t.id === pt.id);
2029
2029
  return current === pt;
2030
2030
  });
@@ -2137,12 +2137,10 @@ var WaveformPlaylistProvider = ({
2137
2137
  setTrackStates([]);
2138
2138
  setPeaksDataArray([]);
2139
2139
  if (engineRef.current) {
2140
- engineRef.current.dispose();
2141
- engineRef.current = null;
2142
- adapterRef.current = null;
2140
+ engineRef.current.setTracks([]);
2141
+ prevTracksRef.current = tracks;
2142
+ return;
2143
2143
  }
2144
- prevTracksRef.current = tracks;
2145
- return;
2146
2144
  }
2147
2145
  const wasPlaying = isPlayingRef.current;
2148
2146
  const resumePosition = currentTimeRef.current;
@@ -4461,13 +4459,12 @@ var PlaylistVisualization = ({
4461
4459
  );
4462
4460
  }),
4463
4461
  (recordingState == null ? void 0 : recordingState.isRecording) && recordingState.trackId === track.id && ((_d2 = recordingState.peaks[0]) == null ? void 0 : _d2.length) > 0 && (() => {
4464
- const outputLatency = getOutputLatency();
4465
- const lookAhead = getLookAhead();
4466
- const latencyOffsetSamples = (0, import_core4.audibleLatencySamples)(
4467
- outputLatency,
4468
- lookAhead,
4462
+ const latencyOffsetSamples = (0, import_core4.resolveRecordingOffsetSamples)({
4463
+ overrideSeconds: recordingState.latencyOffset,
4464
+ outputLatency: getOutputLatency(),
4465
+ lookAhead: getLookAhead(),
4469
4466
  sampleRate
4470
- );
4467
+ });
4471
4468
  const latencyPixels = Math.floor(latencyOffsetSamples / samplesPerPixel);
4472
4469
  const skipPeakElements = latencyPixels * 2;
4473
4470
  const previewDuration = Math.max(