Skip to main content

Sound Manager

CometChatSoundManager provides functionalities for managing audio playback for incoming / outgoing messages in 1:1 or group chat.

Audio resources

NameDescription
incomingMessageThe audio resource for an incoming message in an active chat
outgoingMessageThe audio resource for an outgoing message
incomingMessageFromOtherThe audio resource for an incoming message received in an inactive chat
incomingCallThe audio resource for an incoming call in an active 1:1 or group chat
outgoingCallThe audio resource for outgoing call in an active 1:1 or group chat

Methods

play

CometChatSoundManager.play method plays the in-built sounds audio resources for the above mentioned enum cases. It also allows for customisation of the audio resources. You can pass a mp3 file asset path of your choice.

NameDescription
playThis method plays the above mentioned audio resources.

pause

CometChatSoundManager.pause method pauses the ongoing audio resource for calls or messages

NameDescription
pauseThis method pauses the already being played audio resource.

Usage

//Trigger the audio sound for an incoming message
CometChatSoundManager.play(Sound.incomingMessage);

//Trigger the audio sound of your choice for an incoming message
CometChatSoundManager.play(Sound.incomingMessage, "MP3_FILE_ASSET_PATH");

//Pause the ongoing audio sound
CometChatSoundManager.pause();