AI Integration Quick Reference
AI Integration Quick Reference
Overview
CometChatAudiosBubble renders audio file attachment(s) as stacked playback cards. It is self-extracting: pass the SDK message and the bubble derives the audio attachments and caption itself.
This is the multi-attachment replacement for CometChatAudioBubble when dealing with attached audio files. It renders when enableMultipleAttachments is true (the default in v7) and the audio message does not have audioType: "voice_note" in its metadata. When the prop is false, the legacy CometChatAudioBubble is used for all audio.
Audio files vs Voice notes. The audio plugin routes messages by the
audioType metadata key:- No
audioType(attached audio files) →CometChatAudiosBubble(this component) audioType: "voice_note"(recorded via voice recorder) → CometChatVoiceNoteBubble
- Stacked audio cards — one card per audio attachment with filename, play/pause, seekable slider, elapsed/total time
- Inline playback — plays audio directly in the bubble without a fullscreen viewer
- Download button — download individual audio files
- Batch position awareness — adjusts corner radius based on position within a multi-message batch group
- Caption support — optional caption rendered below the cards
Usage
Audio Card Layout
Each attachment renders as a card with:| Element | Description |
|---|---|
| Play/Pause button | Toggles playback for that audio file |
| Filename | Display name of the audio file |
| Seek slider | Seekable progress bar showing current position |
| Time display | currentTime / totalDuration in m:ss format |
| Download button | Downloads the audio file |
Batch Position
When multiple media messages are sent together (sharing the samebatchId), each message receives a batchPosition that controls its visual grouping:
| Position | Behavior |
|---|---|
first | Rounded top corners, flat bottom |
middle | Flat top and bottom (tight grouping) |
last | Flat top, rounded bottom corners |
single | All corners rounded (standalone message) |
batchPosition is computed automatically by the message list. You only need to pass it when using the bubble standalone outside of CometChatMessageList.
Props
message
The audio message. The bubble extracts its attachments and caption from it. Required.| Type | CometChat.MediaMessage |
| Required | Yes |
alignment
Override incoming/outgoing alignment. Defaults to sender-vs-logged-in-user.| Type | "left" | "right" |
| Default | derived |
textFormatters
Text formatters applied to the caption (mentions, URLs).| Type | CometChatTextFormatter[] |
| Default | undefined |
batchPosition
Position within a multi-attachment batch group. Controls corner-radius styling.| Type | "first" | "middle" | "last" | "single" |
| Default | undefined |
className
Additional CSS class applied to the root element.| Type | string |
| Default | undefined |
CSS Selectors
| Target | Selector |
|---|---|
| Root | .cometchat-audios-bubble |
| Incoming variant | .cometchat-audios-bubble--incoming |
| Outgoing variant | .cometchat-audios-bubble--outgoing |
| Container | .cometchat-audios-bubble__container |
| Multi-card container | .cometchat-audios-bubble__container--multi |
| Audio card | .cometchat-audios-bubble__card |
| Play button | .cometchat-audios-bubble__play-btn |
| Play button icon | .cometchat-audios-bubble__play-btn-icon |
| Card body (name + slider + time) | .cometchat-audios-bubble__body |
| Filename | .cometchat-audios-bubble__name |
| Seek slider | .cometchat-audios-bubble__slider |
| Time display | .cometchat-audios-bubble__time |
| Expand/collapse toggle | .cometchat-audios-bubble__toggle |
| Caption | .cometchat-audios-bubble__caption |
Relationship to Legacy Audio Bubble
CometChatAudioBubble (legacy) | CometChatAudiosBubble (v7 multi-attachment) | |
|---|---|---|
| Used when | enableMultipleAttachments: false | enableMultipleAttachments: true + no audioType: "voice_note" |
| Multiple attachments | No | Yes (stacked cards) |
| Batch grouping | No | Yes (batchPosition prop) |
| Audio routing | All audio messages | Only attached audio files (not voice notes) |
Next Steps
Voice Note Bubble
Waveform bubble for recorded voice notes
Audio Bubble (Legacy)
Single-attachment audio bubble
Files Bubble
Multi-attachment file bubble
Message Composer
Enable multi-attachment staging tray