Bug Description
When a voice/audio message is playing and the user switches to a different
chat, the audio continues playing in the background with no way to stop it.
This is caused by a missing audio.pause() call in the cleanup function
of AudioMessage.jsx. The React component gets unmounted but the
HTMLAudioElement is never paused.
Steps to Reproduce
- Open any chat that contains a voice/audio message
- Press the ▶️ Play button on the audio message
- While the audio is still playing, click on a different user in the sidebar
- Audio keeps playing in the background even though you switched chats
Expected Behavior
The audio should automatically stop/pause when the user navigates away
from the chat. When the user returns to the same chat, the audio should
be reset to the beginning.
Screenshots
N/A — can be reproduced by playing any voice message and switching chats.
Environment
- File:
frontend/src/components/AudioMessage.jsx (line 22–27)
- OS: Any
- Browser: All browsers (Chrome, Firefox, Edge, Safari)
Bug Description
When a voice/audio message is playing and the user switches to a different
chat, the audio continues playing in the background with no way to stop it.
This is caused by a missing
audio.pause()call in the cleanup functionof
AudioMessage.jsx. The React component gets unmounted but theHTMLAudioElement is never paused.
Steps to Reproduce
Expected Behavior
The audio should automatically stop/pause when the user navigates away
from the chat. When the user returns to the same chat, the audio should
be reset to the beginning.
Screenshots
N/A — can be reproduced by playing any voice message and switching chats.
Environment
frontend/src/components/AudioMessage.jsx(line 22–27)