@tencent-rtc/mcp 1.6.4 → 1.6.5

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 (247) hide show
  1. package/knowledge/chunker.js +83 -54
  2. package/knowledge/path-meta.js +179 -26
  3. package/knowledge/search/exact-lookup.js +153 -0
  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 +235 -58
  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/livekit/core-sdk/api-reference/android/AudioEffectStore.md +7 -14
  81. package/resource/knowledge/livekit/core-sdk/api-reference/android/BarrageStore.md +5 -8
  82. package/resource/knowledge/livekit/core-sdk/api-reference/android/BattleStore.md +15 -18
  83. package/resource/knowledge/livekit/core-sdk/api-reference/android/CameraView.md +1 -2
  84. package/resource/knowledge/livekit/core-sdk/api-reference/android/CoGuestStore.md +15 -20
  85. package/resource/knowledge/livekit/core-sdk/api-reference/android/CoHostStore.md +10 -13
  86. package/resource/knowledge/livekit/core-sdk/api-reference/android/DeviceStore.md +2 -4
  87. package/resource/knowledge/livekit/core-sdk/api-reference/android/GiftStore.md +4 -6
  88. package/resource/knowledge/livekit/core-sdk/api-reference/android/LikeStore.md +2 -4
  89. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveAudienceStore.md +2 -4
  90. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveCoreView.md +1 -2
  91. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveSeatStore.md +8 -10
  92. package/resource/knowledge/livekit/core-sdk/api-reference/android/LoginStore.md +5 -7
  93. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/AudioEffectStore.md +7 -14
  94. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BarrageStore.md +6 -9
  95. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BaseBeautyStore.md +1 -2
  96. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BattleStore.md +15 -18
  97. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoGuestStore.md +15 -20
  98. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoHostStore.md +10 -13
  99. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/DeviceStore.md +2 -4
  100. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/GiftStore.md +4 -6
  101. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LikeStore.md +2 -4
  102. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveAudienceStore.md +2 -4
  103. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveCoreView.md +1 -2
  104. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveSeatStore.md +8 -10
  105. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LoginStore.md +3 -5
  106. package/resource/knowledge/livekit/core-sdk/api-reference/ios/AudioEffectStore.md +7 -14
  107. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BarrageStore.md +5 -8
  108. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BaseBeautyStore.md +1 -2
  109. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BattleStore.md +6 -9
  110. package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoGuestStore.md +5 -10
  111. package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoHostStore.md +3 -6
  112. package/resource/knowledge/livekit/core-sdk/api-reference/ios/DeviceStore.md +2 -4
  113. package/resource/knowledge/livekit/core-sdk/api-reference/ios/GiftStore.md +4 -6
  114. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LikeStore.md +2 -4
  115. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveAudienceStore.md +2 -4
  116. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveCoreView.md +1 -2
  117. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveSeatStore.md +4 -6
  118. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LoginStore.md +3 -5
  119. package/resource/knowledge/livekit/core-sdk/api-reference/{web → vue}/index.md +24 -24
  120. package/resource/knowledge/livekit/core-sdk/{voice/android/voice-audio-effect.md → features/android/audio-effect.md} +1 -2
  121. package/resource/knowledge/livekit/core-sdk/{live/android/live-gift.md → features/android/gift.md} +2 -3
  122. package/resource/knowledge/livekit/core-sdk/{voice/android/voice-room-list.md → features/android/live-list.md} +2 -4
  123. package/resource/knowledge/livekit/core-sdk/{live/flutter/live-audio-effect.md → features/flutter/audio-effect.md} +0 -2
  124. package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-barrage.md → features/flutter/barrage.md} +2 -2
  125. package/resource/knowledge/livekit/core-sdk/{live/flutter/live-gift.md → features/flutter/gift.md} +2 -3
  126. package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-room-list.md → features/flutter/live-list.md} +1 -1
  127. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-audience-list.md → features/ios/audience-list.md} +1 -2
  128. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-audio-effect.md → features/ios/audio-effect.md} +1 -3
  129. package/resource/knowledge/livekit/core-sdk/{live/ios/live-base-beauty.md → features/ios/base-beauty.md} +2 -2
  130. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-gift.md → features/ios/gift.md} +2 -3
  131. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-room-list.md → features/ios/live-list.md} +2 -4
  132. package/resource/knowledge/livekit/core-sdk/live/android/{live-co-guest-interaction.md → co-guest-interaction.md} +0 -1
  133. package/resource/knowledge/livekit/core-sdk/live/android/{live-host-interaction.md → host-interaction.md} +5 -7
  134. package/resource/knowledge/livekit/core-sdk/live/android/{live-integration.md → integration.md} +3 -6
  135. package/resource/knowledge/livekit/core-sdk/live/flutter/{live-co-guest-interaction.md → co-guest-interaction.md} +1 -1
  136. package/resource/knowledge/livekit/core-sdk/live/flutter/{live-host-interaction.md → host-interaction.md} +0 -2
  137. package/resource/knowledge/livekit/core-sdk/live/flutter/{live-integration.md → integration.md} +1 -4
  138. package/resource/knowledge/livekit/core-sdk/live/ios/{live-co-guest-interaction.md → co-guest-interaction.md} +0 -1
  139. package/resource/knowledge/livekit/core-sdk/live/ios/{live-host-interaction.md → host-interaction.md} +2 -4
  140. package/resource/knowledge/livekit/core-sdk/live/ios/{live-integration.md → integration.md} +2 -5
  141. package/resource/knowledge/livekit/core-sdk/voice/android/{voice-host-interaction.md → host-interaction.md} +3 -5
  142. package/resource/knowledge/livekit/core-sdk/voice/android/{voice-integration.md → integration.md} +3 -6
  143. package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-co-guest-interaction.md → co-guest-interaction.md} +1 -2
  144. package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-integration.md → integration.md} +6 -9
  145. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-co-guest-interaction.md → co-guest-interaction.md} +2 -2
  146. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-host-interaction.md → host-interaction.md} +4 -6
  147. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-integration.md → integration.md} +1 -4
  148. package/resource/knowledge/livekit/preset/live/vue/features/barrage.md +0 -2
  149. package/resource/knowledge/push/api-reference/android.md +123 -0
  150. package/resource/knowledge/push/api-reference/flutter.md +176 -0
  151. package/resource/knowledge/push/api-reference/harmonyos.md +138 -0
  152. package/resource/knowledge/push/api-reference/ios.md +176 -0
  153. package/resource/knowledge/push/api-reference/react-native.md +147 -0
  154. package/resource/knowledge/push/api-reference/uni-app.md +147 -0
  155. package/resource/knowledge/push/api-reference/unity.md +119 -0
  156. package/resource/knowledge/push/api-reference/unreal-engine.md +123 -0
  157. package/resource/knowledge/push/config/android.md +4 -7
  158. package/resource/knowledge/push/config/harmonyos.md +0 -3
  159. package/resource/knowledge/push/config/ios.md +12 -20
  160. package/resource/knowledge/push/config/react-native.md +18 -26
  161. package/resource/knowledge/push/config/unity.md +20 -28
  162. package/resource/knowledge/push/config/unreal-engine.md +21 -29
  163. package/resource/knowledge/push/integration/android.md +6 -8
  164. package/resource/knowledge/push/integration/flutter.md +6 -9
  165. package/resource/knowledge/push/integration/harmonyos.md +1 -0
  166. package/resource/knowledge/push/integration/ios.md +7 -9
  167. package/resource/knowledge/push/integration/react-native.md +9 -13
  168. package/resource/knowledge/push/integration/uni-app.md +7 -7
  169. package/resource/knowledge/push/integration/unity.md +10 -13
  170. package/resource/knowledge/push/integration/unreal-engine.md +6 -9
  171. package/resource/knowledge/push/overview/prepare.md +2 -2
  172. package/resource/knowledge/roomkit/core-sdk/android/call-user-to-room.md +3 -3
  173. package/resource/knowledge/roomkit/core-sdk/android/capability-matrix.md +46 -0
  174. package/resource/knowledge/roomkit/core-sdk/android/room-participant-state.md +1 -1
  175. package/resource/knowledge/roomkit/core-sdk/android/room-state.md +2 -2
  176. package/resource/knowledge/roomkit/core-sdk/android/schedule-room.md +6 -6
  177. package/resource/knowledge/roomkit/core-sdk/android/unsupported-features.md +79 -0
  178. package/resource/knowledge/roomkit/core-sdk/flutter/capability-matrix.md +46 -0
  179. package/resource/knowledge/roomkit/core-sdk/flutter/room-participant-state.md +1 -1
  180. package/resource/knowledge/roomkit/core-sdk/flutter/unsupported-features.md +79 -0
  181. package/resource/knowledge/roomkit/core-sdk/ios/capability-matrix.md +46 -0
  182. package/resource/knowledge/roomkit/core-sdk/ios/room-participant-state.md +1 -1
  183. package/resource/knowledge/roomkit/core-sdk/ios/unsupported-features.md +79 -0
  184. package/resource/knowledge/roomkit/preset/android/integration.md +5 -7
  185. package/resource/knowledge/roomkit/preset/flutter/integration.md +2 -7
  186. package/resource/knowledge/roomkit/preset/ios/integration.md +3 -9
  187. package/resource/knowledge/roomkit/preset/react/integration.md +12 -16
  188. package/resource/knowledge/trtc/android/TRTCCloud.md +154 -238
  189. package/resource/knowledge/trtc/android/TRTCCloudDef.md +133 -134
  190. package/resource/knowledge/trtc/android/TRTCCloudListener.md +86 -120
  191. package/resource/knowledge/trtc/android/TRTCStatistics.md +10 -10
  192. package/resource/knowledge/trtc/android/TXAudioEffectManager.md +10 -30
  193. package/resource/knowledge/trtc/android/TXBeautyManager.md +25 -25
  194. package/resource/knowledge/trtc/android/TXDeviceManager.md +2 -2
  195. package/resource/knowledge/trtc/android/TXLiteAVCode.md +12 -12
  196. package/resource/knowledge/trtc/c++/ITRTCCloud.md +166 -261
  197. package/resource/knowledge/trtc/c++/ITRTCStatistics.md +12 -12
  198. package/resource/knowledge/trtc/c++/ITXAudioEffectManager.md +10 -30
  199. package/resource/knowledge/trtc/c++/ITXDeviceManager.md +9 -11
  200. package/resource/knowledge/trtc/c++/TRTCCloudCallback.md +96 -130
  201. package/resource/knowledge/trtc/c++/TRTCTypeDef.md +122 -123
  202. package/resource/knowledge/trtc/c++/TXLiteAVCode.md +12 -12
  203. package/resource/knowledge/trtc/ios/TRTCCloud.md +168 -255
  204. package/resource/knowledge/trtc/ios/TRTCCloudDef.md +124 -125
  205. package/resource/knowledge/trtc/ios/TRTCCloudDelegate.md +89 -124
  206. package/resource/knowledge/trtc/ios/TRTCStatistics.md +10 -10
  207. package/resource/knowledge/trtc/ios/TXAudioEffectManager.md +9 -28
  208. package/resource/knowledge/trtc/ios/TXBeautyManager.md +25 -25
  209. package/resource/knowledge/trtc/ios/TXDeviceManager.md +9 -11
  210. package/resource/knowledge/trtc/ios/TXLiteAVCode.md +12 -12
  211. package/server.js +21 -21
  212. package/tools/common/finalize_answer.js +1 -1
  213. package/tools/common/present_framework_choice.js +2 -2
  214. package/tools/common/search_trtc_knowledge.js +3 -3
  215. package/tools/common/submit_feedback.js +1 -1
  216. package/tools/definitions/get_native_live_uikit_integration_def.js +61 -0
  217. package/tools/definitions/get_native_livekit_core_integration_def.js +3 -3
  218. package/tools/definitions/present_framework_choice_def.js +2 -2
  219. package/tools/definitions/search_trtc_knowledge_def.js +5 -5
  220. package/tools/index.js +2 -0
  221. package/tools/live/get_native_live_uikit_integration.js +69 -0
  222. package/tools/live/get_native_livekit_core_integration.js +6 -6
  223. package/utils/report-cls-client.js +1 -1
  224. package/utils/report-es-client.js +1 -1
  225. package/resource/knowledge/callkit/preset/web/api.md +0 -83
  226. package/resource/knowledge/livekit/core-sdk/live/android/live-audio-effect.md +0 -226
  227. package/resource/knowledge/livekit/core-sdk/live/android/live-live-list.md +0 -438
  228. package/resource/knowledge/livekit/core-sdk/live/flutter/live-barrage.md +0 -490
  229. package/resource/knowledge/livekit/core-sdk/live/flutter/live-live-list.md +0 -726
  230. package/resource/knowledge/livekit/core-sdk/live/ios/live-audience-list.md +0 -264
  231. package/resource/knowledge/livekit/core-sdk/live/ios/live-audio-effect.md +0 -216
  232. package/resource/knowledge/livekit/core-sdk/live/ios/live-gift.md +0 -407
  233. package/resource/knowledge/livekit/core-sdk/live/ios/live-live-list.md +0 -349
  234. package/resource/knowledge/livekit/core-sdk/voice/android/voice-audience-list.md +0 -269
  235. package/resource/knowledge/livekit/core-sdk/voice/android/voice-barrage.md +0 -456
  236. package/resource/knowledge/livekit/core-sdk/voice/android/voice-gift.md +0 -455
  237. package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audience-list.md +0 -260
  238. package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audio-effect.md +0 -598
  239. package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-gift.md +0 -424
  240. package/resource/knowledge/livekit/core-sdk/voice/ios/voice-barrage.md +0 -408
  241. /package/resource/knowledge/livekit/core-sdk/{live/android/live-audience-list.md → features/android/audience-list.md} +0 -0
  242. /package/resource/knowledge/livekit/core-sdk/{live/android/live-barrage.md → features/android/barrage.md} +0 -0
  243. /package/resource/knowledge/livekit/core-sdk/{live/android/live-base-beauty.md → features/android/base-beauty.md} +0 -0
  244. /package/resource/knowledge/livekit/core-sdk/{live/flutter/live-audience-list.md → features/flutter/audience-list.md} +0 -0
  245. /package/resource/knowledge/livekit/core-sdk/{live/flutter/live-base-beauty.md → features/flutter/base-beauty.md} +0 -0
  246. /package/resource/knowledge/livekit/core-sdk/{live/ios/live-barrage.md → features/ios/barrage.md} +0 -0
  247. /package/resource/knowledge/livekit/core-sdk/voice/android/{voice-co-guest-interaction.md → co-guest-interaction.md} +0 -0
