@tencent-rtc/mcp 1.6.4 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/knowledge/chunker.js +83 -54
  2. package/knowledge/path-meta.js +179 -26
  3. package/knowledge/search/exact-lookup.js +168 -10
  4. package/knowledge/search/filter-pool.js +73 -19
  5. package/knowledge/search/product-scope-intent.js +2 -2
  6. package/knowledge/search/requires-framework.js +2 -2
  7. package/knowledge/search/search-knowledge.js +247 -61
  8. package/package.json +1 -1
  9. package/resource/index/manifest.json +1 -1
  10. package/resource/integration/callkit/preset/android/integration.md +2 -4
  11. package/resource/integration/callkit/preset/flutter/integration.md +4 -5
  12. package/resource/integration/callkit/preset/ios/integration.md +1 -4
  13. package/resource/integration/callkit/preset/react/integration.md +13 -20
  14. package/resource/integration/callkit/preset/vue/integration.md +14 -21
  15. package/resource/integration/chat/preset/android/integration.md +6 -9
  16. package/resource/integration/chat/preset/flutter/integration.md +9 -12
  17. package/resource/integration/chat/preset/ios/integration.md +2 -4
  18. package/resource/integration/chat/preset/react/integration.md +0 -10
  19. package/resource/integration/livekit/preset/live/android/live-audience-integration.md +129 -0
  20. package/resource/integration/livekit/preset/live/android/live-host-integration.md +219 -0
  21. package/resource/integration/livekit/preset/live/android/live-list-integration.md +261 -0
  22. package/resource/integration/livekit/preset/live/android/prepare-integration.md +254 -0
  23. package/resource/integration/livekit/preset/live/ios/live-audience-integration.md +202 -0
  24. package/resource/integration/livekit/preset/live/ios/live-host-integration.md +369 -0
  25. package/resource/integration/livekit/preset/live/ios/live-list-integration.md +229 -0
  26. package/resource/integration/livekit/preset/live/ios/prepare-integration.md +204 -0
  27. package/resource/integration/livekit/preset/live/vue/live-list-integration.md +0 -3
  28. package/resource/integration/livekit/preset/live/vue/live-player-desk-integration.md +0 -5
  29. package/resource/integration/livekit/preset/live/vue/live-player-h5-integration.md +0 -6
  30. package/resource/integration/livekit/preset/live/vue/live-pusher-integration.md +5 -10
  31. package/resource/integration/roomkit/preset/vue/integration.md +0 -4
  32. package/resource/knowledge/callkit/best-practice/web/callengine-invitation.md +80 -0
  33. package/resource/knowledge/callkit/best-practice/web/callengine-log-control.md +24 -0
  34. package/resource/knowledge/callkit/best-practice/web/callkit-call-vs-calls.md +116 -0
  35. package/resource/knowledge/callkit/core-sdk/android/answer-call.md +7 -8
  36. package/resource/knowledge/callkit/core-sdk/android/make-call.md +5 -7
  37. package/resource/knowledge/callkit/core-sdk/android/offline-push.md +3 -5
  38. package/resource/knowledge/callkit/core-sdk/flutter/answer-call.md +2 -6
  39. package/resource/knowledge/callkit/core-sdk/flutter/make-call.md +2 -6
  40. package/resource/knowledge/callkit/core-sdk/flutter/offline-push.md +4 -9
  41. package/resource/knowledge/callkit/core-sdk/ios/answer-call.md +1 -4
  42. package/resource/knowledge/callkit/core-sdk/ios/make-call.md +8 -11
  43. package/resource/knowledge/callkit/core-sdk/ios/offline-push.md +17 -23
  44. package/resource/knowledge/callkit/core-sdk/web/call-engine.md +33 -0
  45. package/resource/knowledge/callkit/core-sdk/web/call-event.md +327 -0
  46. package/resource/knowledge/callkit/core-sdk/web/callengine-api-overview.md +33 -0
  47. package/resource/knowledge/callkit/faq/android.md +0 -2
  48. package/resource/knowledge/callkit/faq/error-code.md +0 -2
  49. package/resource/knowledge/callkit/faq/flutter.md +2 -2
  50. package/resource/knowledge/callkit/faq/ios.md +3 -5
  51. package/resource/knowledge/callkit/faq/web.md +2 -3
  52. package/resource/knowledge/callkit/preset/android/api.md +2 -5
  53. package/resource/knowledge/callkit/preset/ios/api.md +0 -2
  54. package/resource/knowledge/callkit/preset/react/api.md +445 -0
  55. package/resource/knowledge/callkit/preset/react/uikit-api-reference.md +445 -0
  56. package/resource/knowledge/callkit/preset/vue/api.md +465 -0
  57. package/resource/knowledge/callkit/preset/vue/uikit-api-reference.md +465 -0
  58. package/resource/knowledge/chat/best-practice/web/image-message-url-handling.md +16 -0
  59. package/resource/knowledge/chat/preset/android/features/chat-setting.md +1 -1
  60. package/resource/knowledge/chat/preset/android/features/conversation-list.md +1 -1
  61. package/resource/knowledge/chat/preset/android/features/language.md +0 -1
  62. package/resource/knowledge/chat/preset/android/features/message-input.md +1 -1
  63. package/resource/knowledge/chat/preset/android/features/message-list.md +2 -3
  64. package/resource/knowledge/chat/preset/android/features/search.md +0 -1
  65. package/resource/knowledge/chat/preset/android/features/theme.md +1 -1
  66. package/resource/knowledge/chat/preset/android-view/integration.md +3 -11
  67. package/resource/knowledge/chat/preset/flutter/features/conversation-list.md +0 -1
  68. package/resource/knowledge/chat/preset/flutter/features/message-list.md +1 -2
  69. package/resource/knowledge/chat/preset/flutter/features/search.md +5 -6
  70. package/resource/knowledge/chat/preset/flutter/features/theme.md +2 -2
  71. package/resource/knowledge/chat/preset/ios/features/chat-setting.md +1 -1
  72. package/resource/knowledge/chat/preset/ios/features/conversation-list.md +1 -2
  73. package/resource/knowledge/chat/preset/ios/features/message-list.md +1 -2
  74. package/resource/knowledge/chat/preset/ios/features/search.md +0 -1
  75. package/resource/knowledge/chat/preset/ios-uikit/integration.md +13 -15
  76. package/resource/knowledge/chat/preset/react/features/conversation-list.md +5 -5
  77. package/resource/knowledge/chat/preset/react/features/message-input.md +2 -3
  78. package/resource/knowledge/chat/preset/react/features/search.md +0 -1
  79. package/resource/knowledge/chat/preset/react/features/theme.md +0 -1
  80. package/resource/knowledge/chat/urls/sdk/android.md +3 -3
  81. package/resource/knowledge/chat/urls/sdk/flutter.md +3 -3
  82. package/resource/knowledge/chat/urls/sdk/ios.md +3 -3
  83. package/resource/knowledge/chat/urls/sdk/web.md +3 -3
  84. package/resource/knowledge/livekit/core-sdk/api-reference/android/AudioEffectStore.md +7 -14
  85. package/resource/knowledge/livekit/core-sdk/api-reference/android/BarrageStore.md +5 -8
  86. package/resource/knowledge/livekit/core-sdk/api-reference/android/BattleStore.md +15 -18
  87. package/resource/knowledge/livekit/core-sdk/api-reference/android/CameraView.md +1 -2
  88. package/resource/knowledge/livekit/core-sdk/api-reference/android/CoGuestStore.md +15 -20
  89. package/resource/knowledge/livekit/core-sdk/api-reference/android/CoHostStore.md +10 -13
  90. package/resource/knowledge/livekit/core-sdk/api-reference/android/DeviceStore.md +2 -4
  91. package/resource/knowledge/livekit/core-sdk/api-reference/android/GiftStore.md +4 -6
  92. package/resource/knowledge/livekit/core-sdk/api-reference/android/LikeStore.md +2 -4
  93. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveAudienceStore.md +2 -4
  94. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveCoreView.md +1 -2
  95. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveSeatStore.md +8 -10
  96. package/resource/knowledge/livekit/core-sdk/api-reference/android/LoginStore.md +5 -7
  97. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/AudioEffectStore.md +7 -14
  98. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BarrageStore.md +6 -9
  99. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BaseBeautyStore.md +1 -2
  100. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BattleStore.md +15 -18
  101. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoGuestStore.md +15 -20
  102. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoHostStore.md +10 -13
  103. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/DeviceStore.md +2 -4
  104. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/GiftStore.md +4 -6
  105. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LikeStore.md +2 -4
  106. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveAudienceStore.md +2 -4
  107. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveCoreView.md +1 -2
  108. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveSeatStore.md +8 -10
  109. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LoginStore.md +3 -5
  110. package/resource/knowledge/livekit/core-sdk/api-reference/ios/AudioEffectStore.md +7 -14
  111. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BarrageStore.md +5 -8
  112. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BaseBeautyStore.md +1 -2
  113. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BattleStore.md +6 -9
  114. package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoGuestStore.md +5 -10
  115. package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoHostStore.md +3 -6
  116. package/resource/knowledge/livekit/core-sdk/api-reference/ios/DeviceStore.md +2 -4
  117. package/resource/knowledge/livekit/core-sdk/api-reference/ios/GiftStore.md +4 -6
  118. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LikeStore.md +2 -4
  119. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveAudienceStore.md +2 -4
  120. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveCoreView.md +1 -2
  121. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveSeatStore.md +4 -6
  122. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LoginStore.md +3 -5
  123. package/resource/knowledge/livekit/core-sdk/api-reference/{web → vue}/index.md +24 -24
  124. package/resource/knowledge/livekit/core-sdk/{voice/android/voice-audio-effect.md → features/android/audio-effect.md} +1 -2
  125. package/resource/knowledge/livekit/core-sdk/{live/android/live-gift.md → features/android/gift.md} +2 -3
  126. package/resource/knowledge/livekit/core-sdk/{voice/android/voice-room-list.md → features/android/live-list.md} +2 -4
  127. package/resource/knowledge/livekit/core-sdk/{live/flutter/live-audio-effect.md → features/flutter/audio-effect.md} +0 -2
  128. package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-barrage.md → features/flutter/barrage.md} +2 -2
  129. package/resource/knowledge/livekit/core-sdk/{live/flutter/live-gift.md → features/flutter/gift.md} +2 -3
  130. package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-room-list.md → features/flutter/live-list.md} +1 -1
  131. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-audience-list.md → features/ios/audience-list.md} +1 -2
  132. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-audio-effect.md → features/ios/audio-effect.md} +1 -3
  133. package/resource/knowledge/livekit/core-sdk/{live/ios/live-base-beauty.md → features/ios/base-beauty.md} +2 -2
  134. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-gift.md → features/ios/gift.md} +2 -3
  135. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-room-list.md → features/ios/live-list.md} +2 -4
  136. package/resource/knowledge/livekit/core-sdk/live/android/{live-co-guest-interaction.md → co-guest-interaction.md} +0 -1
  137. package/resource/knowledge/livekit/core-sdk/live/android/{live-host-interaction.md → host-interaction.md} +5 -7
  138. package/resource/knowledge/livekit/core-sdk/live/android/{live-integration.md → integration.md} +3 -6
  139. package/resource/knowledge/livekit/core-sdk/live/flutter/{live-co-guest-interaction.md → co-guest-interaction.md} +1 -1
  140. package/resource/knowledge/livekit/core-sdk/live/flutter/{live-host-interaction.md → host-interaction.md} +0 -2
  141. package/resource/knowledge/livekit/core-sdk/live/flutter/{live-integration.md → integration.md} +1 -4
  142. package/resource/knowledge/livekit/core-sdk/live/ios/{live-co-guest-interaction.md → co-guest-interaction.md} +0 -1
  143. package/resource/knowledge/livekit/core-sdk/live/ios/{live-host-interaction.md → host-interaction.md} +2 -4
  144. package/resource/knowledge/livekit/core-sdk/live/ios/{live-integration.md → integration.md} +2 -5
  145. package/resource/knowledge/livekit/core-sdk/voice/android/{voice-host-interaction.md → host-interaction.md} +3 -5
  146. package/resource/knowledge/livekit/core-sdk/voice/android/{voice-integration.md → integration.md} +3 -6
  147. package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-co-guest-interaction.md → co-guest-interaction.md} +1 -2
  148. package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-integration.md → integration.md} +6 -9
  149. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-co-guest-interaction.md → co-guest-interaction.md} +2 -2
  150. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-host-interaction.md → host-interaction.md} +4 -6
  151. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-integration.md → integration.md} +1 -4
  152. package/resource/knowledge/livekit/preset/live/vue/features/barrage.md +0 -2
  153. package/resource/knowledge/push/api-reference/android.md +123 -0
  154. package/resource/knowledge/push/api-reference/flutter.md +176 -0
  155. package/resource/knowledge/push/api-reference/harmonyos.md +138 -0
  156. package/resource/knowledge/push/api-reference/ios.md +176 -0
  157. package/resource/knowledge/push/api-reference/react-native.md +147 -0
  158. package/resource/knowledge/push/api-reference/uni-app.md +147 -0
  159. package/resource/knowledge/push/api-reference/unity.md +119 -0
  160. package/resource/knowledge/push/api-reference/unreal-engine.md +123 -0
  161. package/resource/knowledge/push/config/android.md +4 -7
  162. package/resource/knowledge/push/config/harmonyos.md +0 -3
  163. package/resource/knowledge/push/config/ios.md +12 -20
  164. package/resource/knowledge/push/config/react-native.md +18 -26
  165. package/resource/knowledge/push/config/unity.md +20 -28
  166. package/resource/knowledge/push/config/unreal-engine.md +21 -29
  167. package/resource/knowledge/push/integration/android.md +6 -8
  168. package/resource/knowledge/push/integration/flutter.md +6 -9
  169. package/resource/knowledge/push/integration/harmonyos.md +1 -0
  170. package/resource/knowledge/push/integration/ios.md +7 -9
  171. package/resource/knowledge/push/integration/react-native.md +9 -13
  172. package/resource/knowledge/push/integration/uni-app.md +7 -7
  173. package/resource/knowledge/push/integration/unity.md +10 -13
  174. package/resource/knowledge/push/integration/unreal-engine.md +6 -9
  175. package/resource/knowledge/push/overview/prepare.md +2 -2
  176. package/resource/knowledge/roomkit/core-sdk/android/call-user-to-room.md +3 -3
  177. package/resource/knowledge/roomkit/core-sdk/android/capability-matrix.md +46 -0
  178. package/resource/knowledge/roomkit/core-sdk/android/room-participant-state.md +1 -1
  179. package/resource/knowledge/roomkit/core-sdk/android/room-state.md +2 -2
  180. package/resource/knowledge/roomkit/core-sdk/android/schedule-room.md +6 -6
  181. package/resource/knowledge/roomkit/core-sdk/android/unsupported-features.md +79 -0
  182. package/resource/knowledge/roomkit/core-sdk/flutter/capability-matrix.md +46 -0
  183. package/resource/knowledge/roomkit/core-sdk/flutter/room-participant-state.md +1 -1
  184. package/resource/knowledge/roomkit/core-sdk/flutter/unsupported-features.md +79 -0
  185. package/resource/knowledge/roomkit/core-sdk/ios/capability-matrix.md +46 -0
  186. package/resource/knowledge/roomkit/core-sdk/ios/room-participant-state.md +1 -1
  187. package/resource/knowledge/roomkit/core-sdk/ios/unsupported-features.md +79 -0
  188. package/resource/knowledge/roomkit/preset/android/integration.md +5 -7
  189. package/resource/knowledge/roomkit/preset/flutter/integration.md +2 -7
  190. package/resource/knowledge/roomkit/preset/ios/integration.md +3 -9
  191. package/resource/knowledge/roomkit/preset/react/integration.md +12 -16
  192. package/resource/knowledge/trtc/android/TRTCCloud.md +154 -238
  193. package/resource/knowledge/trtc/android/TRTCCloudDef.md +133 -134
  194. package/resource/knowledge/trtc/android/TRTCCloudListener.md +86 -120
  195. package/resource/knowledge/trtc/android/TRTCStatistics.md +10 -10
  196. package/resource/knowledge/trtc/android/TXAudioEffectManager.md +10 -30
  197. package/resource/knowledge/trtc/android/TXBeautyManager.md +25 -25
  198. package/resource/knowledge/trtc/android/TXDeviceManager.md +2 -2
  199. package/resource/knowledge/trtc/android/TXLiteAVCode.md +12 -12
  200. package/resource/knowledge/trtc/c++/ITRTCCloud.md +166 -261
  201. package/resource/knowledge/trtc/c++/ITRTCStatistics.md +12 -12
  202. package/resource/knowledge/trtc/c++/ITXAudioEffectManager.md +10 -30
  203. package/resource/knowledge/trtc/c++/ITXDeviceManager.md +9 -11
  204. package/resource/knowledge/trtc/c++/TRTCCloudCallback.md +96 -130
  205. package/resource/knowledge/trtc/c++/TRTCTypeDef.md +122 -123
  206. package/resource/knowledge/trtc/c++/TXLiteAVCode.md +12 -12
  207. package/resource/knowledge/trtc/ios/TRTCCloud.md +168 -255
  208. package/resource/knowledge/trtc/ios/TRTCCloudDef.md +124 -125
  209. package/resource/knowledge/trtc/ios/TRTCCloudDelegate.md +89 -124
  210. package/resource/knowledge/trtc/ios/TRTCStatistics.md +10 -10
  211. package/resource/knowledge/trtc/ios/TXAudioEffectManager.md +9 -28
  212. package/resource/knowledge/trtc/ios/TXBeautyManager.md +25 -25
  213. package/resource/knowledge/trtc/ios/TXDeviceManager.md +9 -11
  214. package/resource/knowledge/trtc/ios/TXLiteAVCode.md +12 -12
  215. package/server.js +21 -21
  216. package/tools/common/finalize_answer.js +1 -1
  217. package/tools/common/present_framework_choice.js +2 -2
  218. package/tools/common/search_trtc_knowledge.js +3 -3
  219. package/tools/common/submit_feedback.js +1 -1
  220. package/tools/definitions/get_native_live_uikit_integration_def.js +61 -0
  221. package/tools/definitions/get_native_livekit_core_integration_def.js +3 -3
  222. package/tools/definitions/present_framework_choice_def.js +2 -2
  223. package/tools/definitions/search_trtc_knowledge_def.js +5 -5
  224. package/tools/index.js +2 -0
  225. package/tools/live/get_native_live_uikit_integration.js +69 -0
  226. package/tools/live/get_native_livekit_core_integration.js +6 -6
  227. package/utils/report-cls-client.js +1 -1
  228. package/utils/report-es-client.js +1 -1
  229. package/resource/knowledge/callkit/preset/web/api.md +0 -83
  230. package/resource/knowledge/livekit/core-sdk/live/android/live-audio-effect.md +0 -226
  231. package/resource/knowledge/livekit/core-sdk/live/android/live-live-list.md +0 -438
  232. package/resource/knowledge/livekit/core-sdk/live/flutter/live-barrage.md +0 -490
  233. package/resource/knowledge/livekit/core-sdk/live/flutter/live-live-list.md +0 -726
  234. package/resource/knowledge/livekit/core-sdk/live/ios/live-audience-list.md +0 -264
  235. package/resource/knowledge/livekit/core-sdk/live/ios/live-audio-effect.md +0 -216
  236. package/resource/knowledge/livekit/core-sdk/live/ios/live-gift.md +0 -407
  237. package/resource/knowledge/livekit/core-sdk/live/ios/live-live-list.md +0 -349
  238. package/resource/knowledge/livekit/core-sdk/voice/android/voice-audience-list.md +0 -269
  239. package/resource/knowledge/livekit/core-sdk/voice/android/voice-barrage.md +0 -456
  240. package/resource/knowledge/livekit/core-sdk/voice/android/voice-gift.md +0 -455
  241. package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audience-list.md +0 -260
  242. package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audio-effect.md +0 -598
  243. package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-gift.md +0 -424
  244. package/resource/knowledge/livekit/core-sdk/voice/ios/voice-barrage.md +0 -408
  245. /package/resource/knowledge/livekit/core-sdk/{live/android/live-audience-list.md → features/android/audience-list.md} +0 -0
  246. /package/resource/knowledge/livekit/core-sdk/{live/android/live-barrage.md → features/android/barrage.md} +0 -0
  247. /package/resource/knowledge/livekit/core-sdk/{live/android/live-base-beauty.md → features/android/base-beauty.md} +0 -0
  248. /package/resource/knowledge/livekit/core-sdk/{live/flutter/live-audience-list.md → features/flutter/audience-list.md} +0 -0
  249. /package/resource/knowledge/livekit/core-sdk/{live/flutter/live-base-beauty.md → features/flutter/base-beauty.md} +0 -0
  250. /package/resource/knowledge/livekit/core-sdk/{live/ios/live-barrage.md → features/ios/barrage.md} +0 -0
  251. /package/resource/knowledge/livekit/core-sdk/voice/android/{voice-co-guest-interaction.md → co-guest-interaction.md} +0 -0
