AI Integration Quick Reference
AI Integration Quick Reference
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
Disabling & Customizing Sounds
Sound behavior can be configured at two levels:- Global config — Set on
CometChatProvidervia theconfigprop. Applies to all components. - Component props — Set directly on individual components. Takes precedence over global config.
Global Config
Use theconfig prop on CometChatProvider to control sound behavior across all components:
Component-Level Props (Override)
Individual components accept the same props. When set, they override the global config for that component only.Component-level props always take precedence over the global config. If a prop is not set on a component, it falls back to the global config value.
Custom Sound URLs
Replace default sounds with your own audio files:API Reference
Static Methods
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.