Skip to main content

Overview

The SoundManager is a helper class responsible for managing and playing various types of audio in the CometChat V6 UI Kit. This includes sound events for incoming and outgoing messages and calls.

Methods

Play Sound

The SoundManager plays pre-defined or custom sounds based on user interactions with the chat interface.
// Play default sounds:
SoundManager().play(sound: Sound.incomingMessage);
SoundManager().play(sound: Sound.outgoingMessage);

Stop Sound

Stop any sound currently being played:
SoundManager().stop();

Usage

Play a custom sound:
SoundManager().play(sound: Sound.outgoingMessage, customSound: "assetPath");

Sound Enum Reference

SoundAsset
incomingMessageassets/sound/incoming_message.wav
outgoingMessageassets/sound/outgoing_message.wav
incomingMessageFromOtherassets/sound/incoming_message.wav
outgoingCallassets/sound/outgoing_call.wav
incomingCallassets/sound/incoming_call.wav
In V6, the CometChatConversations widget provides disableSoundForMessages and customSoundForMessages properties to control sound behavior at the widget level.