Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-react-uikit-v7.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Class | CometChatSoundManager |
| Package | @cometchat/chat-uikit-react |
| Sound types | incomingMessage, outgoingMessage, incomingMessageFromOther, incomingCall, outgoingCall |
| Custom sounds | Pass URL as second argument: CometChatSoundManager.play('incomingMessage', '/my-sound.mp3') |
| Disable | Use disableSoundForMessages / disableSoundForCalls in config prop |
Overview
CometChatSoundManager handles audio notifications for chat events. It plays sounds when messages are sent/received and when calls are initiated/received. Components use it internally — you don’t need to call it manually unless you want custom behavior.
Sound Types
| Type | When it plays | Loops |
|---|---|---|
outgoingMessage | User sends a message | No |
incomingMessage | Message received in the active conversation | No |
incomingMessageFromOther | Message received in a different conversation | No |
incomingCall | Incoming call notification | Yes |
outgoingCall | Outgoing call ringing | Yes |
Disabling Sounds
Use theconfig prop on CometChatProvider:
disableSoundForMessages on CometChatConversations and CometChatMessageComposer.
Custom Sound URLs
Replace default sounds with your own audio files:API Reference
Static Methods
| Method | Signature | Description |
|---|---|---|
play | (sound: SoundType, customUrl?: string) => void | Play a sound (with optional custom URL) |
pause | () => void | Stop the currently playing sound |
onOutgoingMessage | (customUrl?: string) => void | Play outgoing message sound |
onIncomingMessage | (customUrl?: string) => void | Play incoming message sound |
onIncomingOtherMessage | (customUrl?: string) => void | Play incoming message from other conversation |
onIncomingCall | (customUrl?: string) => void | Play incoming call sound (loops) |
onOutgoingCall | (customUrl?: string) => void | Play outgoing call sound (loops) |
Browser Autoplay Policy
Browsers require user interaction before playing audio.CometChatSoundManager checks navigator.userActivation before attempting playback. If the user hasn’t interacted with the page yet, sounds are silently skipped.
SSR Safety
AllAudio API usage is guarded behind typeof Audio !== 'undefined' checks. The sound manager is safe to import in server-side rendering environments — it simply no-ops when Audio is unavailable.