@tencentcloud/sdk-mcp 1.6.3 → 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 (302) hide show
  1. package/index.js +0 -4
  2. package/knowledge/build-index.js +1 -1
  3. package/knowledge/chunker.js +81 -52
  4. package/knowledge/path-meta.js +181 -21
  5. package/knowledge/search/exact-lookup.js +166 -0
  6. package/knowledge/search/filter-pool.js +73 -19
  7. package/knowledge/search/product-scope-intent.js +2 -2
  8. package/knowledge/search/requires-framework.js +1 -1
  9. package/knowledge/search/search-knowledge.js +234 -57
  10. package/package.json +1 -1
  11. package/resource/_schema/feature-aliases.yaml +1 -0
  12. package/resource/integration/callkit/preset/android/integration.md +3 -5
  13. package/resource/integration/callkit/preset/flutter/integration.md +2 -3
  14. package/resource/integration/callkit/preset/ios/integration.md +2 -5
  15. package/resource/integration/callkit/preset/react/integration.md +12 -26
  16. package/resource/integration/callkit/preset/vue/integration.md +17 -33
  17. package/resource/integration/chat/preset/android/integration.md +44 -14
  18. package/resource/integration/chat/preset/flutter/integration.md +54 -13
  19. package/resource/integration/chat/preset/ios/integration.md +42 -6
  20. package/resource/integration/chat/preset/react/integration.md +30 -28
  21. package/resource/integration/chat/preset/uni-app/integration.md +101 -40
  22. package/resource/integration/chat/preset/vue/integration.md +62 -28
  23. package/resource/integration/livekit/preset/live/android/live-audience-integration.md +133 -0
  24. package/resource/integration/livekit/preset/live/android/live-host-integration.md +225 -0
  25. package/resource/integration/livekit/preset/live/android/live-list-integration.md +278 -0
  26. package/resource/integration/livekit/preset/live/android/prepare-integration.md +271 -0
  27. package/resource/integration/livekit/preset/live/ios/live-audience-integration.md +207 -0
  28. package/resource/integration/livekit/preset/live/ios/live-host-integration.md +358 -0
  29. package/resource/integration/livekit/preset/live/ios/live-list-integration.md +246 -0
  30. package/resource/integration/livekit/preset/live/ios/prepare-integration.md +218 -0
  31. package/resource/integration/livekit/preset/live/vue/live-list-integration.md +4 -7
  32. package/resource/integration/livekit/preset/live/vue/live-player-desk-integration.md +5 -12
  33. package/resource/integration/livekit/preset/live/vue/live-player-h5-integration.md +4 -11
  34. package/resource/integration/livekit/preset/live/vue/live-pusher-integration.md +250 -482
  35. package/resource/integration/roomkit/preset/vue/integration.md +399 -106
  36. package/resource/knowledge/callkit/best-practice/web/callengine-invitation.md +80 -0
  37. package/resource/knowledge/callkit/best-practice/web/callengine-log-control.md +20 -0
  38. package/resource/knowledge/callkit/best-practice/web/callkit-call-vs-calls.md +116 -0
  39. package/resource/knowledge/callkit/core-sdk/android/answer-call.md +11 -15
  40. package/resource/knowledge/callkit/core-sdk/android/make-call.md +10 -13
  41. package/resource/knowledge/callkit/core-sdk/android/offline-push.md +2 -4
  42. package/resource/knowledge/callkit/core-sdk/flutter/answer-call.md +10 -17
  43. package/resource/knowledge/callkit/core-sdk/flutter/make-call.md +11 -17
  44. package/resource/knowledge/callkit/core-sdk/flutter/offline-push.md +11 -20
  45. package/resource/knowledge/callkit/core-sdk/ios/answer-call.md +10 -15
  46. package/resource/knowledge/callkit/core-sdk/ios/make-call.md +9 -14
  47. package/resource/knowledge/callkit/core-sdk/ios/offline-push.md +12 -18
  48. package/resource/knowledge/callkit/core-sdk/miniprogram/call-engine.md +390 -0
  49. package/resource/knowledge/callkit/core-sdk/miniprogram/call-event.md +317 -0
  50. package/resource/knowledge/callkit/core-sdk/uni-app/answer-call.md +16 -22
  51. package/resource/knowledge/callkit/core-sdk/uni-app/make-call.md +17 -23
  52. package/resource/knowledge/callkit/core-sdk/web/call-engine.md +39 -0
  53. package/resource/knowledge/callkit/core-sdk/web/call-event.md +341 -0
  54. package/resource/knowledge/callkit/core-sdk/web/callengine-api-overview.md +39 -0
  55. package/resource/knowledge/callkit/faq/android.md +1 -5
  56. package/resource/knowledge/callkit/faq/common.md +10 -12
  57. package/resource/knowledge/callkit/faq/ios.md +5 -7
  58. package/resource/knowledge/callkit/faq/uniapp-app.md +7 -7
  59. package/resource/knowledge/callkit/faq/uniapp-miniprogram.md +9 -12
  60. package/resource/knowledge/callkit/faq/web.md +2 -12
  61. package/resource/knowledge/callkit/preset/android/api.md +5 -8
  62. package/resource/knowledge/callkit/preset/ios/api.md +4 -6
  63. package/resource/knowledge/callkit/preset/miniprogram/api.md +295 -0
  64. package/resource/knowledge/callkit/preset/react/api.md +622 -0
  65. package/resource/knowledge/callkit/preset/react/uikit-api-reference.md +475 -0
  66. package/resource/knowledge/callkit/preset/vue/api.md +622 -0
  67. package/resource/knowledge/callkit/preset/vue/uikit-api-reference.md +587 -0
  68. package/resource/knowledge/callkit/preset/web/api.md +1 -1
  69. package/resource/knowledge/chat/best-practice/web/image-message-url-handling.md +16 -0
  70. package/resource/knowledge/chat/preset/android/features/chat-setting.md +1 -1
  71. package/resource/knowledge/chat/preset/android/features/conversation-list.md +0 -1
  72. package/resource/knowledge/chat/preset/android/features/language.md +2 -4
  73. package/resource/knowledge/chat/preset/android/features/message-input.md +1 -1
  74. package/resource/knowledge/chat/preset/android/features/message-list.md +1 -2
  75. package/resource/knowledge/chat/preset/android/features/search.md +0 -1
  76. package/resource/knowledge/chat/preset/android/features/theme.md +1 -1
  77. package/resource/knowledge/chat/preset/android-view/integration.md +35 -10
  78. package/resource/knowledge/chat/preset/flutter/features/conversation-list.md +0 -1
  79. package/resource/knowledge/chat/preset/flutter/features/language.md +1 -1
  80. package/resource/knowledge/chat/preset/flutter/features/message-list.md +0 -1
  81. package/resource/knowledge/chat/preset/flutter/features/search.md +4 -5
  82. package/resource/knowledge/chat/preset/flutter/features/theme.md +1 -1
  83. package/resource/knowledge/chat/preset/ios/features/chat-setting.md +1 -1
  84. package/resource/knowledge/chat/preset/ios/features/conversation-list.md +0 -1
  85. package/resource/knowledge/chat/preset/ios/features/language.md +2 -5
  86. package/resource/knowledge/chat/preset/ios/features/message-list.md +0 -1
  87. package/resource/knowledge/chat/preset/ios/features/search.md +0 -1
  88. package/resource/knowledge/chat/preset/ios/features/theme.md +1 -1
  89. package/resource/knowledge/chat/preset/ios-uikit/integration.md +57 -166
  90. package/resource/knowledge/chat/preset/react/features/chat-setting.md +0 -1
  91. package/resource/knowledge/chat/preset/react/features/conversation-actions.md +3 -3
  92. package/resource/knowledge/chat/preset/react/features/conversation-list.md +3 -3
  93. package/resource/knowledge/chat/preset/react/features/conversation-preview.md +1 -1
  94. package/resource/knowledge/chat/preset/react/features/message-input.md +2 -3
  95. package/resource/knowledge/chat/preset/react/features/search.md +0 -1
  96. package/resource/knowledge/chat/preset/vue/features/chat-header.md +1 -1
  97. package/resource/knowledge/chat/preset/vue/features/chat-setting.md +3 -4
  98. package/resource/knowledge/chat/preset/vue/features/conversation-list.md +4 -4
  99. package/resource/knowledge/chat/preset/vue/features/conversation-preview.md +1 -1
  100. package/resource/knowledge/chat/preset/vue/features/message-input.md +2 -2
  101. package/resource/knowledge/chat/preset/vue/features/message-list.md +2 -2
  102. package/resource/knowledge/chat/preset/vue/features/search.md +0 -1
  103. package/resource/knowledge/chat/preset/vue/features/theme.md +4 -4
  104. package/resource/knowledge/livekit/core-sdk/api-reference/android/AudioEffectStore.md +0 -7
  105. package/resource/knowledge/livekit/core-sdk/api-reference/android/BarrageStore.md +2 -5
  106. package/resource/knowledge/livekit/core-sdk/api-reference/android/BattleStore.md +12 -15
  107. package/resource/knowledge/livekit/core-sdk/api-reference/android/CameraView.md +0 -1
  108. package/resource/knowledge/livekit/core-sdk/api-reference/android/CoGuestStore.md +0 -5
  109. package/resource/knowledge/livekit/core-sdk/api-reference/android/CoHostStore.md +0 -3
  110. package/resource/knowledge/livekit/core-sdk/api-reference/android/DeviceStore.md +0 -2
  111. package/resource/knowledge/livekit/core-sdk/api-reference/android/GiftStore.md +2 -4
  112. package/resource/knowledge/livekit/core-sdk/api-reference/android/LikeStore.md +0 -2
  113. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveAudienceStore.md +0 -2
  114. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveCoreView.md +0 -1
  115. package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveSeatStore.md +2 -4
  116. package/resource/knowledge/livekit/core-sdk/api-reference/android/LoginStore.md +1 -3
  117. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/AudioEffectStore.md +0 -7
  118. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BarrageStore.md +3 -6
  119. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BaseBeautyStore.md +0 -1
  120. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BattleStore.md +12 -15
  121. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoGuestStore.md +0 -5
  122. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoHostStore.md +0 -3
  123. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/DeviceStore.md +0 -2
  124. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/GiftStore.md +2 -4
  125. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LikeStore.md +0 -2
  126. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveAudienceStore.md +0 -2
  127. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveCoreView.md +0 -1
  128. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveSeatStore.md +2 -4
  129. package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LoginStore.md +1 -3
  130. package/resource/knowledge/livekit/core-sdk/api-reference/ios/AudioEffectStore.md +0 -7
  131. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BarrageStore.md +2 -5
  132. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BaseBeautyStore.md +0 -1
  133. package/resource/knowledge/livekit/core-sdk/api-reference/ios/BattleStore.md +3 -6
  134. package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoGuestStore.md +0 -5
  135. package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoHostStore.md +0 -3
  136. package/resource/knowledge/livekit/core-sdk/api-reference/ios/DeviceStore.md +0 -2
  137. package/resource/knowledge/livekit/core-sdk/api-reference/ios/GiftStore.md +2 -4
  138. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LikeStore.md +0 -2
  139. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveAudienceStore.md +0 -2
  140. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveCoreView.md +0 -1
  141. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveSeatStore.md +2 -4
  142. package/resource/knowledge/livekit/core-sdk/api-reference/ios/LoginStore.md +1 -3
  143. package/resource/knowledge/livekit/core-sdk/api-reference/vue/capability-matrix.md +82 -0
  144. package/resource/knowledge/livekit/core-sdk/{voice/android/voice-audio-effect.md → features/android/audio-effect.md} +2 -4
  145. package/resource/knowledge/livekit/core-sdk/{live/android/live-barrage.md → features/android/barrage.md} +1 -1
  146. package/resource/knowledge/livekit/core-sdk/{live/android/live-base-beauty.md → features/android/base-beauty.md} +1 -1
  147. package/resource/knowledge/livekit/core-sdk/{voice/android/voice-gift.md → features/android/gift.md} +2 -3
  148. package/resource/knowledge/livekit/core-sdk/{live/android/live-live-list.md → features/android/live-list.md} +1 -1
  149. package/resource/knowledge/livekit/core-sdk/{live/flutter/live-audio-effect.md → features/flutter/audio-effect.md} +0 -2
  150. package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-barrage.md → features/flutter/barrage.md} +3 -3
  151. package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-gift.md → features/flutter/gift.md} +2 -2
  152. package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-room-list.md → features/flutter/live-list.md} +1 -1
  153. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-audience-list.md → features/ios/audience-list.md} +1 -1
  154. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-audio-effect.md → features/ios/audio-effect.md} +1 -3
  155. package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-barrage.md → features/ios/barrage.md} +2 -2
  156. package/resource/knowledge/livekit/core-sdk/{live/ios/live-base-beauty.md → features/ios/base-beauty.md} +1 -1
  157. package/resource/knowledge/livekit/core-sdk/{live/ios/live-gift.md → features/ios/gift.md} +8 -9
  158. package/resource/knowledge/livekit/core-sdk/{live/ios/live-live-list.md → features/ios/live-list.md} +2 -2
  159. package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-audio-effect.md → features/uni-app/audio-effect.md} +2 -3
  160. package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-barrage.md → features/uni-app/barrage.md} +2 -2
  161. package/resource/knowledge/livekit/core-sdk/features/uni-app/base-beauty.md +145 -0
  162. package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-gift.md → features/uni-app/gift.md} +6 -7
  163. package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-room-list.md → features/uni-app/live-list.md} +1 -1
  164. package/resource/knowledge/livekit/core-sdk/live/android/{live-co-guest-interaction.md → co-guest-interaction.md} +2 -3
  165. package/resource/knowledge/livekit/core-sdk/live/android/{live-host-interaction.md → host-interaction.md} +2 -4
  166. package/resource/knowledge/livekit/core-sdk/live/android/{live-integration.md → integration.md} +6 -9
  167. package/resource/knowledge/livekit/core-sdk/live/flutter/{live-host-interaction.md → host-interaction.md} +1 -3
  168. package/resource/knowledge/livekit/core-sdk/live/flutter/{live-integration.md → integration.md} +1 -6
  169. package/resource/knowledge/livekit/core-sdk/live/ios/{live-co-guest-interaction.md → co-guest-interaction.md} +2 -3
  170. package/resource/knowledge/livekit/core-sdk/live/ios/{live-host-interaction.md → host-interaction.md} +3 -5
  171. package/resource/knowledge/livekit/core-sdk/live/ios/{live-integration.md → integration.md} +7 -10
  172. package/resource/knowledge/livekit/core-sdk/live/uni-app/co-guest-interaction.md +561 -0
  173. package/resource/knowledge/livekit/core-sdk/live/uni-app/host-interaction.md +323 -0
  174. package/resource/knowledge/livekit/core-sdk/live/uni-app/integration.md +312 -0
  175. package/resource/knowledge/livekit/core-sdk/voice/android/{voice-co-guest-interaction.md → co-guest-interaction.md} +3 -3
  176. package/resource/knowledge/livekit/core-sdk/voice/android/{voice-host-interaction.md → host-interaction.md} +2 -4
  177. package/resource/knowledge/livekit/core-sdk/voice/android/{voice-integration.md → integration.md} +11 -14
  178. package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-co-guest-interaction.md → co-guest-interaction.md} +0 -1
  179. package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-integration.md → integration.md} +1 -4
  180. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-co-guest-interaction.md → co-guest-interaction.md} +3 -3
  181. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-host-interaction.md → host-interaction.md} +2 -4
  182. package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-integration.md → integration.md} +7 -10
  183. package/resource/knowledge/livekit/core-sdk/voice/uni-app/{voice-co-guest-interaction.md → co-guest-interaction.md} +6 -6
  184. package/resource/knowledge/livekit/core-sdk/voice/uni-app/{voice-integration.md → integration.md} +6 -7
  185. package/resource/knowledge/livekit/preset/live/vue/features/barrage.md +2 -3
  186. package/resource/knowledge/livekit/preset/live/vue/features/live-audience-list.md +1 -1
  187. package/resource/knowledge/livekit/preset/live/vue/features/live-view.md +1 -1
  188. package/resource/knowledge/push/api-reference/android.md +337 -0
  189. package/resource/knowledge/push/api-reference/donut.md +190 -0
  190. package/resource/knowledge/push/api-reference/flutter.md +176 -0
  191. package/resource/knowledge/push/api-reference/harmonyos.md +140 -0
  192. package/resource/knowledge/push/api-reference/ios.md +537 -0
  193. package/resource/knowledge/push/api-reference/react-native.md +154 -0
  194. package/resource/knowledge/push/api-reference/uni-app.md +148 -0
  195. package/resource/knowledge/push/api-reference/unity.md +119 -0
  196. package/resource/knowledge/push/api-reference/unreal-engine.md +123 -0
  197. package/resource/knowledge/push/config/android/fcm.md +1 -8
  198. package/resource/knowledge/push/config/android/honor.md +3 -7
  199. package/resource/knowledge/push/config/android/huawei.md +0 -5
  200. package/resource/knowledge/push/config/android/meizu.md +0 -5
  201. package/resource/knowledge/push/config/android/oppo.md +0 -4
  202. package/resource/knowledge/push/config/android/vivo.md +0 -4
  203. package/resource/knowledge/push/config/android/xiaomi.md +0 -2
  204. package/resource/knowledge/push/config/donut.md +33 -46
  205. package/resource/knowledge/push/config/harmonyos.md +6 -9
  206. package/resource/knowledge/push/config/ios.md +2 -9
  207. package/resource/knowledge/push/config/react-native.md +17 -25
  208. package/resource/knowledge/push/config/unity.md +16 -24
  209. package/resource/knowledge/push/config/unreal-engine.md +16 -24
  210. package/resource/knowledge/push/integration/android.md +21 -21
  211. package/resource/knowledge/push/integration/donut.md +24 -34
  212. package/resource/knowledge/push/integration/flutter.md +12 -1
  213. package/resource/knowledge/push/integration/harmonyos.md +2 -1
  214. package/resource/knowledge/push/integration/ios.md +16 -10
  215. package/resource/knowledge/push/integration/react-native.md +10 -14
  216. package/resource/knowledge/push/integration/uni-app.md +10 -6
  217. package/resource/knowledge/push/integration/unity.md +19 -22
  218. package/resource/knowledge/push/integration/unreal-engine.md +7 -9
  219. package/resource/knowledge/push/overview/prepare.md +2 -2
  220. package/resource/knowledge/roomkit/core-sdk/android/capability-matrix.md +46 -0
  221. package/resource/knowledge/roomkit/core-sdk/android/unsupported-features.md +82 -0
  222. package/resource/knowledge/roomkit/core-sdk/flutter/capability-matrix.md +46 -0
  223. package/resource/knowledge/roomkit/core-sdk/flutter/room-participant-state.md +1 -1
  224. package/resource/knowledge/roomkit/core-sdk/flutter/unsupported-features.md +82 -0
  225. package/resource/knowledge/roomkit/core-sdk/ios/capability-matrix.md +46 -0
  226. package/resource/knowledge/roomkit/core-sdk/ios/room-state.md +1 -1
  227. package/resource/knowledge/roomkit/core-sdk/ios/unsupported-features.md +82 -0
  228. package/resource/knowledge/roomkit/core-sdk/vue/call-user-to-room.md +1 -1
  229. package/resource/knowledge/roomkit/core-sdk/vue/device-state.md +0 -4
  230. package/resource/knowledge/roomkit/core-sdk/vue/free-beauty-panel.md +2 -5
  231. package/resource/knowledge/roomkit/core-sdk/vue/room-chat.md +0 -3
  232. package/resource/knowledge/roomkit/core-sdk/vue/room-participant-state.md +0 -2
  233. package/resource/knowledge/roomkit/core-sdk/vue/room-state.md +2 -6
  234. package/resource/knowledge/roomkit/core-sdk/vue/room-view.md +0 -1
  235. package/resource/knowledge/roomkit/core-sdk/vue/schedule-room.md +1 -1
  236. package/resource/knowledge/roomkit/core-sdk/vue/screen-share.md +2 -4
  237. package/resource/knowledge/roomkit/core-sdk/vue/virtual-background.md +2 -3
  238. package/resource/knowledge/roomkit/preset/android/integration.md +14 -16
  239. package/resource/knowledge/roomkit/preset/flutter/integration.md +9 -17
  240. package/resource/knowledge/roomkit/preset/ios/integration.md +9 -17
  241. package/resource/knowledge/roomkit/preset/react/integration.md +0 -4
  242. package/resource/knowledge/trtc/android/TRTCCloud.md +97 -180
  243. package/resource/knowledge/trtc/android/TRTCCloudDef.md +20 -20
  244. package/resource/knowledge/trtc/android/TRTCCloudListener.md +43 -77
  245. package/resource/knowledge/trtc/android/TRTCStatistics.md +1 -1
  246. package/resource/knowledge/trtc/android/TXAudioEffectManager.md +4 -24
  247. package/resource/knowledge/trtc/android/TXDeviceManager.md +2 -2
  248. package/resource/knowledge/trtc/android/TXLiteAVCode.md +1 -1
  249. package/resource/knowledge/trtc/c++/ITRTCCloud.md +96 -189
  250. package/resource/knowledge/trtc/c++/ITRTCStatistics.md +1 -1
  251. package/resource/knowledge/trtc/c++/ITXAudioEffectManager.md +1 -21
  252. package/resource/knowledge/trtc/c++/ITXDeviceManager.md +4 -6
  253. package/resource/knowledge/trtc/c++/TRTCCloudCallback.md +42 -76
  254. package/resource/knowledge/trtc/c++/TRTCTypeDef.md +18 -19
  255. package/resource/knowledge/trtc/c++/TXLiteAVCode.md +1 -1
  256. package/resource/knowledge/trtc/ios/TRTCCloud.md +95 -181
  257. package/resource/knowledge/trtc/ios/TRTCCloudDelegate.md +43 -78
  258. package/resource/knowledge/trtc/ios/TRTCStatistics.md +1 -1
  259. package/resource/knowledge/trtc/ios/TXAudioEffectManager.md +1 -20
  260. package/resource/knowledge/trtc/ios/TXDeviceManager.md +4 -6
  261. package/resource/knowledge/trtc/ios/TXLiteAVCode.md +1 -1
  262. package/resource/knowledge/trtc/ios/TXLiveSDKTypeDef.md +20 -20
  263. package/server-config.js +7 -4
  264. package/server.js +2 -2
  265. package/tools/common/finalize_answer.js +1 -1
  266. package/tools/common/present_framework_choice.js +2 -2
  267. package/tools/common/search_trtc_knowledge.js +3 -3
  268. package/tools/common/submit_feedback.js +1 -1
  269. package/tools/definitions/get_native_live_uikit_integration_def.js +60 -0
  270. package/tools/definitions/get_native_livekit_core_integration_def.js +1 -1
  271. package/tools/definitions/present_framework_choice_def.js +2 -2
  272. package/tools/definitions/search_trtc_knowledge_def.js +5 -5
  273. package/tools/index.js +2 -0
  274. package/tools/live/get_native_live_uikit_integration.js +69 -0
  275. package/tools/live/get_native_livekit_core_integration.js +6 -6
  276. package/utils/is-valid-sdkappid.js +4 -0
  277. package/utils/report-cls-client.js +1 -1
  278. package/utils/report-es-client.js +1 -1
  279. package/resource/index/component-slugs.json +0 -1
  280. package/resource/index/doc-source-urls.json +0 -1
  281. package/resource/index/manifest.json +0 -1
  282. package/resource/knowledge/livekit/core-sdk/live/android/live-audio-effect.md +0 -229
  283. package/resource/knowledge/livekit/core-sdk/live/android/live-gift.md +0 -459
  284. package/resource/knowledge/livekit/core-sdk/live/flutter/live-barrage.md +0 -506
  285. package/resource/knowledge/livekit/core-sdk/live/flutter/live-gift.md +0 -427
  286. package/resource/knowledge/livekit/core-sdk/live/flutter/live-live-list.md +0 -726
  287. package/resource/knowledge/livekit/core-sdk/live/ios/live-audience-list.md +0 -265
  288. package/resource/knowledge/livekit/core-sdk/live/ios/live-audio-effect.md +0 -214
  289. package/resource/knowledge/livekit/core-sdk/live/ios/live-barrage.md +0 -427
  290. package/resource/knowledge/livekit/core-sdk/voice/android/voice-audience-list.md +0 -272
  291. package/resource/knowledge/livekit/core-sdk/voice/android/voice-barrage.md +0 -486
  292. package/resource/knowledge/livekit/core-sdk/voice/android/voice-room-list.md +0 -523
  293. package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audience-list.md +0 -262
  294. package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audio-effect.md +0 -600
  295. package/resource/knowledge/livekit/core-sdk/voice/ios/voice-gift.md +0 -411
  296. package/resource/knowledge/livekit/core-sdk/voice/ios/voice-room-list.md +0 -404
  297. /package/resource/knowledge/livekit/core-sdk/api-reference/{web → vue}/index.md +0 -0
  298. /package/resource/knowledge/livekit/core-sdk/{live/android/live-audience-list.md → features/android/audience-list.md} +0 -0
  299. /package/resource/knowledge/livekit/core-sdk/{live/flutter/live-audience-list.md → features/flutter/audience-list.md} +0 -0
  300. /package/resource/knowledge/livekit/core-sdk/{live/flutter/live-base-beauty.md → features/flutter/base-beauty.md} +0 -0
  301. /package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-audience-list.md → features/uni-app/audience-list.md} +0 -0
  302. /package/resource/knowledge/livekit/core-sdk/live/flutter/{live-co-guest-interaction.md → co-guest-interaction.md} +0 -0
