@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,407 +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 virtual gifts to the host.
11
-
12
- - **Gift Event Broadcasting:** Real-time synchronization of gift events across all clients in the room to trigger animations and barrage notifications.
13
-
14
- ## Core Concepts
15
- | <strong>Core Concept</strong> | <strong>Type</strong> | <strong>Core Responsibilities & Description</strong> |
16
- | --- | --- | --- |
17
- | <code>Gift</code> | <code>struct</code> | Represents a gift data model, including ID, name, icon URL, animation resource URL (resourceURL), price (coins), and more. |
18
- | <code>GiftCategory</code> | <code>struct</code> | - Represents a grouping of gifts (e.g., "Popular", "Luxury").<br>- Contains a category name and an array of Gift objects. |
19
- | <code>GiftState</code> | <code>struct</code> | - Represents the current state of the gift module.<br>- The core property, usableGifts, is a StateFlow containing the full gift list from the server. |
20
- | <code>GiftEvent</code> | <code>enum</code> | Defines the event listener for gift events in the live room. Currently, only <code>onReceiveGift</code> is available. This event is broadcast to all users in the room (including the sender) whenever a gift is successfully sent. |
21
- | <code>GiftStore</code> | <code>class</code> | - The core management class for gift features.<br>- Used to fetch gift lists, execute send requests, and listen for global gift events. |
22
-
23
- ## Implementation
24
-
25
- ### Step 1: Component Integration
26
-
27
- > **Note:**
28
- >
29
-
30
- > 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.
31
- >
32
-
33
- - **Video Live Streaming**: Please refer to Quick Start to integrate AtomicXCore.
34
-
35
- - **Voice Chat Room**: Please refer to Quick Start to integrate AtomicXCore.
36
-
37
- ### Step 2: Initialize and Listen for Gift Events
38
-
39
- Obtain a `GiftStore` instance and set up subscribers to receive gift events and gift list updates.
40
-
41
- #### Implementation
42
- 1. **Get Instance**: Call `GiftStore.create(liveID:)` to obtain a `GiftStore` instance bound to the current live room.
43
-
44
- 2. **Subscribe to Events**: Subscribe to `giftStore.giftEventPublisher` to receive `.onReceiveGift` events.
45
-
46
- 3. **Subscribe to State**: Subscribe to `giftStore.state` to obtain the `usableGifts` gift list.
47
-
48
- #### Code Example
49
- ``` swift
50
- import Foundation
51
- import AtomicXCore
52
- import Combine
53
-
54
- class GiftManager {
55
- private let liveId: String
56
- private let giftStore: GiftStore
57
- private var cancellables = Set<AnyCancellable>()
58
-
59
- // Expose gift events for the UI layer to subscribe and trigger animations
60
- let giftEventPublisher = PassthroughSubject<GiftEvent, Never>()
61
- // Expose gift list externally
62
- let giftListPublisher = CurrentValueSubject<[GiftCategory], Never>([])
63
-
64
- init(liveId: String) {
65
- self.liveId = liveId
66
- // 1. Obtain GiftStore instance using liveId
67
- self.giftStore = GiftStore.create(liveID: liveId)
68
-
69
- subscribeToGiftState()
70
- subscribeToGiftEvents()
71
- }
72
-
73
- /// 2. Subscribe to gift events
74
- private func subscribeToGiftEvents() {
75
- giftStore.giftEventPublisher
76
- .receive(on: DispatchQueue.main)
77
- .sink { [weak self] event in
78
- // Forward the event to the UI layer for handling
79
- self?.giftEventPublisher.send(event)
80
- }
81
- .store(in: &cancellables)
82
- }
83
-
84
- /// 3. Subscribe to gift list state
85
- private func subscribeToGiftState() {
86
- giftStore.state
87
- .subscribe(StatePublisherSelector(keyPath: \GiftState.usableGifts))
88
- .receive(on: DispatchQueue.main)
89
- .assign(to: \.value, on: giftListPublisher)
90
- .store(in: &cancellables)
91
- }
92
- }
93
- ```
94
-
95
- #### Gift List Struct Parameters
96
- - **GiftCategory Parameter Description**
97
-
98
- |**Parameter**|**Type**|**Description**|
99
- |---------|---------|---------|
100
- |`categoryID`|`String`|Unique ID of the gift category.|
101
- |`name`|`String`|Display name of the gift category.|
102
- |`desc`|`String`|Description of the gift category.|
103
- |`extensionInfo`|`[String: String]`|Extension information field.|
104
- |`giftList`|`[`[Gift](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/gift)`]`|Array of Gift objects contained in this category.|
105
-
106
- - **Gift Parameter Description**
107
-
108
- |**Parameter**|**Type**|**Description**|
109
- |---------|---------|---------|
110
- |`giftID`|`String`|Unique ID of the gift.|
111
- |`name`|`String`|Display name of the gift.|
112
- |`desc`|`String`|Description of the gift.|
113
- |`iconURL`|`String`|Gift icon URL.|
114
- |`resourceURL`|`String`|Gift animation resource URL.|
115
- |`level`|`UInt`|Gift level.|
116
- |`coins`|`UInt`|Gift price.|
117
- |`extensionInfo`|`[String: String]`|Extension information field.|
118
-
119
- ### Step 3: Retrieve Gift List
120
-
121
- Call the `refreshUsableGifts` method to fetch gift data from the server.
122
-
123
- #### Implementation
124
- 1. **Call API**: Call `giftStore.refreshUsableGifts` (typically after entering the room).
125
-
126
- 2. **Handle Callback**: Handle the completion block for error checking.
127
-
128
- 3. **Receive Data**: Upon success, the data flows automatically through the giftListPublisher set up in Step 2.
129
-
130
- #### Code Example
131
- ``` swift
132
- extension GiftManager {
133
- /// Refresh the gift list from the server
134
- func fetchGiftList() {
135
- giftStore.refreshUsableGifts { result in
136
- switch result {
137
- case .success:
138
- print("Gift list fetched successfully")
139
- // On success, data is automatically updated via the state subscription
140
- case .failure(let error):
141
- print("Failed to fetch gift list: \(error.localizedDescription)")
142
- }
143
- }
144
- }
145
- }
146
- ```
147
-
148
- ### Step 4: Send Gift
149
-
150
- Trigger the sending logic when a user interacts with the gift panel.
151
-
152
- #### Implementation
153
- 1. **Prepare Data**: Retrieve the selected `giftID` and quantity (`count`) from your UI.
154
-
155
- 2. **Call API**: Call `giftStore.sendGift(giftID:count:completion:)`.
156
-
157
- 3. **Handle Result**: Use the completion block only to handle failures (e.g., balance errors). Successful sends are handled via the global `.onReceiveGift` event listener to ensure consistency.
158
-
159
- #### Code Example
160
- ``` swift
161
- extension GiftManager {
162
- /// User sends a gift
163
- func sendGift(giftID: String, count: UInt) {
164
- giftStore.sendGift(giftID: giftID, count: count) { result in
165
- switch result {
166
- case .success:
167
- print("Gift \(giftID) sent successfully")
168
- // After a successful send, everyone in the room, including the sender, will receive the onReceiveGift event
169
- case .failure(let error):
170
- print("Failed to send gift: \(error.localizedDescription)")
171
- // Prompt the user, e.g., "Insufficient balance" or "Network error"
172
- }
173
- }
174
- }
175
- }
176
- ```
177
-
178
- #### sendGift API Parameters
179
-
180
- |**Parameter Name**|**Type**|**Description**|
181
- |---------|---------|---------|
182
- |`giftID`|`String`|The unique ID of the gift to send.|
183
- |`count`|`UInt`|The number of gifts to send.|
184
- |`completion`|`CompletionClosure?`|Callback after sending is complete.|
185
-
186
- ## Advanced Features
187
-
188
- The `GiftStore` module is designed to work seamlessly with your backend infrastructure. This section outlines how to configure assets and integrate advanced playback features.
189
-
190
- ### Gift Asset Configuration
191
-
192
- You can fully customize your gift inventory (names, icons, prices, animations) to match your branding.
193
-
194
- #### Implementation
195
- 1. **Server-Side Configuration**: Use the LiveKit server REST API to manage gift information, categories, and multi-language support. See the Gift Configuration Guide.
196
-
197
- 2. **Client Fetch**: On the client, call `refreshUsableGifts` to retrieve configuration data.
198
-
199
- 3. **UI Display**: Use the retrieved `List<GiftCategory>` to render the gift panel.
200
-
201
- #### Configuration Sequence Diagram
202
-
203
- #### Related REST API Interfaces Overview
204
- | <strong>Interface Category</strong> | <strong>Interface</strong> | <strong>Request Example</strong> |
205
- | --- | --- | --- |
206
- | <strong>​Gift Management</strong> | Add Gift Information | Example |
207
- | Delete Gift Information | Example | |
208
- | Query Gift Information | Example | |
209
- | <strong>Gift Category Management</strong> | Add Gift Category Information | Example |
210
- | Delete Specific Gift Category Information | Example | |
211
- | Get Specific Gift Category Information | Example | |
212
- | <strong>Gift Relationship Management</strong> | Add Relationship between a Specific Gift Category and Gift | Example |
213
- | Delete Relationship between a Specific Gift Category and Gift | Example | |
214
- | Get Gift Relationships under a Specific Gift Category | Example | |
215
- | <strong>Gift Multi-language Management</strong> | Add Gift Multi-language Information | Example |
216
- | Delete Specific Gift Multi-language Information | Example | |
217
- | Get Gift Multi-language Information | Example | |
218
- | Add Gift Category Multi-language Information | Example | |
219
- | Delete Specific Gift Category Multi-language Information | Example | |
220
- | Get Gift Category Multi-language Information | Example | |
221
-
222
- ### Billing and Gift Deduction Process
223
-
224
- AtomicXCore delegates the billing logic to your backend to ensure security and flexibility.
225
-
226
- #### Workflow
227
- 1. **Backend Callback Configuration**: Configure your billing system's callback URL in the LiveKit backend. See Callback Configuration Documentation.
228
-
229
- 2. **Client Request**: The client calls `sendGift`.
230
-
231
- 3. **Backend Verification**: The LiveKit backend calls your callback URL; your billing system processes the deduction and returns the result.
232
-
233
- 4. **Result Synchronization**: If succeeds, **AtomicXCore** broadcasts the `onReceiveGift` event; if fails, the completion callback of `sendGift` receives an error.
234
-
235
- #### Call Flow
236
-
237
- #### Related REST API Interfaces Overview
238
- | <strong>Interface</strong> | <strong>Description</strong> | <strong>Request Example</strong> |
239
- | --- | --- | --- |
240
- | <strong>Callback Configuration - Callback before sending a gift</strong> | Pre-gifting validation hook.<br>Allows your backend to intercept gift requests to perform necessary checks (e.g., sufficient balance, risk control) before the gift is processed. | Example |
241
-
242
- ### Full-Screen Animation (SVGA Integration)
243
-
244
- When a user sends a luxury gift (e.g., "Rocket", "Carnival"), play a full-screen animation (such as SVGA) to enhance engagement.
245
-
246
- #### Implementation
247
-
248
- **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:
249
-
250
- |**Comparison Item**|**Basic Solution (SVGAPlayer)**|**Gift AR (TCEffectPlayerKit)**|
251
- |---------|---------|---------|
252
- |Billing|Free (open source)|Paid (License Required). See [Billing Guide](https://trtc.io/document/69949)|
253
- |Integration Method|Manual integration via Gradle|Requires additional integration and authentication|
254
- | Formats|SVGA only|SVGA, PAG, WebP, Lottie, MP4, and more|
255
- |Performance|Good for files < 10MB|Optimized for large assets & complex layering|
256
- |Recommended Scenario|Uniform SVGA format, controllable file size|Multiple formats or higher performance/device compatibility needs|
257
-
258
- This section demonstrates the basic solution. For the **Gift AR**, see the [TCEffectPlayer Integration Guide](https://trtc.io/document/70537).
259
-
260
- #### Basic Solution Implementation: Using SVGAPlayer
261
- 1. **Integrate SVGAPlayer**: In your `Podfile`, add the dependency for `SVGAPlayer` and run `pod install` in the terminal.
262
-
263
- ``` ruby
264
- target 'YourApp' do
265
- # ... other pods
266
- pod 'SVGAPlayer'
267
- end
268
- ```
269
- 2. **Listen for Gift Events**: Subscribe to GiftStore's `giftEventPublisher`.
270
-
271
- 3. **Parse and Play**: When receiving an `.onReceiveGift` event, check if `gift.resourceURL` is valid and points to an SVGA file. If so, use `SVGAParser` to parse the URL and pass the parsed `SVGAVideoEntity` to the `SVGAPlayer` instance for playback.
272
-
273
- #### Code Example
274
- ``` swift
275
- import UIKit
276
- import AtomicXCore
277
- import Combine
278
- import SVGAPlayer // 1. Import
279
-
280
- class LiveRoomViewController: UIViewController, SVGAPlayerDelegate {
281
- private var giftManager: GiftManager!
282
- private var cancellables = Set<AnyCancellable>()
283
- private let svgaPlayer = SVGAPlayer() // 2. Prepare instance
284
- private let svgaParser = SVGAParser()
285
-
286
- override func viewDidLoad() {
287
- super.viewDidLoad()
288
- setupSVGAPlayer()
289
- }
290
-
291
- private func setupSVGAPlayer() {
292
- svgaPlayer.delegate = self
293
- svgaPlayer.loops = 1 // Play once by default
294
- svgaPlayer.clearsAfterStop = true // Automatically clear after playback
295
- view.addSubview(svgaPlayer)
296
- svgaPlayer.frame = view.bounds // Full screen by default
297
- svgaPlayer.isHidden = true
298
- }
299
-
300
- func setupGiftSubscription(liveId: String) {
301
- self.giftManager = GiftManager(liveId: liveId)
302
-
303
- giftManager.giftEventPublisher
304
- .sink { [weak self] event in // 3. Listen for events
305
- guard case .onReceiveGift(_, let gift, _, _) = event else { return }
306
-
307
- if !gift.resourceURL.isEmpty, let url = URL(string: gift.resourceURL) { // 4. Parse and play
308
- self?.playAnimation(from: url)
309
- }
310
- }
311
- .store(in: &cancellables)
312
- }
313
-
314
- private func playAnimation(from url: URL) {
315
- svgaParser.parse(with: url, completionBlock: { [weak self] videoItem in
316
- guard let self = self, let videoItem = videoItem else { return }
317
- DispatchQueue.main.async {
318
- self.svgaPlayer.videoItem = videoItem
319
- self.svgaPlayer.isHidden = false
320
- self.svgaPlayer.startAnimation()
321
- }
322
- }, failureBlock: { error in
323
- print("Failed to parse SVGA animation: \(error?.localizedDescription ?? "unknown error")")
324
- // Add retry or error reporting logic as needed
325
- })
326
- }
327
-
328
- func svgaPlayerDidFinishedAnimation(_ player: SVGAPlayer!) { /* ... Handle end of playback ... */ }
329
- }
330
- ```
331
-
332
- ### Display Gift Notifications in Barrage
333
-
334
- Enhance social interaction by displaying a system notification in the public barrage (chat) area whenever a gift is sent (e.g., "[User] sent [Gift] x [Count]").
335
-
336
- #### Implementation
337
- 1. **Listen for Events**: Subscribe to `giftStore.giftEventPublisher`.
338
-
339
- 2. **Extract Information**: After receiving the` .onReceiveGift` event, extract the sender, gift, and count.
340
-
341
- 3. **Get Barrage Store**: Use `BarrageStore.create(liveID:)` to get the instance bound to the current room.
342
-
343
- 4. **Compose Message**: Create a `Barrage` struct, set `messageType = .text`, and set `textContent` to the composed string (e.g., "[sender.userName] sent [gift.name] x [count]").
344
-
345
- 5. **Insert Locally**: Call `barrageStore.appendLocalTip(message: giftTip)` to insert the message into the local list.
346
-
347
- #### Code Example
348
- ``` swift
349
- // In LiveRoomManager or a similar top-level manager
350
- private func setupGiftToBarrageFlow() {
351
- giftStore.giftEventPublisher
352
- .receive(on: DispatchQueue.main)
353
- .sink { [weak self] event in // 1. Listen for events
354
- guard case .onReceiveGift(_, let gift, let count, let sender) = event else { return } // 2. Extract information
355
-
356
- guard let self = self else { return }
357
- // 3. Get BarrageStore (assume barrageStore is already initialized)
358
-
359
- // 4. Compose message
360
- let tipText = "\(sender.userName) sent \(gift.name) x \(count)"
361
- var giftTip = Barrage()
362
- giftTip.messageType = .text
363
- giftTip.textContent = tipText
364
- // Optional: set a special sender
365
-
366
- // 5. Insert locally
367
- self.barrageStore.appendLocalTip(message: giftTip)
368
- }
369
- .store(in: &cancellables)
370
- }
371
- ```
372
-
373
- ## API Documentation
374
-
375
- For complete details on all public interfaces, properties, and methods of [GiftStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/giftstore) and related classes, see the official API documentation for [AtomicXCore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore). Key stores referenced in this guide include:
376
-
377
- |**Store/Component**|**Feature Description**|**API Documentation**|
378
- |---------|---------|---------|
379
- |GiftStore|Fetch gift list, send/receive gifts, listen for gift events (including sender and gift details).|[API Documentation](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/giftstore)|
380
- |BarrageStore|Send text/custom barrage, maintain barrage list, listen to barrage status in real time.|[API Documentation](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/barragestore)|
381
-
382
- ## FAQs
383
-
384
- ### The gift list in GiftStore is empty. What should I do?
385
-
386
- 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.
387
-
388
- ### How do I implement multi-language display for gifts (e.g., Chinese, English)?
389
-
390
- 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.
391
-
392
- ### I called sendGift, but the gift animation plays twice. Why?
393
-
394
- 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.
395
- - **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").
396
-
397
- ### Where is the gift deduction logic implemented?
398
-
399
- 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.
400
-
401
- ### Will gift notifications be blocked by mute or message frequency controls?
402
-
403
- No. Gift notifications (`onReceiveGift` events) are not affected by mute or frequency controls and are always delivered reliably.
404
-
405
- ### What should I do if gift animation playback stutters?
406
-
407
- 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.