@@ -1,408 +0,0 @@
1
- This document provides a comprehensive guide for iOS developers to quickly integrate a feature-rich, high-performance live chat overlay (barrage/danmaku) system into your live streaming application using the `BarrageStore` module from the **AtomicXCore** framework.
2
-
3
- ## Core Features
4
-
5
- `BarrageStore` delivers a complete barrage solution for your live streaming app. Core features include:
6
- - Receiving and displaying barrage messages in the live room.
7
-
8
- - Sending text barrage messages to interact with viewers.
9
-
10
- - Sending custom business barrage messages to support complex scenarios such as gifts and likes.
11
-
12
- - Inserting system tips into the local message list (for example, "Welcome XX to the live room").
13
-
14
- ## Core Concepts
15
-
16
- |**Core Concept**|**Type**|**Core Responsibility & Description**|
17
- |---------|---------|---------|
18
- |[Barrage](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/barrage)|struct|Represents the data model for a single barrage message. Contains all essential information such as sender (sender), message content (textContent or data), message type (messageType), and more.|
19
- |[BarrageState](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/barragestate)|struct|Represents the current state of the barrage module. The main property, messageList, is an array of [Barrage] storing all barrage messages in chronological order for the current live room. This serves as the data source for UI rendering.|
20
- |[BarrageStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/barragestore)|class|The core management class for barrage functionality. Use it to send messages (sendTextMessage, sendCustomMessage), and subscribe to its state property to receive all barrage message updates.|
21
-
22
- ## Implementation
23
-
24
- ### Step 1: Component Integration
25
- - **Video Live Streaming**: Please refer to Quick Start to integrate AtomicXCore. Quick Start to
26
-
27
- - **Voice Chat Room**: Please refer to Quick Start to integrate AtomicXCore.
28
-
29
- ### Step 2: Initialize and Listen for Barrage
30
-
31
- Obtain a `BarrageStore` instance bound to the current live room's `liveId`, and set up a subscriber to receive the latest complete barrage message list in real time.
32
- ``` swift
33
- import Foundation
34
- import AtomicXCore // Import the core library
35
- import Combine // For reactive programming
36
-
37
- class BarrageManager {
38
- private let liveId: String
39
- private let barrageStore: BarrageStore
40
- private var cancellables = Set<AnyCancellable>()
41
-
42
- // Publisher for the complete message list, for UI layer subscription
43
- let messagesPublisher = PassthroughSubject<[Barrage], Never>()
44
-
45
- init(liveId: String) {
46
- self.liveId = liveId
47
- // 1. Obtain the BarrageStore singleton for the given liveId
48
- self.barrageStore = BarrageStore.create(liveID: liveId)
49
- // 2. Start listening for barrage messages immediately after initialization
50
- subscribeToBarrageUpdates()
51
- }
52
-
53
- private func subscribeToBarrageUpdates() {
54
- barrageStore.state
55
- .subscribe() // Subscribe to all BarrageState changes
56
- .receive(on: DispatchQueue.main) // Ensure main thread for UI safety
57
- .sink { [weak self] barrageState in
58
- // 3. Forward the updated message list to the UI layer
59
- // Note: This provides the complete list, including all historical messages
60
- self?.messagesPublisher.send(barrageState.messageList)
61
- }
62
- .store(in: &cancellables) // Manage subscription lifecycle
63
- }
64
-
65
- ```
66
-
67
- ### Step 3: Send Text Barrage
68
-
69
- Use the `sendTextMessage` method to broadcast a plain text message to all users in the live room.
70
- ``` swift
71
- extension BarrageManager {
72
- /// Send a text barrage message
73
- func sendTextMessage(text: String) {
74
- // Prevent sending empty messages
75
- guard !text.isEmpty else {
76
- print("Barrage content cannot be empty")
77
- return
78
- }
79
-
80
- // Send the message using the core API
81
- barrageStore.sendTextMessage(text: text, extensionInfo: nil) { result in
82
- // Handle the result in the callback, e.g., show a prompt to the user
83
- switch result {
84
- case .success:
85
- print("Text barrage '\(text)' sent successfully")
86
- case .failure(let error):
87
- print("Failed to send text barrage: \(error.localizedDescription)")
88
- }
89
- }
90
- }
91
- }
92
- ```
93
-
94
- #### API Parameters
95
-
96
- |**Parameter**|**Type**|**Description**|
97
- |---------|---------|---------|
98
- |`text`|`String`|The text content to send.|
99
- |`extensionInfo`|`[String: String]?`|Additional extension information for business customization.|
100
- |`completion`|`CompletionClosure?`|Callback after sending is complete, containing the success or failure result.|
101
-
102
- ### Step 4: Send Custom Barrage
103
-
104
- Send a message containing custom business logic, such as gifts, likes, or gamification commands. The content format of this message is defined by the business layer. The receiver must parse and handle it based on the `businessId` and `data`.
105
- ``` swift
106
- extension BarrageManager {
107
- /// Send a custom barrage, e.g., for sending gifts
108
- func sendGiftMessage(giftId: String, giftCount: Int) {
109
- // 1. Define a business-recognizable ID
110
- let businessId = "live_gift"
111
-
112
- // 2. Encode business data as a JSON string
113
- let giftData: [String: Any] = ["gift_id": giftId, "gift_count": giftCount]
114
- guard let jsonData = try? JSONSerialization.data(withJSONObject: giftData),
115
- let jsonString = String(data: jsonData, encoding: .utf8) else {
116
- print("Failed to encode gift data as JSON")
117
- return
118
- }
119
-
120
- // 3. Send the custom message using the core API
121
- barrageStore.sendCustomMessage(businessID: businessId, data: jsonString) { result in
122
- switch result {
123
- case .success:
124
- print("Gift message (custom barrage) sent successfully")
125
- case .failure(let error):
126
- print("Failed to send gift message: \(error.localizedDescription)")
127
- }
128
- }
129
- }
130
- }
131
- ```
132
-
133
- #### API Parameters
134
-
135
- |**Parameter**|**Type**|**Description**|
136
- |---------|---------|---------|
137
- |`businessId`|`String`|Unique business identifier, e.g., "live_gift", used by the receiver to distinguish different custom messages.|
138
- |`data`|`String`|Business data, usually a JSON-formatted string.|
139
- |`completion`|`CompletionClosure?`|Callback after sending is complete.|
140
-
141
- ### Step 5: Insert Local Tip Message
142
-
143
- Insert a local message into the current user's message list. This message is not sent to other users in the live room. Use this for system welcomes, warnings, or action tips.
144
- ``` swift
145
- extension BarrageManager {
146
- /// Insert a welcome tip into the local message list
147
- func showWelcomeMessage(for user: LiveUserInfo) {
148
- // 1. Create a Barrage message
149
- var welcomeTip = Barrage()
150
- welcomeTip.messageType = .text // Reuse the text type for display
151
- welcomeTip.textContent = "Welcome \(user.userName) to the live room!"
152
- // sender can be left empty or set to a system user identifier
153
-
154
- // 2. Insert the message into the local list
155
- barrageStore.appendLocalTip(message: welcomeTip)
156
- }
157
- }
158
- ```
159
-
160
- #### API Parameters
161
-
162
- |**Parameter**|**Type**|**Description**|
163
- |---------|---------|---------|
164
- |message|Barrage|The message object to insert locally. The SDK appends this message to the messageList in BarrageState.|
165
-
166
- ### Step 6: Manage User Speaking Permissions (Mute and Unmute)
167
-
168
- As a host or administrator, you can manage users' chat permissions in the live room to maintain a healthy community environment.
169
-
170
- #### Mute/Unmute a Single User
171
-
172
- Use the `disableSendMessage` method in `LiveAudienceStore` to mute or unmute a user. This state persists even if the user rejoins the live room.
173
- ``` swift
174
- import AtomicXCore
175
-
176
- // 1. Get the LiveAudienceStore instance for the current live room
177
- let audienceStore = LiveAudienceStore.create(liveID: "your_live_id")
178
-
179
- // 2. Specify the user ID and mute status
180
- let userIdToMute = "user_id_to_be_muted"
181
- let shouldDisable = true // true to mute, false to unmute
182
-
183
- // 3. Call the API to perform the operation
184
- audienceStore.disableSendMessage(userID: userIdToMute, isDisable: shouldDisable) { [weak self] result in
185
- guard let self = self else { return }
186
- switch result {
187
- case .success:
188
- print("\(shouldDisable ? "Muted" : "Unmuted") user \(userIdToMute) successfully")
189
- case .failure(let error):
190
- print("Operation failed: \(error.localizedDescription)")
191
- }
192
- }
193
- ```
194
-
195
- #### Enable/Disable Global Mute
196
-
197
- To mute all users in the live room (usually excluding the host), update the live room information via `LiveListStore`.
198
- ``` swift
199
- import AtomicXCore
200
-
201
- // 1. Get the LiveListStore singleton
202
- let liveListStore = LiveListStore.shared
203
-
204
- // 2. Get the current live room info and modify the global mute status
205
- var currentLiveInfo = liveListStore.state.value.currentLive
206
- currentLiveInfo.isMessageDisable = true // true to enable global mute, false to disable
207
-
208
- // 3. Call the update API and specify the modify flag
209
- liveListStore.updateLiveInfo(currentLiveInfo, modifyFlag: .isMessageDisable) { result in
210
- switch result {
211
- case .success:
212
- print("Global mute status updated successfully")
213
- case .failure(let error):
214
- print("Operation failed: \(error.localizedDescription)")
215
- }
216
- }
217
- ```
218
-
219
- ## Advanced Features: Performance Optimization in High-Concurrency Scenarios
220
-
221
- After implementing barrage features with `BarrageStore`, use the following strategies to ensure smooth and stable user experiences in high-concurrency live streaming scenarios. This section provides optimization strategies and code samples for three core business scenarios.
222
-
223
- ### Scenario 1: Handling "Barrage Storms" in Popular Live Rooms
224
-
225
- #### Scenario Description
226
-
227
- During popular events, a large number of viewers may flood into the live room, with barrages updating at dozens of messages per second.
228
-
229
- #### Technical Challenge
230
-
231
- The SDK returns the complete barrage list at a high frequency. If you call `tableView.reloadData()` on every update, the main thread will be blocked by intensive UI layout and rendering, causing UI lag.
232
-
233
- #### Optimization: Batch Processing & Debouncing
234
-
235
- Do not respond to every data update. Instead, set a time threshold (e.g., 300 milliseconds). Only refresh the UI if this threshold has passed since the last refresh. This reduces dozens of `reloadData()` calls per second to just 3-4, greatly improving smoothness.
236
-
237
- #### Code Example
238
-
239
- Create a `BarrageUIManager` class with an internal buffer and timer to batch update data to the `UITableView`.
240
- ``` swift
241
- class BarrageUIManager {
242
- private var latestMessageList: [BarrageViewModel]?
243
- private var refreshTimer: Timer?
244
- private weak var tableView: UITableView?
245
- private var dataSource: [BarrageViewModel] = []
246
-
247
- init(tableView: UITableView) {
248
- self.tableView = tableView
249
- // Check every 0.3 seconds if a refresh is needed
250
- self.refreshTimer = Timer.scheduledTimer(withTimeInterval: 0.3, repeats: true) { [weak self] _ in
251
- self?.refreshUIIfNeeded()
252
- }
253
- }
254
-
255
- /// Frequently called from outside, passing in the latest full list
256
- func update(with fullList: [BarrageViewModel]) {
257
- self.latestMessageList = fullList
258
- }
259
-
260
- private func refreshUIIfNeeded() {
261
- // Check if there is new data to refresh
262
- guard let newList = self.latestMessageList, let tableView = self.tableView else { return }
263
- self.latestMessageList = nil // Clear the flag to avoid repeated refreshes
264
-
265
- // Update the data source and refresh the UI
266
- self.dataSource = newList
267
- tableView.reloadData()
268
- }
269
-
270
- deinit {
271
- refreshTimer?.invalidate()
272
- }
273
- }
274
- ```
275
-
276
- ### Scenario 2: Ensuring Memory Stability for Long-Duration Live Streams
277
-
278
- #### Scenario Description
279
-
280
- Your app may need to support hours-long or even all-day continuous live streaming, such as game streaming or slow live streams. The app must remain stable and avoid crashes due to long-term operation.
281
-
282
- #### Technical Challenge
283
-
284
- The SDK returns a full `messageList` that grows indefinitely during long live streams. Even if the UI layer throttles updates, the data layer's large array will continue to consume memory, eventually causing the app to crash.
285
-
286
- #### Optimization: Circular Buffer with Fixed Capacity
287
-
288
- Ensure your data source holds only a limited number of messages. Regardless of the size of the full list returned by the SDK, only retain the latest portion for display.
289
-
290
- #### Code Example
291
-
292
- After receiving the full list from the SDK, take only the latest 500 messages (or another number you define) to update the UI.
293
- ``` swift
294
- class BarrageUIManager {
295
- private let capacity: Int = 500 // Retain only the latest 500 messages
296
- // ... (other code as above) ...
297
-
298
- private func refreshUIIfNeeded() {
299
- guard let fullList = self.latestMessageList, let tableView = self.tableView else { return }
300
- self.latestMessageList = nil
301
-
302
- // Only keep the latest N messages
303
- let cappedList = Array(fullList.suffix(self.capacity))
304
-
305
- self.dataSource = cappedList
306
- tableView.reloadData()
307
- }
308
- }
309
- ```
310
-
311
- ### Scenario 3: Rendering Complex Barrage Styles with User Levels and Badges
312
-
313
- #### Scenario Description
314
-
315
- To enhance the live streaming atmosphere and highlight paying users, barrage messages may include rich visual elements such as usernames, user level icons, fan badges, and message content.
316
-
317
- #### Technical Challenge
318
-
319
- Rendering views with multiple images and texts, custom fonts, or complex layouts is more time-consuming than rendering plain text. High-frequency rendering of these complex views in a list increases the main thread's workload, causing lag during list scrolling.
320
-
321
- #### Optimization: Asynchronous Drawing
322
-
323
- Move the view rendering process off the main thread and onto a background thread. The main thread should only handle the final display of the already rendered bitmap, significantly reducing its computational load.
324
-
325
- #### Code Example
326
-
327
- In your custom `UITableViewCell`, enable the layer's `drawsAsynchronously` property to allow the system to perform drawing tasks on a background thread.
328
- ``` swift
329
- import UIKit
330
-
331
- // In your custom barrage cell
332
- class BarrageCell: UITableViewCell {
333
-
334
- // ... (UILabel, UIImageView, and other subview declarations)
335
-
336
- override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
337
- super.init(style: style, reuseIdentifier: reuseIdentifier)
338
-
339
- // Enable asynchronous drawing
340
- self.layer.drawsAsynchronously = true
341
- }
342
-
343
- required init?(coder: NSCoder) {
344
- fatalError("init(coder:) has not been implemented")
345
- }
346
-
347
- func configure(with viewModel: BarrageViewModel) {
348
- // Set label text, images, etc.
349
- // With asynchronous drawing enabled, rendering occurs on a background thread when possible
350
- }
351
-
352
- // Advanced: fully manual drawing
353
- override func draw(_ rect: CGRect) {
354
- // For finer control, manually draw text and images here using Core Graphics
355
- // Combine generating UIImage on a background thread, then draw it in the main thread's draw method for fully asynchronous rendering
356
- }
357
- }
358
- ```
359
-
360
- ## API Documentation
361
-
362
- For detailed information on all public interfaces, properties, and methods of [BarrageStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/barragestore) and related classes, refer to the official API documentation included with the [AtomicXCore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore) framework.
363
-
364
- ## FAQs
365
-
366
- ### In addition to basic text barrages, we also want to implement richer styles such as "colored barrages" and "gift barrages." How can we achieve this?
367
-
368
- You can implement these features using custom messages with `sendCustomMessage`.
369
-
370
- **Implementation Steps**
371
- 1. **Define the Data Structure**: Collaborate with your client and server teams to define the JSON structure for custom messages. For example, a colored barrage can be defined as:
372
-
373
- ``` json
374
- { "type": "colored_text", "text": "This is a colored bullet comment!", "color": "#FF5733" }
375
- ```
376
- 2. **Sender**: When sending, serialize this JSON structure to a string and send it via the `data` parameter of `sendCustomMessage`. The businessID can be set to a unique identifier for your use case, such as `barrage_style_v1`.
377
-
378
- 3. **Receiver**: Upon receiving a barrage message, check whether its messageType is `BarrageType.CUSTOM` and whether the `businessID` matches. If so, parse the data string (usually as JSON), and render your custom UI style based on the parsed data (such as `color`, `text`).
379
-
380
- ### If I call BarrageStore.create(liveID = "some_id") in different classes or files, will this create multiple instances and cause confusion?
381
-
382
- No. The internal mechanism of **AtomicXCore** ensures that as long as you pass in the same liveID, you always get the same `BarrageStore` instance for that live room. You do not need to manage singletons manually.
383
-
384
- ### Why can't I see the message I sent after calling sendTextMessage in the message list?
385
-
386
- **Troubleshooting steps:**
387
- 1. **Check the completion callback**: The `sendTextMessage` method provides a completion callback. Check whether the callback indicates success or failure. If it fails, the error message will indicate the problem (such as "You have been muted," "Network error," etc.).
388
-
389
- 2. **Confirm subscription timing**: Make sure you subscribe to `barrageStore.barrageState.messageList` after the live session for the corresponding liveID has started. If you start listening before joining the live room, you may miss some messages.
390
-
391
- 3. **Check liveID**: Ensure that the liveID used when creating the BarrageStore instance, joining the live room, and sending messages is exactly the same, including case sensitivity.
392
-
393
- 4. **Network issues**: Ensure the device's network connection is normal. Message sending depends on network connectivity.
394
-
395
- ### How can new viewers see historical barrage messages sent before they joined the live room?
396
-
397
- `AtomicXCore` supports retrieving historical chat messages, but you need to enable this feature in the **server console**. Once configured, the SDK handles everything automatically—no additional client code is required.
398
-
399
- #### **Step 1: Configure in the Live Console**
400
- 1. Log in to [**Console > Live > Configuration**](https://console.trtc.io/live/configuration), and select your target application at the top of the page.
401
-
402
- 2. On the Live Configuration page, select **View Past Messages**, and set Previous Messages Viewable to specify the number of messages (up to a maximum of 50) that new viewers can see.
403
-
404
- #### **Step 2: Automatic Retrieval on the Client Side**
405
-
406
- After completing the above configuration, **no changes are needed** in your client code.
407
-
408
- When a new user joins the live room, `AtomicXCore` automatically retrieves the configured number of historical chat messages in the background. These messages are delivered to the UI layer through the `BarrageState` subscription channel, just like real-time messages. Your application will receive and display these historical chat messages in the same way as live messages.