Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix: clear stale peaks before decoding a new source

Davide Mendoliaf19d1bc66887
diff --git a/src/hooks/useAudioPeaks.ts b/src/hooks/useAudioPeaks.ts
index 18de90a54..38875370b 100644
--- a/src/hooks/useAudioPeaks.ts
+++ b/src/hooks/useAudioPeaks.ts
@@ -70,6 +70,7 @@ export function useAudioPeaks(videoUrl?: string): Float32Array | null {
return;
}
+ setPeaks(null);
let cancelled = false;
(async () => {
@@ -83,7 +84,8 @@ export function useAudioPeaks(videoUrl?: string): Float32Array | null {
cacheRef.current.set(videoUrl, p);
setPeaks(p);
} catch {
- // No audio track or unsupported format — silent degradation.
+ // No audio track or unsupported format — clear stale data silently.
+ if (!cancelled) setPeaks(null);
}
})();