BarrageStore provides a complete set of barrage management APIs, including sending text barrages, sending custom barrages, and adding local tip messages. Through this class, you can implement barrage interaction functionality in live rooms.BarrageStore instance, which requires a valid live room ID.Property | Type | Description |
messageList | Barrage message list of the current room, supports real-time updates and can be subscribed to. |
Function | Description |
Create barrage management instance. | |
Custom message event publisher. | |
Send text barrage. | |
Send custom barrage. | |
Add local tip message. |
abstract fun sendTextMessage(text: String?,extensionInfo: Map<String, String>?,completion: CompletionHandler?)
Parameter | Type | Required | Description |
text | String? | Required | Text barrage content. |
extensionInfo | Map<String, String>? | Required | Extension information, can contain custom fields (such as specifying barrage color, font size, etc.). |
completion | CompletionHandler? | Required | Completion callback (success/failure status). |
abstract fun sendCustomMessage(businessID: String?,data: String?,completion: CompletionHandler?)
Parameter | Type | Required | Description |
businessID | String? | Required | Business identifier ID, used to distinguish custom barrages from different business scenarios. |
data | String? | Required | Custom data content, usually JSON format string, used to pass business custom data. |
completion | CompletionHandler? | Required | Completion callback (success/failure status). |
abstract fun appendLocalTip(message: Barrage)
Parameter | Type | Required | Description |
message | Required | Local barrage message (such as system tips, operation feedback, etc., visible only to the current user). |
Enum Value | Value | Description |
TEXT | 0 | Text type barrage, contains plain text content. |
CUSTOM | 1 | Custom type barrage, supports business custom data format (such as barrages with special effects, interactive messages, etc.). |
Property | Type | Description |
liveID | String | Unique identifier ID of the live room/voice chat room the barrage belongs to. |
sender | LiveUserInfo | User information of the barrage sender (such as user ID, nickname, avatar, etc.). |
sequence | Long | Unique sequence ID of the barrage message, used for message sorting and deduplication. |
timestampInSecond | Long | Barrage sending timestamp (unit: seconds), used to display sending time order. |
messageType | Barrage message type (text or custom). | |
textContent | String | Message content of text type barrage, i.e., the text content of the barrage. |
extensionInfo | Map<String, String> | Barrage extension information, customizable fields (such as display style, priority, etc.). Valid when messageType is TEXT. |
businessID | String | Business identifier ID of custom type barrage, used to distinguish custom barrages from different business scenarios. |
data | String | Specific data content of custom type barrage (usually JSON format string), valid when messageType is CUSTOM. |
Property | Type | Description |
messageList | Barrage message list of the current room, supports real-time updates and can be subscribed to. |
フィードバック