@@ -1,490 +0,0 @@
1
- This guide shows how to use the `BarrageStore` module in the `AtomicXCore` framework to quickly add a robust, high-performance barrage (live chat overlay) system to your live streaming app.
2
-
3
- ## Core Features
4
-
5
- `BarrageStore` delivers a complete live comment solution for live streaming apps. Key features include:
6
- - Receiving and displaying live comments in the live room.
7
-
8
- - Sending live comments to engage with your audience.
9
-
10
- - Sending custom live comments to support advanced scenarios such as gifts, likes, and more.
11
-
12
- - Inserting system tips into the local message list (e.g., "Welcome to the live room").
13
-
14
- ## Core Concepts
15
-
16
- |**Core Concept**|**Type**|**Core Responsibility and Description**|
17
- |---------|---------|---------|
18
- |[Barrage](https://tencent-rtc.github.io/TUIKit_Flutter/api_barrage_barrage_store/Barrage-class.html)|`class`|Represents a data model for a live comments. It contains all key information such as sender information (`sender`), message content (`textContent` or `data`), and message type (`messageType`).|
19
- |[BarrageState](https://tencent-rtc.github.io/TUIKit_Flutter/api_barrage_barrage_store/BarrageState-class.html)|`class`|Represents the current status of the live comment module. Its core attribute `messageList` is a `ValueListenable<List<Barrage>>`, storing all live comments in the live streaming room in chronological order, serving as the data source for UI rendering.|
20
- |[BarrageStore](https://tencent-rtc.github.io/TUIKit_Flutter/api_barrage_barrage_store/BarrageStore-class.html)|`class`|The central manager for live comments. Use it to send messages (`sendTextMessage`, `sendCustomMessage`) and listen to its `barrageState.messageList` property to receive and track all live comments updates.|
21
-
22
- ## Implementation Steps
23
-
24
- ### Step 1: Integrate the Component
25
- - **Live streaming**: Refer to quick integration for seamless integration with **AtomicXCore** and service access.
26
-
27
- - **Voice chat room**: Refer to quick integration for seamless integration with **AtomicXCore** and service access.
28
-
29
- Return to the current project after integration.
30
-
31
- ### Step 2: Initialize and Listen for Live Comment Updates
32
-
33
- Create a `BarrageStore` instance bound to the current live room's `liveId`, and set up a listener to receive real-time updates of the complete live comment list.
34
- ``` java
35
- import 'package:flutter/foundation.dart';
36
- import 'package:atomic_x_core/atomicxcore.dart';
37
-
38
- class BarrageManager {
39
- final String liveId;
40
- late final BarrageStore barrageStore;
41
- late final VoidCallback _messageListChangedListener = _onMessageListChanged;
42
-
43
- // Expose message list change notification to the public
44
- final ValueNotifier<List<Barrage>> messagesNotifier =
45
- ValueNotifier<List<Barrage>>([]);
46
-
47
- BarrageManager({required this.liveId}) {
48
- // 1. Get the singleton of BarrageStore by liveId (location parameter)
49
- barrageStore = BarrageStore.create(liveId);
50
-
51
- // 2. Start listening to the bullet screen immediately after initialization
52
- _subscribeToBarrageUpdates();
53
- }
54
-
55
- void _subscribeToBarrageUpdates() {
56
- // 3. Use ValueListenable's addListener to listen for messages list adjustment
57
- barrageStore.barrageState.messageList.addListener(_messageListChangedListener);
58
- }
59
-
60
- void _onMessageListChanged() {
61
- // 4. When the messageList is updating, get the new list and notify the UI layer
62
- // Key point: The complete list obtained here contains ALL historical messages
63
- messagesNotifier.value = barrageStore.barrageState.messageList.value;
64
- }
65
-
66
- void dispose() {
67
- barrageStore.barrageState.messageList.removeListener(_messageListChangedListener);
68
- messagesNotifier.dispose();
69
- }
70
- }
71
- ```
72
-
73
- ### Step 3: Send a Live Comment
74
-
75
- Call the `sendTextMessage` method to broadcast a live comment to all users in the live streaming room.
76
- ``` java
77
- extension BarrageManagerSend on BarrageManager {
78
- Send a text bullet screen
79
- Future<void> sendTextMessage(String text) async {
80
- // Recommendation: Add non-null verification to avoid sending invalid messages.
81
- if (text.isEmpty) {
82
- debugPrint("Bullet screen content cannot be empty");
83
- return;
84
- }
85
-
86
- // Call this API to send a message
87
- final result = await barrageStore.sendTextMessage(
88
- text: text,
89
- extensionInfo: null,
90
- );
91
-
92
- // Use isSuccess to check the result
93
- if (result.isSuccess) {
94
- debugPrint("Bullet screen text '$text' sent successfully");
95
- } else {
96
- debugPrint("Bullet screen text sending failure: ${result.errorMessage}");
97
- }
98
- }
99
- }
100
- ```
101
-
102
- **API parameters:**
103
-
104
- |**Parameter**|**Type**|**Description**|
105
- |---------|---------|---------|
106
- |`text`|`String`|The text content to be sent.|
107
- |`extensionInfo`|`Map<String, String>?`|Additional extension info.|
108
-
109
- ### Step 4: Send Custom Live Comments
110
-
111
- Send messages containing custom business data, such as gifts or likes. These messages are invisible to other clients and must be parsed by your business logic.
112
- ``` java
113
- import 'dart:convert';
114
-
115
- extension BarrageManagerCustom on BarrageManager {
116
- /// Send a custom barrage item, for example for sending a gift
117
- Future<void> sendGiftMessage({
118
- required String giftId,
119
- required int giftCount,
120
- }) async {
121
- // 1. Define a business ID
122
- const businessID = "live_gift";
123
-
124
- // 2. Encode business data as a JSON string
125
- final giftData = {"gift_id": giftId, "gift_count": giftCount};
126
- final jsonString = jsonEncode(giftData);
127
-
128
- // 3. Call this API to send custom messages
129
- final result = await barrageStore.sendCustomMessage(
130
- businessID: businessID,
131
- data: jsonString,
132
- );
133
-
134
- if (result.isSuccess) {
135
- debugPrint("Gift message (custom barrage item) sent successfully");
136
- } else {
137
- debugPrint("Gift message send fail: ${result.errorMessage}");
138
- }
139
- }
140
- }
141
- ```
142
-
143
- **API parameters:**
144
-
145
- |**Parameter**|**Type**|**Description**|
146
- |---------|---------|---------|
147
- |`businessID`|`String`|Unique business identifier (e.g., "live_gift") to distinguish custom messages.|
148
- |`data`|`String`|Business data, typically a JSON-formatted string.|
149
-
150
- ### Step 5: Insert Local Tip Messages
151
-
152
- Insert a local message into the current user's message list. This message will not be sent to other users in the live streaming room. It is suitable for displaying system welcome, warning or operation prompt information.
153
- ``` java
154
- extension BarrageManagerLocal on BarrageManager {
155
- Insert a welcome notification into the local message list
156
- void showWelcomeMessage(LiveUserInfo user) {
157
- // 1. Create a Barrage message (using named parameters construct function)
158
- final welcomeTip = Barrage(
159
- messageType: BarrageType.text,
160
- Welcome ${user.userName} to the live room.
161
- );
162
-
163
- // 2. Call this API to insert it into the local list
164
- barrageStore.appendLocalTip(welcomeTip);
165
- }
166
- }
167
- ```
168
-
169
- ### Step 6: Manage User Messaging Permissions (Mute & Unmute)
170
-
171
- As an Anchor or admin, you can manage the user speaking permission in the live streaming room to maintain a healthy communication environment.
172
-
173
- #### Mute or Unmute Individual Users
174
-
175
- Mute or unblock designated users can be achieved by the `disableSendMessage` API in `LiveAudienceStore`.
176
- ``` java
177
- // 1. Get the LiveAudienceStore instance bound to the current live streaming room (location parameter)
178
- final liveId = "your_live_id";
179
- final audienceStore = LiveAudienceStore.create(liveId);
180
-
181
- // 2. Define the operating user ID and mute status
182
- final userIdToMute = "user_id_to_be_muted";
183
- final shouldDisable = true; // true for mute, false for unblock
184
-
185
- // 3. Call API to perform operation
186
- final result = await audienceStore.disableSendMessage(
187
- userID: userIdToMute,
188
- isDisable: shouldDisable,
189
- );
190
-
191
- if (result.isSuccess) {
192
- debugPrint("${shouldDisable ? "mute" : "unblock"} user $userIdToMute successfully");
193
- } else {
194
- debugPrint("Operation failure: ${result.errorMessage}");
195
- }
196
- ```
197
-
198
- #### Enable/Disable Global Mute
199
-
200
- To mute all users in the live room (typically excluding the host), update the live room info via `LiveListStore`.
201
- ``` java
202
- // 1. Get the LiveListStore singleton
203
- final liveListStore = LiveListStore.shared;
204
-
205
- // 2. Get the current live room information, create a new LiveInfo object, and modify the global mute status
206
- final currentLiveInfo = liveListStore.liveState.currentLive.value;
207
- final updatedLiveInfo = LiveInfo(
208
- liveID: currentLiveInfo.liveID,
209
- liveName: currentLiveInfo.liveName,
210
- isMessageDisable: true, // true for mute all, false for shutdown
211
- );
212
-
213
- // 3. Call the update API and specify the modify flags list
214
- final result = await liveListStore.updateLiveInfo(
215
- liveInfo: updatedLiveInfo,
216
- modifyFlagList: [ModifyFlag.isMessageDisable],
217
- );
218
-
219
- if (result.isSuccess) {
220
- debugPrint("Global mute status updated successfully");
221
- } else {
222
- debugPrint("Operation failure: ${result.errorMessage}");
223
- }
224
- ```
225
-
226
- ## Complete UI Example
227
- ``` java
228
- import 'package:flutter/material.dart';
229
- import 'package:atomic_x_core/atomicxcore.dart';
230
-
231
- class BarrageWidget extends StatefulWidget {
232
- final String liveId;
233
-
234
- const BarrageWidget({Key? key, required this.liveId}) : super(key: key);
235
-
236
- @override
237
- State<BarrageWidget> createState() => _BarrageWidgetState();
238
- }
239
-
240
- class _BarrageWidgetState extends State<BarrageWidget> {
241
- late BarrageManager _barrageManager;
242
- final TextEditingController _inputController = TextEditingController();
243
- final ScrollController _scrollController = ScrollController();
244
-
245
- @override
246
- void initState() {
247
- super.initState();
248
- _barrageManager = BarrageManager(liveId: widget.liveId);
249
- }
250
-
251
- void _scrollToBottom() {
252
- WidgetsBinding.instance.addPostFrameCallback((_) {
253
- if (_scrollController.hasClients) {
254
- _scrollController.animateTo(
255
- _scrollController.position.maxScrollExtent,
256
- duration: const Duration(milliseconds: 200),
257
- curve: Curves.easeOut,
258
- );
259
- }
260
- });
261
- }
262
-
263
- @override
264
- void dispose() {
265
- _barrageManager.dispose();
266
- _inputController.dispose();
267
- _scrollController.dispose();
268
- super.dispose();
269
- }
270
-
271
- @override
272
- Widget build(BuildContext context) {
273
- return Column(
274
- children: [
275
- // Bullet screen list
276
- Expanded(
277
- child: ValueListenableBuilder<List<Barrage>>(
278
- valueListenable: _barrageManager.messagesNotifier,
279
- builder: (context, messageList, child) {
280
- // Scroll to the bottom
281
- _scrollToBottom();
282
- return ListView.builder(
283
- controller: _scrollController,
284
- itemCount: messageList.length,
285
- itemBuilder: (context, index) {
286
- final barrage = messageList[index];
287
- return _buildBarrageItem(barrage);
288
- },
289
- );
290
- },
291
- ),
292
- ),
293
- // input box
294
- _buildInputBar(),
295
- ],
296
- );
297
- }
298
-
299
- Widget _buildBarrageItem(Barrage barrage) {
300
- return Container(
301
- margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
302
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
303
- decoration: BoxDecoration(
304
- color: Colors.black54,
305
- borderRadius: BorderRadius.circular(16),
306
- ),
307
- child: RichText(
308
- text: TextSpan(
309
- children: [
310
- TextSpan(
311
- text: '${barrage.sender.userName}: ',
312
- style: const TextStyle(
313
- color: Colors.yellow,
314
- fontSize: 14,
315
- fontWeight: FontWeight.bold,
316
- ),
317
- ),
318
- TextSpan(
319
- text: barrage.textContent,
320
- style: const TextStyle(color: Colors.white, fontSize: 14),
321
- ),
322
- ],
323
- ),
324
- ),
325
- );
326
- }
327
-
328
- Widget _buildInputBar() {
329
- return Container(
330
- padding: const EdgeInsets.all(8),
331
- color: Colors.white,
332
- child: Row(
333
- children: [
334
- Expanded(
335
- child: TextField(
336
- controller: _inputController,
337
- decoration: const InputDecoration(
338
- hintText: 'Say something...',
339
- border: OutlineInputBorder(),
340
- contentPadding: EdgeInsets.symmetric(horizontal: 12),
341
- ),
342
- onSubmitted: (_) => _sendMessage(),
343
- ),
344
- ),
345
- const SizedBox(width: 8),
346
- ElevatedButton(
347
- onPressed: _sendMessage,
348
- child: const Text('Send')
349
- ),
350
- ],
351
- ),
352
- );
353
- }
354
-
355
- void _sendMessage() {
356
- final text = _inputController.text.trim();
357
- if (text.isNotEmpty) {
358
- _barrageManager.sendTextMessage(text);
359
- _inputController.clear();
360
- }
361
- }
362
- }
363
- ```
364
-
365
- ## Advanced Usage: Performance Optimization for High-Concurrency
366
-
367
- After integrating the live comment feature with `BarrageStore`, you may need to handle more demanding scenarios to ensure a smooth and stable user experience, especially during high-concurrency live streams. The following use cases provide practical optimization strategies and code samples.
368
-
369
- ### Scenario 1: Handle High-Concurrency Live Comments
370
-
371
- During major events, a large number of viewers may join the live room, causing live comments to refresh dozens of times per second.
372
-
373
- #### **Technical Challenge**
374
-
375
- The SDK pushes the complete the live comment list at high frequency. If the UI rebuilds on every update, the main thread can become overloaded with layout and rendering, resulting in lag.
376
-
377
- #### **O**ptimization Strategy: Batch Processing and Debouncing
378
-
379
- Instead of responding to every update, set a time threshold (e.g., 300ms). Only refresh the UI if enough time has passed since the last update. This reduces UI redraws from dozens per second to just a few, greatly improving smoothness.
380
- ``` java
381
- class BarrageUIManager {
382
- List<Barrage>? _latestMessageList;
383
- Timer? _refreshTimer;
384
- final void Function(List<Barrage>) onUpdate;
385
-
386
- BarrageUIManager({required this.onUpdate}) {
387
- // Check whether need to refresh every 0.3 seconds
388
- _refreshTimer = Timer.periodic(
389
- const Duration(milliseconds: 300),
390
- (_) => _refreshUIIfNeeded(),
391
- );
392
- }
393
-
394
- /// This method is frequently invoked externally with the latest full list
395
- void update(List<Barrage> fullList) {
396
- _latestMessageList = fullList;
397
- }
398
-
399
- void _refreshUIIfNeeded() {
400
- // Check whether there is new data pending refresh
401
- final newList = _latestMessageList;
402
- if (newList == null) return;
403
-
404
- _latestMessageList = null; // Clear flags to avoid repeated refresh
405
-
406
- // Update data source and refresh UI
407
- onUpdate(newList);
408
- }
409
-
410
- void dispose() {
411
- _refreshTimer?.cancel();
412
- }
413
- }
414
- ```
415
-
416
- ### Scenario 2: Maintain Memory Stability for Long Streams
417
-
418
- Your app may need to support hours-long or even all-day continuous live streaming, such as gaming or slow live streams. The app must remain stable and avoid crashes due to long-term operation.
419
-
420
- #### Technical Challenge
421
-
422
- The SDK's `messageList` grows indefinitely during long streams. Even with throttled UI updates, the underlying data array can consume excessive memory, eventually leading to crash
423
-
424
- #### **O**ptimization Strategy: Fixed-Size Circular Buffer
425
-
426
- **Limit the number of messages your data source retains**. Regardless of the SDK's full list size, only display the latest messages in your app.
427
- ``` java
428
- void _refreshUIIfNeeded() {
429
- final fullList = _latestMessageList;
430
- if (fullList == null) return;
431
-
432
- _latestMessageList = null;
433
-
434
- // Key point: Take the latest N messages
435
- const capacity = 500; // The client keeps the latest 500 messages only
436
- final cappedList = fullList.length > capacity
437
- ? fullList.sublist(fullList.length - capacity)
438
- : fullList;
439
-
440
- onUpdate(cappedList);
441
- }
442
- ```
443
-
444
- ## API Documentation
445
-
446
- For detailed information about ALL public interfaces, attributes, and methods of [BarrageStore](https://tencent-rtc.github.io/TUIKit_Flutter/api_barrage_barrage_store/BarrageStore-class.html) and its related classes, see the official API documentation included with the [AtomicXCore](https://tencent-rtc.github.io/TUIKit_Flutter/index.html) framework.
447
-
448
- ## FAQs
449
-
450
- ### How can I implement colored live comments, gifts, or other custom styles?
451
-
452
- Use custom messages with `sendCustomMessage`. `BarrageStore` gives you full flexibility for business-specific live comments.
453
- 1. **Define data structure:** Work with your client and server team to define the JSON structure of custom messages. For example, a color bullet screen can be defined as follows:
454
-
455
- ``` json
456
- { "type": "colored_text", "text": "This is a color bullet screen!", "color": "#FF5733" }
457
- ```
458
- 2. **Sender:** During sending, convert this JSON structure to a string and send it via the `data` parameter of `sendCustomMessage`. `businessId` can be set to a unique identifier representing your business, such as "`barrage_style_v1`".
459
-
460
- 3. **Receiver**: After receiving the live comments, check whether its `messageType` is `.custom` and whether `businessId` matches. If matched, parse the `data` string (usually parsing JSON), and render your custom UI style based on the parsed data (such as `color, text`).
461
-
462
- ### If I call BarrageStore.create("some_id") in different classes or files, will this create multiple instances?
463
-
464
- No. The internal logic of `AtomicXCore` ensures that as long as you use the same liveId, you always get the same `BarrageStore` instance for that live room. You don't need to manage the singleton yourself.
465
-
466
- ### Why can't I see my sent message in the message list after calling sendTextMessage?
467
-
468
- **Troubleshooting**:
469
- 1. **Check the result**: The sendTextMessage method provides a completion callback. Check if the result is success or failure. If it failed, the error message will indicate the reason (e.g., "You have been muted", "Network error", etc.).
470
-
471
- 2. **Confirm subscription timing**: Make sure you subscribe to barrageStore.state after the live room for the corresponding liveId has started. If you start listening before joining the live room, you may miss some messages.
472
-
473
- 3. **Check liveId**: Ensure the liveId used when creating the BarrageStore instance, joining the live room, and sending messages is exactly the same (case-sensitive).
474
-
475
- 4. **Network issues**: Make sure the device has a working network connection. Message sending depends on network connectivity.
476
-
477
- ### How can new viewers see barrage messages sent before they joined the live room?
478
-
479
- `AtomicXCore` supports pulling history live comments, but this requires you to perform one simple configuration in the **server console**. Once configured, the SDK will automatically handle everything subsequently with no need to write additional code.
480
-
481
- #### **Step 1: **Configure in the Live Console
482
- 1. Log in to the [**console > Live > Configuration**](https://console.trtc.io/live/configuration), and select the target application at the **top**.
483
-
484
- 2. On the Live configuration page, select **new member pull historical messages**, modify **new member viewable latest message count**, supports a maximum of **50**.
485
-
486
- **Step 2: Client Seamless Retrieval**
487
-
488
- After this configuration, no client code changes are needed.
489
-
490
- When a new user joins the live room, `AtomicXCore` automatically retrieves the configured number of historical messages at the SDK level. These messages are delivered to your UI via the same `v` subscription you already use. Your app will receive and display these historical barrages just like real-time messages.