@@ -1,726 +0,0 @@
1
- `LiveListStore` 是 `AtomicXCore` 中负责管理直播房间列表、创建、加入以及维护房间状态的核心模块。通过 `LiveListStore`,您可以为您的应用构建完整的直播生命周期管理。
2
-
3
- ## 核心功能
4
- - **获取直播列表**:获取当前所有公开的直播间列表,支持分页加载。
5
-
6
- - **直播生命周期管理**:提供从创建、开播、加入、离开到结束直播的全套流程接口。
7
-
8
- - **直播信息更新**:主播可以随时更新直播间的公开信息,例如封面、公告等。
9
-
10
- - **实时事件监听**:监听直播结束、用户被踢出等关键事件。
11
-
12
- - **自定义业务数据**:强大的自定义元数据(`MetaData`)能力,允许您在房间内存储和同步任何业务相关的信息,例如直播状态、音乐信息、自定义角色等。
13
-
14
- ## 核心概念
15
-
16
- 在开始集成之前,我们先通过下表了解一下 `LiveListStore` 相关的几个核心概念:
17
-
18
- |**核心概念**|**类型**|**核心职责与描述**|
19
- |---------|---------|---------|
20
- |[LiveInfo](https://tencent-rtc.github.io/TUIKit_Flutter/api_live_live_list_store/LiveInfo-class.html)|`class`|代表一个直播间的所有信息模型。包含了直播 ID (`liveID`)、名称 (`liveName`)、房主信息 (`liveOwner`) 以及自定义元数据 (`metaData`) 等。|
21
- |[LiveListState](https://tencent-rtc.github.io/TUIKit_Flutter/api_live_live_list_store/LiveListState-class.html)|`class`|代表直播列表模块的当前状态。其核心属性 `liveList` 是一个 `ValueListenable<List<LiveInfo>>` 类型,存储了拉取到的直播列表;`currentLive` 则代表用户当前所在的直播间信息。|
22
- |[LiveListListener](https://tencent-rtc.github.io/TUIKit_Flutter/api_live_live_list_store/LiveListListener-class.html)|`class`|代表直播房间的全局事件监听器。包含 `onLiveEnded` (直播结束) 和 `onKickedOutOfLive` (被踢出直播) 两种回调,用于处理关键的房间状态变更。|
23
- |[LiveListStore](https://tencent-rtc.github.io/TUIKit_Flutter/api_live_live_list_store/LiveListStore-class.html)|`class`|这是与直播列表和房间生命周期交互的核心管理类。它是一个全局单例 (`shared`),负责所有直播房间的创建、加入、信息更新等操作。|
24
-
25
- ## 实现步骤
26
-
27
- ### 步骤1:组件集成
28
- - **视频直播**:请参考 开播与观看 集成 **AtomicXCore**,完成接入。
29
-
30
- - **语聊房**:请参考 开播与收听 集成 **AtomicXCore**,完成接入。
31
-
32
- ### 步骤2:观众进入直播间实现
33
-
34
- 创建一个展示直播列表的页面,该页面使用 `GridView` 来布局直播间卡片。当用户点击某个卡片时,获取该直播间的 `liveID`,并跳转到观众观看页面。
35
- ``` java
36
- import 'package:flutter/material.dart';
37
- import 'package:atomic_x_core/atomicxcore.dart';
38
-
39
- /// 直播列表页面
40
- class LiveListPage extends StatefulWidget {
41
- const LiveListPage({super.key});
42
-
43
- @override
44
- State<LiveListPage> createState() => _LiveListPageState();
45
- }
46
-
47
- class _LiveListPageState extends State<LiveListPage> {
48
- final _liveListStore = LiveListStore.shared;
49
- final ScrollController _scrollController = ScrollController();
50
- bool _isLoading = false;
51
-
52
- @override
53
- void initState() {
54
- super.initState();
55
- _liveListStore.liveState.liveList.addListener(_onLiveListChanged);
56
- _scrollController.addListener(_onScroll);
57
- _fetchLiveList();
58
- }
59
-
60
- void _onLiveListChanged() {
61
- setState(() {});
62
- }
63
-
64
- void _onScroll() {
65
- // 滚动到底部时加载更多
66
- if (_scrollController.position.pixels >=
67
- _scrollController.position.maxScrollExtent - 200) {
68
- _loadMore();
69
- }
70
- }
71
-
72
- Future<void> _fetchLiveList() async {
73
- if (_isLoading) return;
74
- setState(() => _isLoading = true);
75
-
76
- final result = await _liveListStore.fetchLiveList(cursor: '', count: 20);
77
- if (!result.isSuccess) {
78
- debugPrint('获取直播列表失败: ${result.message}');
79
- }
80
-
81
- setState(() => _isLoading = false);
82
- }
83
-
84
- Future<void> _loadMore() async {
85
- if (_isLoading) return;
86
-
87
- final cursor = _liveListStore.liveState.liveListCursor.value;
88
- if (cursor.isEmpty) return; // 没有更多数据
89
-
90
- setState(() => _isLoading = true);
91
- await _liveListStore.fetchLiveList(cursor: cursor, count: 20);
92
- setState(() => _isLoading = false);
93
- }
94
-
95
- Future<void> _refresh() async {
96
- _liveListStore.reset();
97
- await _fetchLiveList();
98
- }
99
-
100
- // 当用户点击列表中的某个卡片时
101
- void _onLiveCardTap(LiveInfo liveInfo) {
102
- // 创建观众观看页面,并将 liveID 传入
103
- Navigator.push(
104
- context,
105
- MaterialPageRoute(
106
- builder: (context) => YourAudiencePage(liveID: liveInfo.liveID),
107
- ),
108
- );
109
- }
110
-
111
- @override
112
- void dispose() {
113
- _liveListStore.liveState.liveList.removeListener(_onLiveListChanged);
114
- _scrollController.dispose();
115
- super.dispose();
116
- }
117
-
118
- @override
119
- Widget build(BuildContext context) {
120
- final liveList = _liveListStore.liveState.liveList.value;
121
-
122
- return Scaffold(
123
- appBar: AppBar(title: const Text('直播列表')),
124
- body: RefreshIndicator(
125
- onRefresh: _refresh,
126
- child: liveList.isEmpty
127
- ? Center(
128
- child: _isLoading
129
- ? const CircularProgressIndicator()
130
- : const Text('暂无直播'),
131
- )
132
- : GridView.builder(
133
- controller: _scrollController,
134
- padding: const EdgeInsets.all(8),
135
- gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
136
- crossAxisCount: 2,
137
- childAspectRatio: 0.75,
138
- crossAxisSpacing: 8,
139
- mainAxisSpacing: 8,
140
- ),
141
- itemCount: liveList.length + (_isLoading ? 1 : 0),
142
- itemBuilder: (context, index) {
143
- if (index >= liveList.length) {
144
- return const Center(child: CircularProgressIndicator());
145
- }
146
- return _buildLiveCard(liveList[index]);
147
- },
148
- ),
149
- ),
150
- );
151
- }
152
-
153
- Widget _buildLiveCard(LiveInfo liveInfo) {
154
- return GestureDetector(
155
- onTap: () => _onLiveCardTap(liveInfo),
156
- child: Card(
157
- clipBehavior: Clip.antiAlias,
158
- child: Column(
159
- crossAxisAlignment: CrossAxisAlignment.start,
160
- children: [
161
- // 封面图
162
- Expanded(
163
- child: Stack(
164
- fit: StackFit.expand,
165
- children: [
166
- Image.network(
167
- liveInfo.coverURL,
168
- fit: BoxFit.cover,
169
- errorBuilder: (context, error, stackTrace) {
170
- return Container(color: Colors.grey[300]);
171
- },
172
- ),
173
- // 直播中标签
174
- Positioned(
175
- top: 8,
176
- left: 8,
177
- child: Container(
178
- padding: const EdgeInsets.symmetric(
179
- horizontal: 6,
180
- vertical: 2,
181
- ),
182
- decoration: BoxDecoration(
183
- color: Colors.red,
184
- borderRadius: BorderRadius.circular(4),
185
- ),
186
- child: const Text(
187
- '直播中',
188
- style: TextStyle(color: Colors.white, fontSize: 10),
189
- ),
190
- ),
191
- ),
192
- // 观看人数
193
- Positioned(
194
- bottom: 8,
195
- right: 8,
196
- child: Container(
197
- padding: const EdgeInsets.symmetric(
198
- horizontal: 6,
199
- vertical: 2,
200
- ),
201
- decoration: BoxDecoration(
202
- color: Colors.black54,
203
- borderRadius: BorderRadius.circular(4),
204
- ),
205
- child: Row(
206
- mainAxisSize: MainAxisSize.min,
207
- children: [
208
- const Icon(
209
- Icons.visibility,
210
- color: Colors.white,
211
- size: 12,
212
- ),
213
- const SizedBox(width: 4),
214
- Text(
215
- '${liveInfo.totalViewerCount}',
216
- style: const TextStyle(
217
- color: Colors.white,
218
- fontSize: 10,
219
- ),
220
- ),
221
- ],
222
- ),
223
- ),
224
- ),
225
- ],
226
- ),
227
- ),
228
- // 直播信息
229
- Padding(
230
- padding: const EdgeInsets.all(8),
231
- child: Column(
232
- crossAxisAlignment: CrossAxisAlignment.start,
233
- children: [
234
- Text(
235
- liveInfo.liveName,
236
- maxLines: 1,
237
- overflow: TextOverflow.ellipsis,
238
- style: const TextStyle(fontWeight: FontWeight.bold),
239
- ),
240
- const SizedBox(height: 4),
241
- Row(
242
- children: [
243
- CircleAvatar(
244
- radius: 10,
245
- backgroundImage: NetworkImage(
246
- liveInfo.liveOwner.avatarURL,
247
- ),
248
- ),
249
- const SizedBox(width: 4),
250
- Expanded(
251
- child: Text(
252
- liveInfo.liveOwner.userName,
253
- maxLines: 1,
254
- overflow: TextOverflow.ellipsis,
255
- style: TextStyle(
256
- fontSize: 12,
257
- color: Colors.grey[600],
258
- ),
259
- ),
260
- ),
261
- ],
262
- ),
263
- ],
264
- ),
265
- ),
266
- ],
267
- ),
268
- ),
269
- );
270
- }
271
- }
272
-
273
- /// 观众观看页面(占位)
274
- class YourAudiencePage extends StatelessWidget {
275
- final String liveID;
276
-
277
- const YourAudiencePage({super.key, required this.liveID});
278
-
279
- @override
280
- Widget build(BuildContext context) {
281
- return Scaffold(
282
- appBar: AppBar(title: const Text('直播间')),
283
- body: Center(child: Text('直播间: $liveID')),
284
- );
285
- }
286
- }
287
- ```
288
-
289
- **LiveInfo 参数说明**
290
-
291
- |**参数名**|**类型**|**描述**|
292
- |---------|---------|---------|
293
- |`liveID`|`String`|直播间的唯一标识符。|
294
- |`liveName`|`String`|直播间的标题。|
295
- |`coverURL`|`String`|直播间的封面图片地址。|
296
- |`liveOwner`|`LiveUserInfo`|房主的个人信息。|
297
- |`totalViewerCount`|`int`|直播间的总观看人数。|
298
- |`categoryList`|`List<int>`|直播间的分类标签列表。|
299
- |`notice`|`String`|直播间的公告信息。|
300
- |`metaData`|`Map<String, String>`|开发者自定义的元数据,用于实现复杂的业务场景。|
301
-
302
- ## 功能进阶
303
-
304
- ### 场景一:分类展示直播列表
305
-
306
- 在 App 的直播广场页,顶部设有"热门"、"音乐"、"游戏"等分类标签。用户点击不同的标签后,下方的直播列表会动态筛选,只展示对应分类的直播间,从而帮助用户快速发现感兴趣的内容。
307
-
308
- #### 实现方式
309
-
310
- 核心是利用 `LiveInfo` 模型中的 `categoryList` 属性。当主播开播设置分类后,`fetchLiveList` 返回的 `LiveInfo` 对象中就会包含这些分类信息。您的 App 在获取到完整的直播列表后,只需在客户端根据用户选择的分类,对这个列表进行一次简单的筛选,然后刷新 UI 即可。
311
-
312
- #### 代码示例
313
-
314
- 以下示例展示了如何创建一个 `LiveListManager` 来处理数据和筛选逻辑。
315
- ``` java
316
- import 'package:flutter/material.dart';
317
- import 'package:atomic_x_core/atomicxcore.dart';
318
-
319
- /// 直播列表数据管理器
320
- class LiveListManager extends ChangeNotifier {
321
- final _liveListStore = LiveListStore.shared;
322
- List<LiveInfo> _fullLiveList = [];
323
- List<LiveInfo> _filteredLiveList = [];
324
- int? _selectedCategoryId;
325
-
326
- List<LiveInfo> get filteredLiveList => _filteredLiveList;
327
- int? get selectedCategoryId => _selectedCategoryId;
328
- late final VoidCallback _liveListChangedListener = _onLiveListChanged;
329
-
330
- LiveListManager() {
331
- _liveListStore.liveState.liveList.addListener(_liveListChangedListener);
332
- }
333
-
334
- void _onLiveListChanged() {
335
- _fullLiveList = _liveListStore.liveState.liveList.value;
336
- _applyFilter();
337
- }
338
-
339
- Future<void> fetchFirstPage() async {
340
- _liveListStore.reset();
341
- await _liveListStore.fetchLiveList(cursor: '', count: 20);
342
- }
343
-
344
- /// 根据分类筛选直播列表
345
- void filterLiveList({int? categoryId}) {
346
- _selectedCategoryId = categoryId;
347
- _applyFilter();
348
- }
349
-
350
- void _applyFilter() {
351
- if (_selectedCategoryId == null) {
352
- // 如果 categoryId 为 null,则显示完整列表
353
- _filteredLiveList = List.from(_fullLiveList);
354
- } else {
355
- // 筛选包含指定分类的直播间
356
- _filteredLiveList = _fullLiveList.where((liveInfo) {
357
- return liveInfo.categoryList.contains(_selectedCategoryId);
358
- }).toList();
359
- }
360
- notifyListeners();
361
- }
362
-
363
- @override
364
- void dispose() {
365
- _liveListStore.liveState.liveList.removeListener(_liveListChangedListener);
366
- super.dispose();
367
- }
368
- }
369
- ```
370
- ``` java
371
- /// 带分类筛选的直播列表页面
372
- class CategoryLiveListPage extends StatefulWidget {
373
- const CategoryLiveListPage({super.key});
374
-
375
- @override
376
- State<CategoryLiveListPage> createState() => _CategoryLiveListPageState();
377
- }
378
-
379
- class _CategoryLiveListPageState extends State<CategoryLiveListPage> {
380
- final _manager = LiveListManager();
381
- late final VoidCallback _managerChangedListener = _onManagerChanged;
382
-
383
- // 分类列表(示例)
384
- final List<Map<String, dynamic>> _categories = [
385
- {'id': null, 'name': '全部'},
386
- {'id': 1, 'name': '音乐'},
387
- {'id': 2, 'name': '游戏'},
388
- {'id': 3, 'name': '聊天'},
389
- ];
390
-
391
- @override
392
- void initState() {
393
- super.initState();
394
- _manager.addListener(_managerChangedListener);
395
- _manager.fetchFirstPage();
396
- }
397
-
398
- void _onManagerChanged() {
399
- setState(() {});
400
- }
401
-
402
- // 当用户点击顶部分类标签时
403
- void _onCategoryTap(int? categoryId) {
404
- _manager.filterLiveList(categoryId: categoryId);
405
- }
406
-
407
- @override
408
- void dispose() {
409
- _manager.removeListener(_managerChangedListener);
410
- _manager.dispose();
411
- super.dispose();
412
- }
413
-
414
- @override
415
- Widget build(BuildContext context) {
416
- return Scaffold(
417
- appBar: AppBar(title: const Text('直播广场')),
418
- body: Column(
419
- children: [
420
- // 分类标签栏
421
- SizedBox(
422
- height: 50,
423
- child: ListView.builder(
424
- scrollDirection: Axis.horizontal,
425
- padding: const EdgeInsets.symmetric(horizontal: 8),
426
- itemCount: _categories.length,
427
- itemBuilder: (context, index) {
428
- final category = _categories[index];
429
- final isSelected = _manager.selectedCategoryId == category['id'];
430
- return Padding(
431
- padding: const EdgeInsets.symmetric(horizontal: 4),
432
- child: ChoiceChip(
433
- label: Text(category['name']),
434
- selected: isSelected,
435
- onSelected: (_) => _onCategoryTap(category['id']),
436
- ),
437
- );
438
- },
439
- ),
440
- ),
441
- // 直播列表
442
- Expanded(
443
- child: _manager.filteredLiveList.isEmpty
444
- ? const Center(child: Text('暂无直播'))
445
- : GridView.builder(
446
- padding: const EdgeInsets.all(8),
447
- gridDelegate:
448
- const SliverGridDelegateWithFixedCrossAxisCount(
449
- crossAxisCount: 2,
450
- childAspectRatio: 0.75,
451
- crossAxisSpacing: 8,
452
- mainAxisSpacing: 8,
453
- ),
454
- itemCount: _manager.filteredLiveList.length,
455
- itemBuilder: (context, index) {
456
- final liveInfo = _manager.filteredLiveList[index];
457
- return _buildLiveCard(liveInfo);
458
- },
459
- ),
460
- ),
461
- ],
462
- ),
463
- );
464
- }
465
-
466
- Widget _buildLiveCard(LiveInfo liveInfo) {
467
- return Card(
468
- clipBehavior: Clip.antiAlias,
469
- child: Column(
470
- crossAxisAlignment: CrossAxisAlignment.start,
471
- children: [
472
- Expanded(
473
- child: Image.network(
474
- liveInfo.coverURL,
475
- fit: BoxFit.cover,
476
- width: double.infinity,
477
- errorBuilder: (context, error, stackTrace) {
478
- return Container(color: Colors.grey[300]);
479
- },
480
- ),
481
- ),
482
- Padding(
483
- padding: const EdgeInsets.all(8),
484
- child: Text(
485
- liveInfo.liveName,
486
- maxLines: 1,
487
- overflow: TextOverflow.ellipsis,
488
- ),
489
- ),
490
- ],
491
- ),
492
- );
493
- }
494
- }
495
- ```
496
-
497
- ### 场景二:展示电商直播的商品信息
498
-
499
- 在电商直播中,主播正在讲解一款商品。此时,所有观众的直播画面下方都会弹出一张商品卡片,实时展示该商品的图片、名称和价格。当主播切换讲解下一件商品时,所有观众端的卡片都会自动、同步更新。
500
-
501
- #### 实现方式
502
-
503
- 主播端将当前商品的结构化信息(建议使用 **JSON** 格式)通过 `updateLiveMetaData` 接口设置到一个自定义的 key(例如 "`product_info`")中。**AtomicXCore** 会将这个变更实时同步给所有观众。观众端只需订阅 `LiveListState.currentLive`,监听 `metaData` 的变化,一旦发现 `product_info` 的值更新,就解析其中的 JSON 数据并刷新商品卡片 UI。
504
-
505
- #### 代码示例
506
- ``` java
507
- import 'dart:convert';
508
- import 'package:flutter/material.dart';
509
- import 'package:atomic_x_core/atomicxcore.dart';
510
-
511
- /// 商品信息模型
512
- class Product {
513
- final String id;
514
- final String name;
515
- final String price;
516
- final String imageUrl;
517
-
518
- Product({
519
- required this.id,
520
- required this.name,
521
- required this.price,
522
- required this.imageUrl,
523
- });
524
-
525
- factory Product.fromJson(Map<String, dynamic> json) {
526
- return Product(
527
- id: json['id'] ?? '',
528
- name: json['name'] ?? '',
529
- price: json['price'] ?? '',
530
- imageUrl: json['imageUrl'] ?? '',
531
- );
532
- }
533
-
534
- Map<String, dynamic> toJson() {
535
- return {
536
- 'id': id,
537
- 'name': name,
538
- 'price': price,
539
- 'imageUrl': imageUrl,
540
- };
541
- }
542
- }
543
-
544
- /// 主播端:推送商品信息
545
- class HostProductController {
546
- final _liveListStore = LiveListStore.shared;
547
-
548
- Future<void> pushProductInfo(Product product) async {
549
- final jsonString = jsonEncode(product.toJson());
550
- final metaData = {'product_info': jsonString};
551
-
552
- // 使用全局单例的 liveListStore 来更新 metaData
553
- final result = await _liveListStore.updateLiveMetaData(metaData);
554
- if (result.isSuccess) {
555
- debugPrint('商品 ${product.name} 信息推送成功');
556
- } else {
557
- debugPrint('商品信息推送失败: ${result.message}');
558
- }
559
- }
560
- }
561
-
562
- /// 观众端:商品卡片组件
563
- class ProductCardWidget extends StatefulWidget {
564
- const ProductCardWidget({super.key});
565
-
566
- @override
567
- State<ProductCardWidget> createState() => _ProductCardWidgetState();
568
- }
569
-
570
- class _ProductCardWidgetState extends State<ProductCardWidget> {
571
- final _liveListStore = LiveListStore.shared;
572
- Product? _currentProduct;
573
- String? _lastProductInfo;
574
- late final VoidCallback _currentLiveChangedListener = _onCurrentLiveChanged;
575
-
576
- @override
577
- void initState() {
578
- super.initState();
579
- _liveListStore.liveState.currentLive.addListener(_currentLiveChangedListener);
580
- }
581
-
582
- void _onCurrentLiveChanged() {
583
- final currentLive = _liveListStore.liveState.currentLive.value;
584
- final productInfo = currentLive.metaData['product_info'];
585
-
586
- // 检查是否有变化
587
- if (productInfo != _lastProductInfo) {
588
- _lastProductInfo = productInfo;
589
- _parseProductInfo(productInfo);
590
- }
591
- }
592
-
593
- void _parseProductInfo(String? jsonString) {
594
- if (jsonString == null || jsonString.isEmpty) {
595
- setState(() => _currentProduct = null);
596
- return;
597
- }
598
-
599
- try {
600
- final json = jsonDecode(jsonString) as Map<String, dynamic>;
601
- final product = Product.fromJson(json);
602
- setState(() => _currentProduct = product);
603
- } catch (e) {
604
- debugPrint('解析商品信息失败: $e');
605
- }
606
- }
607
-
608
- @override
609
- void dispose() {
610
- _liveListStore.liveState.currentLive.removeListener(_currentLiveChangedListener);
611
- super.dispose();
612
- }
613
-
614
- @override
615
- Widget build(BuildContext context) {
616
- if (_currentProduct == null) {
617
- return const SizedBox.shrink();
618
- }
619
-
620
- return Container(
621
- margin: const EdgeInsets.all(16),
622
- padding: const EdgeInsets.all(12),
623
- decoration: BoxDecoration(
624
- color: Colors.white,
625
- borderRadius: BorderRadius.circular(12),
626
- boxShadow: [
627
- BoxShadow(
628
- color: Colors.black.withOpacity(0.1),
629
- blurRadius: 8,
630
- offset: const Offset(0, 2),
631
- ),
632
- ],
633
- ),
634
- child: Row(
635
- children: [
636
- // 商品图片
637
- ClipRRect(
638
- borderRadius: BorderRadius.circular(8),
639
- child: Image.network(
640
- _currentProduct!.imageUrl,
641
- width: 80,
642
- height: 80,
643
- fit: BoxFit.cover,
644
- errorBuilder: (context, error, stackTrace) {
645
- return Container(
646
- width: 80,
647
- height: 80,
648
- color: Colors.grey[300],
649
- child: const Icon(Icons.image),
650
- );
651
- },
652
- ),
653
- ),
654
- const SizedBox(width: 12),
655
- // 商品信息
656
- Expanded(
657
- child: Column(
658
- crossAxisAlignment: CrossAxisAlignment.start,
659
- mainAxisSize: MainAxisSize.min,
660
- children: [
661
- Text(
662
- _currentProduct!.name,
663
- style: const TextStyle(
664
- fontSize: 14,
665
- fontWeight: FontWeight.bold,
666
- ),
667
- maxLines: 2,
668
- overflow: TextOverflow.ellipsis,
669
- ),
670
- const SizedBox(height: 4),
671
- Text(
672
- '¥${_currentProduct!.price}',
673
- style: const TextStyle(
674
- fontSize: 16,
675
- color: Colors.red,
676
- fontWeight: FontWeight.bold,
677
- ),
678
- ),
679
- ],
680
- ),
681
- ),
682
- // 购买按钮
683
- ElevatedButton(
684
- onPressed: () {
685
- // 实现购买逻辑
686
- debugPrint('购买商品: ${_currentProduct!.name}');
687
- },
688
- style: ElevatedButton.styleFrom(
689
- backgroundColor: Colors.orange,
690
- foregroundColor: Colors.white,
691
- ),
692
- child: const Text('立即购买'),
693
- ),
694
- ],
695
- ),
696
- );
697
- }
698
- }
699
- ```
700
-
701
- ## API 文档
702
-
703
- 关于 [LiveListStore](https://tencent-rtc.github.io/TUIKit_Flutter/api_live_live_list_store/LiveListStore-class.html) 及其相关类的所有公开接口、属性和方法的详细信息,请参阅随 [AtomicXCore](https://tencent-rtc.github.io/TUIKit_Flutter/index.html) 框架的官方 API 文档。本文档使用到的相关 Store 如下:
704
-
705
- |**Store/Component**|**功能描述**|**API 文档**|
706
- |---------|---------|---------|
707
- |**LiveCoreWidget**|直播视频流展示与交互的核心视图组件:负责视频流渲染和视图挂件处理,支持主播直播、观众连麦、主播连线等场景。|[API 文档](https://tencent-rtc.github.io/TUIKit_Flutter/api_view_live_live_core_widget/LiveCoreWidget-class.html)|
708
- |**LiveCoreController**|LiveCoreWidget 的控制器:用于设置直播 ID、控制预览等操作。|[API 文档](https://tencent-rtc.github.io/TUIKit_Flutter/api_view_live_live_core_widget/LiveCoreController-class.html)|
709
- |**LiveListStore**|直播间全生命周期管理:创建 / 加入 / 离开 / 销毁房间,查询房间列表,修改直播信息(名称、公告等),监听直播状态(例如被踢出、结束)。|[API 文档](https://tencent-rtc.github.io/TUIKit_Flutter/api_live_live_list_store/LiveListStore-class.html)|
710
-
711
- ## 常见问题
712
-
713
- ### 使用 `updateLiveMetaData` 时有哪些需要注意的限制和规则?
714
-
715
- 为了保证系统的稳定和高效,`metaData` 的使用遵循以下规则:
716
- - **权限**:只有房主和管理员可以调用 `updateLiveMetaData`。普通观众没有权限。
717
-
718
- - **数量与大小限制: **
719
-
720
- - 单个房间最多支持 **10** 个 key。
721
-
722
- - 每个 key 的长度不超过 **50 字节**,每个 value 的长度不超过 **2KB**。
723
-
724
- - 单个房间所有 value 的总大小不超过 **16KB**。
725
-
726
- - **冲突解决**:`metaData` 的更新机制是"后来者覆盖"。如果多个管理员在短时间内修改同一个 key,最后一次的修改会生效。建议在业务设计上避免多人同时修改同一个关键信息。