Skip to content

Commit

Permalink
Do not set repeat mode if backend is not yet ready
Browse files Browse the repository at this point in the history
  • Loading branch information
druzsan committed Aug 2, 2024
1 parent 75a685a commit 936b920
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/shared/AudioViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,19 @@ const AudioViewer = ({
]);

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(waveform.current?.backend as any).media.loop = repeat;
if (isReady && autoplay && !waveform.current?.isPlaying()) {
switchActiveWidget();
waveform.current?.play();
}
}, [isReady, autoplay, repeat]);
}, [isReady, autoplay]);

useEffect(() => {
const backend = waveform.current?.backend;
if (backend) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(backend as any).media.loop = repeat;
}
}, [isReady, repeat]);

useEffect(() => {
if (!waveform.current?.isReady) return;
Expand Down

0 comments on commit 936b920

Please sign in to comment.