@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,455 +0,0 @@
1
- `GiftStore` is a dedicated module within **AtomicXCore** for managing live room gifting features. It enables you to build a complete gifting system for your live streaming application, supporting robust monetization and interactive experiences.
2
-
3
- |**Gift Panel**|**Barrage Gift**|**Full-Screen Gift**|
4
- |---------|---------|---------|
5
- ||||
6
-
7
- ## Core Features
8
- - **Gift List Retrieval**: Retrieve gift panel data from the server, including gift categories and details.
9
-
10
- - **Send Gift**: Viewers can send selected gifts and specify the quantity to the host.
11
-
12
- - **Gift Event Broadcast:** Receive real-time gift events in the room for displaying gift animations and barrage notifications.
13
-
14
- ## Core Concepts
15
-
16
- |**Core Concept**|**Type**|**Core Responsibilities & Description**|
17
- |---------|---------|---------|
18
- |`Gift`|`data class`|Represents a gift data model, including ID, name, icon URL, animation resource URL (resourceURL), price (coins), and more.|
19
- |`GiftCategory`|`data class`|Represents a gift category (e.g., "Popular", "Luxury"). Contains the category name and a list of Gift objects.|
20
- |`GiftState`|`data class`|Represents the current state of the gift module. The core property, usableGifts, is a StateFlow containing the full gift list from the server.|
21
- |`GiftEvent`|`abstract class`|Defines the event listener for gift events in the live room. Currently, only onReceiveGift is available; all users in the room receive this event when any user sends a gift.|
22
- |`GiftStore`|`abstract class`|The core management class for gift features. Use it to fetch the gift list, send gifts, and receive gift events via listeners.|
23
-
24
- ## Implementation
25
-
26
- ### Step 1: Component Integration
27
-
28
- > **Note:**
29
- >
30
-
31
- > To use the gifting system, activate either the **Free Trial,** or **Pro **edition. The number of configurable gifts depends on the selected package. For details, see the **Gift System** section in Feature and Billing Description and choose the package that fits your needs.
32
- >
33
-
34
- - **Video Live Streaming**: Please refer to Quick Start to integrate AtomicXCore.
35
-
36
- - **Voice Chat Room**: Please refer to Quick Start to integrate AtomicXCore.
37
-
38
- ### Step 2: Initialize and Listen for Gift Events
39
-
40
- Obtain a `GiftStore` instance and set up listeners to receive gift events and updates to the gift list.
41
-
42
- #### Implementation
43
- 1. **Get Instance**: Use `GiftStore.create(liveID) `to obtain a `GiftStore` instance for the current live room.
44
-
45
- 2. **Add Listener**: Add a `GiftListener` to receive `onReceiveGift` events.
46
-
47
- 3. **Subscribe to State**: Subscribe to `giftStore.giftState.usableGifts`to receive gift list updates.
48
-
49
- #### Code Example
50
- ``` kotlin
51
- import io.trtc.tuikit.atomicxcore.api.gift.Gift
52
- import io.trtc.tuikit.atomicxcore.api.gift.GiftCategory
53
- import io.trtc.tuikit.atomicxcore.api.gift.GiftListener
54
- import io.trtc.tuikit.atomicxcore.api.gift.GiftStore
55
- import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
56
- import kotlinx.coroutines.flow.StateFlow
57
- import kotlinx.coroutines.flow.MutableStateFlow
58
- import kotlinx.coroutines.flow.asStateFlow
59
- import kotlinx.coroutines.CoroutineScope
60
- import kotlinx.coroutines.Dispatchers
61
- import kotlinx.coroutines.launch
62
-
63
- class GiftManager(
64
- private val liveId: String
65
- ) {
66
- private val giftStore: GiftStore = GiftStore.create(liveId)
67
- private val coroutineScope = CoroutineScope(Dispatchers.Main)
68
- // Expose gift list externally
69
- private val _giftList = MutableStateFlow<List<GiftCategory>>(emptyList())
70
- val giftList: StateFlow<List<GiftCategory>> = _giftList.asStateFlow()
71
- private val giftListener = object : GiftListener() {
72
- override fun onReceiveGift(liveID: String, gift: Gift, count: Int, sender: LiveUserInfo) {
73
- // Forward event to UI layer for processing
74
- }
75
- }
76
-
77
- init {
78
- setupGiftListener()
79
- subscribeToGiftState()
80
- }
81
-
82
- // Subscribe to gift events
83
- private fun setupGiftListener() {
84
- giftStore.addGiftListener(giftListener)
85
- }
86
-
87
- // Subscribe to gift list state
88
- private fun subscribeToGiftState() {
89
- coroutineScope.launch(Dispatchers.Main) {
90
- giftStore.giftState.usableGifts.collect { giftList ->
91
- _giftList.value = giftList
92
- }
93
- }
94
- }
95
- }
96
- ```
97
-
98
- #### Gift List Structure Parameters
99
- - **GiftCategory Parameter Description**
100
-
101
- |**Parameter**|**Type**|**Description**|
102
- |---------|---------|---------|
103
- |`categoryID`|`String`|Unique ID of the gift category.|
104
- |`name`|`String`|Display name of the gift category.|
105
- |`desc`|`String`|Description of the gift category.|
106
- |`extensionInfo`|`Map<String, String>`|Extension information field.|
107
- |`giftList`|`List`|Array of Gift objects in this category.|
108
-
109
- - **Gift Parameter Description**
110
-
111
- |**Parameter**|**Type**|**Description**|
112
- |---------|---------|---------|
113
- |`giftID`|`String`|Unique ID of the gift.|
114
- |`name`|`String`|Display name of the gift.|
115
- |`desc`|`String`|Description of the gift.|
116
- |`iconURL`|`String`|Gift icon URL.|
117
- |`resourceURL`|`String`|Gift animation resource URL.|
118
- |`level`|`Long`|Gift level.|
119
- |`coins`|`Long`|Gift price.|
120
- |`extensionInfo`|`Map<String, String>`|Extension information field.|
121
-
122
- ### Step 3: Retrieve Gift List
123
-
124
- Call the `refreshUsableGifts` method to fetch gift data from the server.
125
-
126
- #### Implementation
127
- 1. **Call API**: Call `giftStore.refreshUsableGifts()` at the appropriate time (e.g., after entering the live room).
128
-
129
- 2. **Handle Callback**: Optionally handle the completion callback to determine the result.
130
-
131
- 3. **Receive Data**: After a successful fetch, the updated usableGifts list is delivered automatically via your subscription to `giftStore.giftState.usableGifts`.
132
-
133
- #### Code Example
134
- ``` kotlin
135
- class GiftManager(
136
- private val liveId: String
137
- ) {
138
- private val giftStore: GiftStore = GiftStore.create(liveId)
139
-
140
- // Refresh the gift list from the server
141
- fun fetchGiftList() {
142
- giftStore.refreshUsableGifts(object : CompletionHandler {
143
- override fun onSuccess() {
144
- println("Gift list fetched successfully")
145
- // Data will be updated via the giftState subscription
146
- }
147
-
148
- override fun onFailure(code: Int, desc: String) {
149
- println("Failed to fetch gift list: $desc")
150
- }
151
- })
152
- }
153
- }
154
- ```
155
-
156
- ### Step 4: Send Gift
157
-
158
- When a user selects a gift and clicks send, call the `sendGift` API.
159
-
160
- #### Implementation
161
- 1. **Get Parameters**: Obtain the selected `giftID` and `quantity (count)` from the UI.
162
-
163
- 2. **Call API**: Call `giftStore.sendGift(giftID, count, completion)`.
164
-
165
- 3. **Handle Callback**: Use the completion `callback` to handle failures (e.g., insufficient balance). UI updates (animations, barrage) after a successful send should be triggered by the `onReceiveGift` event.
166
-
167
- #### Code Example
168
- ``` kotlin
169
- class GiftManager(
170
- private val liveId: String
171
- ) {
172
- private val giftStore: GiftStore = GiftStore.create(liveId)
173
-
174
- // Send a gift
175
- fun sendGift(giftID: String, count: Int) {
176
- giftStore.sendGift(giftID, count, object : CompletionHandler {
177
- override fun onSuccess() {
178
- println("Gift $giftID sent successfully")
179
- // All users, including the sender, will receive the onReceiveGift event
180
- }
181
-
182
- override fun onFailure(code: Int, desc: String) {
183
- println("Gift send failed: $desc")
184
- // Prompt user if needed, e.g., "Insufficient balance" or "Network error"
185
- }
186
- })
187
- }
188
- }
189
- ```
190
-
191
- #### **sendGift API Parameters**
192
-
193
- |**Parameter Name**|**Type**|**Description**|
194
- |---------|---------|---------|
195
- |`giftID`|`String`|Unique ID of the gift to send.|
196
- |`count`|`Int`|Number of gifts to send.|
197
- |`completion`|`CompletionHandler?`|Callback invoked after sending completes.|
198
-
199
- ## Advanced Features
200
-
201
- The capabilities of `GiftStore` are closely tied to your backend services. This section explains how to build a feature-rich gifting system through server-side configuration and client integration.
202
-
203
- ### Gift Asset Configuration
204
-
205
- Customize available gift types, categories, names, icons, prices, and animation effects to meet your operational and branding requirements.
206
-
207
- #### Implementation
208
- 1. **Server-Side Configuration**: Use the `LiveKit` server REST API to manage gift information, categories, and multi-language support. See the Gift Configuration Guide.
209
-
210
- 2. **Client Fetch**: On the client, call `refreshUsableGifts` to retrieve configuration data.
211
-
212
- 3. **UI Display**: Use the retrieved `List<GiftCategory>` to populate the gift panel.
213
-
214
- #### Configuration Sequence Diagram
215
-
216
- #### Related REST API Interfaces Overview
217
- | <strong>Interface Category</strong> | <strong>Interface</strong> | <strong>Request Example</strong> |
218
- | --- | --- | --- |
219
- | <strong>​Gift Management</strong> | Add Gift Information | Example |
220
- | Delete Gift Information | Example | |
221
- | Query Gift Information | Example | |
222
- | <strong>Gift Category Management</strong> | Add Gift Category Information | Example |
223
- | Delete Specific Gift Category Information | Example | |
224
- | Get Specific Gift Category Information | Example | |
225
- | <strong>Gift Relationship Management</strong> | Add Relationship between a Specific Gift Category and Gift | Example |
226
- | Delete Relationship between a Specific Gift Category and Gift | Example | |
227
- | Get Gift Relationships under a Specific Gift Category | Example | |
228
- | <strong>Gift Multi-language Management</strong> | Add Gift Multi-language Information | Example |
229
- | Delete Specific Gift Multi-language Information | Example | |
230
- | Get Gift Multi-language Information | Example | |
231
- | Add Gift Category Multi-language Information | Example | |
232
- | Delete Specific Gift Category Multi-language Information | Example | |
233
- | Get Gift Category Multi-language Information | Example | |
234
-
235
- ### Billing and Gift Deduction Process
236
-
237
- When a viewer sends a gift, ensure their account balance is sufficient and complete the deduction before triggering the gift effect playback and broadcast.
238
-
239
- #### Implementation
240
- 1. **Backend Callback Configuration**: Configure your billing system's callback URL in the LiveKit backend. See Callback Configuration Documentation.
241
-
242
- 2. **Client Send**: The client calls `sendGift`.
243
-
244
- 3. **Backend Interaction**: The LiveKit backend calls your callback URL; your billing system processes the deduction and returns the result.
245
-
246
- 4. **Result Synchronization**: If successful, **AtomicXCore** broadcasts the `onReceiveGift` event; if failed, the completion callback of sendGift receives an error.
247
-
248
- #### Call Flow
249
-
250
- #### Related REST API Interfaces Overview
251
-
252
- |**Interface**|**Description**|**Request Example**|
253
- |---------|---------|---------|
254
- |**Callback Configuration - Callback before sending a gift**|The customer's backend can use this callback to decide whether to pass pre-gifting checks, etc.|Example|
255
-
256
- ### Implement Full-Screen Gift Animation Playback
257
-
258
- When a user sends a luxury gift (e.g., "Rocket", "Carnival"), play a full-screen animation (such as SVGA) to enhance engagement.
259
-
260
- #### Implementation
261
-
262
- **AtomicXCore** does not include a built-in gift animation player. Integrate a third-party library based on your requirements. Below is a comparison of two options:
263
-
264
- |**Comparison Item**|**Basic Solution (SVGAPlayer)**|**Gift AR (TCEffectPlayerKit)**|
265
- |---------|---------|---------|
266
- |Billing|Free (open source)|Paid (requires license). See [Billing Guide](https://trtc.io/document/69949)|
267
- |Integration Method|Manual integration via Gradle|Requires additional integration and authentication|
268
- |Supported Animation Formats|SVGA only|SVGA, PAG, WebP, Lottie, MP4, and more|
269
- |Performance|Recommended SVGA file size ≤ 10MB|Supports larger files, better performance for complex/multiple/low-end scenarios|
270
- |Recommended Scenario|Uniform SVGA format, controllable file size|Multiple formats or higher performance/device compatibility needs|
271
-
272
- This section demonstrates the basic solution. For the **Gift AR** see the [TCEffectPlayer Integration Guide](https://trtc.io/document/70531).
273
-
274
- #### Basic Solution: Using SVGAPlayer
275
- 1. **Integrate SVGAPlayer**: Add the SVGAPlayer dependency to your build.gradle and sync the project.
276
-
277
- ``` gradle
278
- dependencies {
279
- // ... other dependencies
280
- implementation 'com.github.yyued:SVGAPlayer-Android:2.6.1'
281
- }
282
- ```
283
- 2. **Listen for Gift Events**: Subscribe to the `GiftListener` in `GiftStore`.
284
-
285
- 3. **Parse and Play**: On `onReceiveGift`, check if `gift.resourceURL` is a valid SVGA file. Use `SVGAParser` to parse and play the animation.
286
-
287
- #### Code Example
288
- ``` kotlin
289
- import android.os.Bundle
290
- import androidx.appcompat.app.AppCompatActivity
291
- import com.opensource.svgaplayer.SVGACallback
292
- import com.opensource.svgaplayer.SVGAParser
293
- import com.opensource.svgaplayer.SVGAVideoEntity
294
- import com.opensource.svgaplayer.SVGAImageView
295
- import io.trtc.tuikit.atomicxcore.api.gift.Gift
296
- import io.trtc.tuikit.atomicxcore.api.gift.GiftListener
297
- import io.trtc.tuikit.atomicxcore.api.gift.GiftStore
298
- import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
299
- import java.net.URL
300
-
301
- class LiveRoomActivity : AppCompatActivity() {
302
- private lateinit var giftStore: GiftStore
303
- private lateinit var svgaImageView: SVGAImageView
304
- private lateinit var svgaParser: SVGAParser
305
-
306
- override fun onCreate(savedInstanceState: Bundle?) {
307
- super.onCreate(savedInstanceState)
308
- setContentView(R.layout.activity_live_room)
309
- setupSVGAPlayer()
310
-
311
- svgaImageView.loops = 1
312
-
313
- svgaImageView.callback = object : SVGACallback {
314
- override fun onFinished() {
315
- svgaImageView.visibility = android.view.View.GONE
316
- svgaImageView.clear()
317
- }
318
- override fun onPause() {}
319
- override fun onRepeat() {}
320
- override fun onStep(frame: Int, percentage: Double) {}
321
- }
322
-
323
- }
324
-
325
- private fun setupSVGAPlayer() {
326
- svgaImageView = findViewById(R.id.svga_player)
327
- svgaParser = SVGAParser(this)
328
- svgaImageView.visibility = android.view.View.GONE
329
- }
330
-
331
- private val giftListener = object : GiftListener() {
332
- override fun onReceiveGift(liveID: String, gift: Gift, count: Int, sender: LiveUserInfo) {
333
- if (gift.resourceURL.isNotEmpty()) {
334
- try {
335
- val url = URL(gift.resourceURL)
336
- playAnimation(url)
337
- } catch (e: Exception) {
338
- println("Invalid animation URL: ${gift.resourceURL}")
339
- }
340
- }
341
- }
342
- }
343
-
344
- fun setupGiftSubscription(liveId: String) {
345
- giftStore = GiftStore.create(liveId)
346
-
347
- giftStore.addGiftListener(giftListener)
348
- }
349
-
350
- private fun playAnimation(url: URL) {
351
- svgaParser.decodeFromURL(url, object : SVGAParser.ParseCompletion {
352
- override fun onComplete(videoItem: SVGAVideoEntity) {
353
- runOnUiThread {
354
- svgaImageView.setVideoItem(videoItem)
355
- svgaImageView.visibility = android.view.View.VISIBLE
356
- svgaImageView.startAnimation()
357
- }
358
- }
359
-
360
- override fun onError() {
361
- println("SVGA animation parsing failed")
362
- // Optionally add retry or error reporting
363
- }
364
- })
365
- }
366
- }
367
- ```
368
-
369
- ### Display Gift Messages in the Barrage Area
370
-
371
- When a user sends a gift, display a system message in the public barrage area (e.g., "[Viewer Nickname] sent [Gift Name] x [Quantity]") for all viewers.
372
-
373
- #### Implementation
374
- 1. **Listen for Events**: Subscribe to the `GiftListener` in `giftStore`.
375
-
376
- 2. **Obtain Information**: On `onReceiveGift`, extract the sender, gift, and count.
377
-
378
- 3. **Get Barrage Store**: Use `BarrageStore.create(liveID)` for the current room.
379
-
380
- 4. **Compose Message**: Create a Barrage object, set `messageType = BarrageType.TEXT`, and set textContent to your message.
381
-
382
- 5. **Insert Locally**: Call `barrageStore.appendLocalTip(message: giftTip)` to add the message to the local barrage list.
383
-
384
- #### Code Example
385
- ``` kotlin
386
- import io.trtc.tuikit.atomicxcore.api.barrage.Barrage
387
- import io.trtc.tuikit.atomicxcore.api.barrage.BarrageStore
388
- import io.trtc.tuikit.atomicxcore.api.barrage.BarrageType
389
- import io.trtc.tuikit.atomicxcore.api.gift.Gift
390
- import io.trtc.tuikit.atomicxcore.api.gift.GiftListener
391
- import io.trtc.tuikit.atomicxcore.api.gift.GiftStore
392
- import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
393
-
394
- class LiveRoomManager(
395
- private val liveId: String
396
- ) {
397
- private val giftStore: GiftStore = GiftStore.create(liveId)
398
- private val barrageStore: BarrageStore = BarrageStore.create(liveId)
399
-
400
- private val giftListener = object : GiftListener() {
401
- override fun onReceiveGift(liveID: String, gift: Gift, count: Int, sender: LiveUserInfo) {
402
-
403
- val tipText = "${sender.userName} sent ${gift.name} x $count"
404
- val giftTip = Barrage(
405
- liveID = liveID,
406
- messageType = BarrageType.TEXT,
407
- textContent = tipText
408
- sender = sender
409
- )
410
- barrageStore.appendLocalTip(giftTip)
411
-
412
- }
413
- }
414
-
415
- private fun setupGiftToBarrageFlow() {
416
- giftStore.addGiftListener(giftListener)
417
- }
418
- }
419
- ```
420
-
421
- ## API Documentation
422
-
423
- For complete details on all public interfaces, properties, and methods of [GiftStore](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.gift/-gift-store/index.html) and related classes, see the official API documentation for [AtomicXCore](https://tencent-rtc.github.io/TUIKit_Android/index.html). Key stores referenced in this guide include:
424
-
425
- |**Store/Component**|**Feature Description**|**API Documentation**|
426
- |---------|---------|---------|
427
- |GiftStore|Gift interactions: fetch gift list, send/receive gifts, listen for gift events (including sender and gift details).|[API Documentation](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.gift/-gift-store/index.html)|
428
- |BarrageStore|Barrage features: send text/custom barrage, maintain barrage list, listen to barrage status in real time.|[API Documentation](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.barrage/-barrage-store/index.html)|
429
-
430
- ## FAQs
431
-
432
- ### The gift list in GiftStore is empty. What should I do?
433
-
434
- You must call `refreshUsableGifts(completion)` to fetch gift data from your backend. Ensure your backend is configured with gift data via the server REST API.
435
-
436
- ### How do I implement multi-language display for gifts (e.g., Chinese, English)?
437
-
438
- Use the `GiftStore.setLanguage(language: String)` API before calling `refreshUsableGifts`, passing the target language code (e.g., "en" or "zh-CN"). The server will return gift names and descriptions in the specified language.
439
-
440
- ### I called sendGift, but the gift animation plays twice. Why?
441
-
442
- The `onReceiveGift` event is broadcast to all room members, including the sender. If you update the UI both in the sendGift completion callback and in the `onReceiveGift` event, the animation will play twice.
443
- - **Best Practice**: Only update the UI (e.g., play animations, show barrage) in the `onReceiveGift` event handler. Use the `sendGift` completion callback only for handling failures (such as "Send failed" or "Insufficient balance").
444
-
445
- ### Where is the gift deduction logic implemented?
446
-
447
- Gift deduction is handled entirely by your billing system. AtomicXCore integrates with your billing system via a backend callback. When the client calls sendGift, your backend performs the deduction. After returning the result to the AtomicXCore backend, it determines whether to broadcast the gift event.
448
-
449
- ### Will gift notifications be blocked by mute or message frequency controls?
450
-
451
- No. Gift notifications (`onReceiveGift` events) are not affected by mute or frequency controls and are always delivered reliably.
452
-
453
- ### What should I do if gift animation playback stutters?
454
-
455
- Check your SVGA file size; the basic player recommends files no larger than 10MB. For large or complex animations, consider integrating the **Gift AR** provided by TUILiveKit for improved performance.