Skip to content

Commit

Permalink
fix: stop playing audio when a chat is changed(by stopping audio on u…
Browse files Browse the repository at this point in the history
…nmount) (#171)
  • Loading branch information
ProCode2 authored Jan 18, 2024
1 parent c744781 commit a9970f8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/chatblock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ export default function ChatBlock(props: {
const interval = setInterval(() => {
setPercentagePlayed((audio.currentTime / audio.duration) * 100);
}, 10);
return () => clearInterval(interval);
return () => {
stopAudio();
clearInterval(interval);
};
}
}, [audio]);

Expand Down

0 comments on commit a9970f8

Please sign in to comment.