Skip to content

The swiss army knife of lossless video/audio editing

Feat: Maintain previous volume when toggling mute

Michael Yaworskie3c333a08675
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 25a1b3c3..dc53061f 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -218,9 +218,16 @@ function App() {
}
}, [detectedFileFormat, outFormatLocked, setFileFormat, setOutFormatLocked]);
+ const previousPlaybackVolume = useRef(playbackVolume);
const toggleMuted = useCallback(() => {
- setPlaybackVolume(playbackVolume === 0 ? 1 : 0);
- }, [playbackVolume, setPlaybackVolume]);
+ setPlaybackVolume(volume => {
+ if (volume === 0) {
+ return previousPlaybackVolume.current || 1;
+ }
+ previousPlaybackVolume.current = volume;
+ return 0;
+ });
+ }, [setPlaybackVolume]);
const toggleShowThumbnails = useCallback(() => setThumbnailsEnabled((v) => !v), []);