Skip to content

[BUG] Audio message continues playing in background after switching chats #134

Description

@mann2007-ptl

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

  1. Open any chat that contains a voice/audio message
  2. Press the ▶️ Play button on the audio message
  3. While the audio is still playing, click on a different user in the sidebar
  4. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions