@tencentcloud/sdk-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.
- package/knowledge/build-index.js +1 -1
- package/knowledge/chunker.js +81 -52
- package/knowledge/path-meta.js +181 -21
- package/knowledge/search/exact-lookup.js +245 -43
- package/knowledge/search/filter-pool.js +73 -19
- package/knowledge/search/product-scope-intent.js +2 -2
- package/knowledge/search/requires-framework.js +1 -1
- package/knowledge/search/search-knowledge.js +246 -60
- package/package.json +1 -1
- package/resource/_schema/feature-aliases.yaml +1 -0
- package/resource/integration/callkit/preset/android/integration.md +3 -5
- package/resource/integration/callkit/preset/flutter/integration.md +2 -3
- package/resource/integration/callkit/preset/ios/integration.md +2 -5
- package/resource/integration/callkit/preset/react/integration.md +12 -26
- package/resource/integration/callkit/preset/vue/integration.md +17 -33
- package/resource/integration/chat/preset/android/integration.md +44 -14
- package/resource/integration/chat/preset/flutter/integration.md +54 -13
- package/resource/integration/chat/preset/ios/integration.md +42 -6
- package/resource/integration/chat/preset/react/integration.md +30 -28
- package/resource/integration/chat/preset/uni-app/integration.md +101 -40
- package/resource/integration/chat/preset/vue/integration.md +62 -28
- package/resource/integration/livekit/preset/live/android/live-audience-integration.md +133 -0
- package/resource/integration/livekit/preset/live/android/live-host-integration.md +225 -0
- package/resource/integration/livekit/preset/live/android/live-list-integration.md +278 -0
- package/resource/integration/livekit/preset/live/android/prepare-integration.md +271 -0
- package/resource/integration/livekit/preset/live/ios/live-audience-integration.md +207 -0
- package/resource/integration/livekit/preset/live/ios/live-host-integration.md +358 -0
- package/resource/integration/livekit/preset/live/ios/live-list-integration.md +246 -0
- package/resource/integration/livekit/preset/live/ios/prepare-integration.md +218 -0
- package/resource/integration/livekit/preset/live/vue/live-list-integration.md +4 -7
- package/resource/integration/livekit/preset/live/vue/live-player-desk-integration.md +5 -12
- package/resource/integration/livekit/preset/live/vue/live-player-h5-integration.md +4 -11
- package/resource/integration/livekit/preset/live/vue/live-pusher-integration.md +250 -482
- package/resource/integration/roomkit/preset/vue/integration.md +399 -106
- package/resource/knowledge/callkit/best-practice/web/callengine-invitation.md +80 -0
- package/resource/knowledge/callkit/best-practice/web/callengine-log-control.md +20 -0
- package/resource/knowledge/callkit/best-practice/web/callkit-call-vs-calls.md +116 -0
- package/resource/knowledge/callkit/core-sdk/android/answer-call.md +11 -15
- package/resource/knowledge/callkit/core-sdk/android/make-call.md +10 -13
- package/resource/knowledge/callkit/core-sdk/android/offline-push.md +2 -4
- package/resource/knowledge/callkit/core-sdk/flutter/answer-call.md +10 -17
- package/resource/knowledge/callkit/core-sdk/flutter/make-call.md +11 -17
- package/resource/knowledge/callkit/core-sdk/flutter/offline-push.md +11 -20
- package/resource/knowledge/callkit/core-sdk/ios/answer-call.md +10 -15
- package/resource/knowledge/callkit/core-sdk/ios/make-call.md +9 -14
- package/resource/knowledge/callkit/core-sdk/ios/offline-push.md +12 -18
- package/resource/knowledge/callkit/core-sdk/miniprogram/call-engine.md +390 -0
- package/resource/knowledge/callkit/core-sdk/miniprogram/call-event.md +317 -0
- package/resource/knowledge/callkit/core-sdk/uni-app/answer-call.md +16 -22
- package/resource/knowledge/callkit/core-sdk/uni-app/make-call.md +17 -23
- package/resource/knowledge/callkit/core-sdk/web/call-engine.md +39 -0
- package/resource/knowledge/callkit/core-sdk/web/call-event.md +341 -0
- package/resource/knowledge/callkit/core-sdk/web/callengine-api-overview.md +39 -0
- package/resource/knowledge/callkit/faq/android.md +1 -5
- package/resource/knowledge/callkit/faq/common.md +10 -12
- package/resource/knowledge/callkit/faq/ios.md +5 -7
- package/resource/knowledge/callkit/faq/uniapp-app.md +7 -7
- package/resource/knowledge/callkit/faq/uniapp-miniprogram.md +9 -12
- package/resource/knowledge/callkit/faq/web.md +2 -12
- package/resource/knowledge/callkit/preset/android/api.md +5 -8
- package/resource/knowledge/callkit/preset/ios/api.md +4 -6
- package/resource/knowledge/callkit/preset/miniprogram/api.md +295 -0
- package/resource/knowledge/callkit/preset/react/api.md +622 -0
- package/resource/knowledge/callkit/preset/react/uikit-api-reference.md +475 -0
- package/resource/knowledge/callkit/preset/vue/api.md +622 -0
- package/resource/knowledge/callkit/preset/vue/uikit-api-reference.md +587 -0
- package/resource/knowledge/callkit/preset/web/api.md +1 -1
- package/resource/knowledge/chat/best-practice/web/image-message-url-handling.md +16 -0
- package/resource/knowledge/chat/preset/android/features/chat-setting.md +1 -1
- package/resource/knowledge/chat/preset/android/features/conversation-list.md +0 -1
- package/resource/knowledge/chat/preset/android/features/language.md +2 -4
- package/resource/knowledge/chat/preset/android/features/message-input.md +1 -1
- package/resource/knowledge/chat/preset/android/features/message-list.md +1 -2
- package/resource/knowledge/chat/preset/android/features/search.md +0 -1
- package/resource/knowledge/chat/preset/android/features/theme.md +1 -1
- package/resource/knowledge/chat/preset/android-view/integration.md +35 -10
- package/resource/knowledge/chat/preset/flutter/features/conversation-list.md +0 -1
- package/resource/knowledge/chat/preset/flutter/features/language.md +1 -1
- package/resource/knowledge/chat/preset/flutter/features/message-list.md +0 -1
- package/resource/knowledge/chat/preset/flutter/features/search.md +4 -5
- package/resource/knowledge/chat/preset/flutter/features/theme.md +1 -1
- package/resource/knowledge/chat/preset/ios/features/chat-setting.md +1 -1
- package/resource/knowledge/chat/preset/ios/features/conversation-list.md +0 -1
- package/resource/knowledge/chat/preset/ios/features/language.md +2 -5
- package/resource/knowledge/chat/preset/ios/features/message-list.md +0 -1
- package/resource/knowledge/chat/preset/ios/features/search.md +0 -1
- package/resource/knowledge/chat/preset/ios/features/theme.md +1 -1
- package/resource/knowledge/chat/preset/ios-uikit/integration.md +57 -166
- package/resource/knowledge/chat/preset/react/features/chat-setting.md +0 -1
- package/resource/knowledge/chat/preset/react/features/conversation-actions.md +3 -3
- package/resource/knowledge/chat/preset/react/features/conversation-list.md +3 -3
- package/resource/knowledge/chat/preset/react/features/conversation-preview.md +1 -1
- package/resource/knowledge/chat/preset/react/features/message-input.md +2 -3
- package/resource/knowledge/chat/preset/react/features/search.md +0 -1
- package/resource/knowledge/chat/preset/vue/features/chat-header.md +1 -1
- package/resource/knowledge/chat/preset/vue/features/chat-setting.md +3 -4
- package/resource/knowledge/chat/preset/vue/features/conversation-list.md +4 -4
- package/resource/knowledge/chat/preset/vue/features/conversation-preview.md +1 -1
- package/resource/knowledge/chat/preset/vue/features/message-input.md +2 -2
- package/resource/knowledge/chat/preset/vue/features/message-list.md +2 -2
- package/resource/knowledge/chat/preset/vue/features/search.md +0 -1
- package/resource/knowledge/chat/preset/vue/features/theme.md +4 -4
- package/resource/knowledge/chat/urls/sdk/android.md +3 -3
- package/resource/knowledge/chat/urls/sdk/flutter.md +3 -3
- package/resource/knowledge/chat/urls/sdk/ios.md +3 -3
- package/resource/knowledge/chat/urls/sdk/web.md +3 -3
- package/resource/knowledge/livekit/core-sdk/api-reference/android/AudioEffectStore.md +0 -7
- package/resource/knowledge/livekit/core-sdk/api-reference/android/BarrageStore.md +2 -5
- package/resource/knowledge/livekit/core-sdk/api-reference/android/BattleStore.md +12 -15
- package/resource/knowledge/livekit/core-sdk/api-reference/android/CameraView.md +0 -1
- package/resource/knowledge/livekit/core-sdk/api-reference/android/CoGuestStore.md +0 -5
- package/resource/knowledge/livekit/core-sdk/api-reference/android/CoHostStore.md +0 -3
- package/resource/knowledge/livekit/core-sdk/api-reference/android/DeviceStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/android/GiftStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LikeStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveAudienceStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveCoreView.md +0 -1
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveSeatStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LoginStore.md +1 -3
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/AudioEffectStore.md +0 -7
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BarrageStore.md +3 -6
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BaseBeautyStore.md +0 -1
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BattleStore.md +12 -15
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoGuestStore.md +0 -5
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoHostStore.md +0 -3
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/DeviceStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/GiftStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LikeStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveAudienceStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveCoreView.md +0 -1
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveSeatStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LoginStore.md +1 -3
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/AudioEffectStore.md +0 -7
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/BarrageStore.md +2 -5
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/BaseBeautyStore.md +0 -1
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/BattleStore.md +3 -6
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoGuestStore.md +0 -5
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoHostStore.md +0 -3
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/DeviceStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/GiftStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LikeStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveAudienceStore.md +0 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveCoreView.md +0 -1
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveSeatStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LoginStore.md +1 -3
- package/resource/knowledge/livekit/core-sdk/api-reference/vue/capability-matrix.md +82 -0
- package/resource/knowledge/livekit/core-sdk/{voice/android/voice-audio-effect.md → features/android/audio-effect.md} +2 -4
- package/resource/knowledge/livekit/core-sdk/{live/android/live-barrage.md → features/android/barrage.md} +1 -1
- package/resource/knowledge/livekit/core-sdk/{live/android/live-base-beauty.md → features/android/base-beauty.md} +1 -1
- package/resource/knowledge/livekit/core-sdk/{voice/android/voice-gift.md → features/android/gift.md} +2 -3
- package/resource/knowledge/livekit/core-sdk/{live/android/live-live-list.md → features/android/live-list.md} +1 -1
- package/resource/knowledge/livekit/core-sdk/{live/flutter/live-audio-effect.md → features/flutter/audio-effect.md} +0 -2
- package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-barrage.md → features/flutter/barrage.md} +3 -3
- package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-gift.md → features/flutter/gift.md} +2 -2
- package/resource/knowledge/livekit/core-sdk/{voice/flutter/voice-room-list.md → features/flutter/live-list.md} +1 -1
- package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-audience-list.md → features/ios/audience-list.md} +1 -1
- package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-audio-effect.md → features/ios/audio-effect.md} +1 -3
- package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-barrage.md → features/ios/barrage.md} +2 -2
- package/resource/knowledge/livekit/core-sdk/{live/ios/live-base-beauty.md → features/ios/base-beauty.md} +1 -1
- package/resource/knowledge/livekit/core-sdk/{live/ios/live-gift.md → features/ios/gift.md} +8 -9
- package/resource/knowledge/livekit/core-sdk/{live/ios/live-live-list.md → features/ios/live-list.md} +2 -2
- package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-audio-effect.md → features/uni-app/audio-effect.md} +2 -3
- package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-barrage.md → features/uni-app/barrage.md} +2 -2
- package/resource/knowledge/livekit/core-sdk/features/uni-app/base-beauty.md +145 -0
- package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-gift.md → features/uni-app/gift.md} +6 -7
- package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-room-list.md → features/uni-app/live-list.md} +1 -1
- package/resource/knowledge/livekit/core-sdk/live/android/{live-co-guest-interaction.md → co-guest-interaction.md} +2 -3
- package/resource/knowledge/livekit/core-sdk/live/android/{live-host-interaction.md → host-interaction.md} +2 -4
- package/resource/knowledge/livekit/core-sdk/live/android/{live-integration.md → integration.md} +6 -9
- package/resource/knowledge/livekit/core-sdk/live/flutter/{live-host-interaction.md → host-interaction.md} +1 -3
- package/resource/knowledge/livekit/core-sdk/live/flutter/{live-integration.md → integration.md} +1 -6
- package/resource/knowledge/livekit/core-sdk/live/ios/{live-co-guest-interaction.md → co-guest-interaction.md} +2 -3
- package/resource/knowledge/livekit/core-sdk/live/ios/{live-host-interaction.md → host-interaction.md} +3 -5
- package/resource/knowledge/livekit/core-sdk/live/ios/{live-integration.md → integration.md} +7 -10
- package/resource/knowledge/livekit/core-sdk/live/uni-app/co-guest-interaction.md +561 -0
- package/resource/knowledge/livekit/core-sdk/live/uni-app/host-interaction.md +323 -0
- package/resource/knowledge/livekit/core-sdk/live/uni-app/integration.md +312 -0
- package/resource/knowledge/livekit/core-sdk/voice/android/{voice-co-guest-interaction.md → co-guest-interaction.md} +3 -3
- package/resource/knowledge/livekit/core-sdk/voice/android/{voice-host-interaction.md → host-interaction.md} +2 -4
- package/resource/knowledge/livekit/core-sdk/voice/android/{voice-integration.md → integration.md} +11 -14
- package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-co-guest-interaction.md → co-guest-interaction.md} +0 -1
- package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-integration.md → integration.md} +1 -4
- package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-co-guest-interaction.md → co-guest-interaction.md} +3 -3
- package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-host-interaction.md → host-interaction.md} +2 -4
- package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-integration.md → integration.md} +7 -10
- package/resource/knowledge/livekit/core-sdk/voice/uni-app/{voice-co-guest-interaction.md → co-guest-interaction.md} +6 -6
- package/resource/knowledge/livekit/core-sdk/voice/uni-app/{voice-integration.md → integration.md} +6 -7
- package/resource/knowledge/livekit/preset/live/vue/features/barrage.md +2 -3
- package/resource/knowledge/livekit/preset/live/vue/features/live-audience-list.md +1 -1
- package/resource/knowledge/livekit/preset/live/vue/features/live-view.md +1 -1
- package/resource/knowledge/push/api-reference/android.md +337 -0
- package/resource/knowledge/push/api-reference/donut.md +190 -0
- package/resource/knowledge/push/api-reference/flutter.md +176 -0
- package/resource/knowledge/push/api-reference/harmonyos.md +140 -0
- package/resource/knowledge/push/api-reference/ios.md +537 -0
- package/resource/knowledge/push/api-reference/react-native.md +154 -0
- package/resource/knowledge/push/api-reference/uni-app.md +148 -0
- package/resource/knowledge/push/api-reference/unity.md +119 -0
- package/resource/knowledge/push/api-reference/unreal-engine.md +123 -0
- package/resource/knowledge/push/config/android/fcm.md +1 -8
- package/resource/knowledge/push/config/android/honor.md +3 -7
- package/resource/knowledge/push/config/android/huawei.md +0 -5
- package/resource/knowledge/push/config/android/meizu.md +0 -5
- package/resource/knowledge/push/config/android/oppo.md +0 -4
- package/resource/knowledge/push/config/android/vivo.md +0 -4
- package/resource/knowledge/push/config/android/xiaomi.md +0 -2
- package/resource/knowledge/push/config/donut.md +33 -46
- package/resource/knowledge/push/config/harmonyos.md +6 -9
- package/resource/knowledge/push/config/ios.md +2 -9
- package/resource/knowledge/push/config/react-native.md +17 -25
- package/resource/knowledge/push/config/unity.md +16 -24
- package/resource/knowledge/push/config/unreal-engine.md +16 -24
- package/resource/knowledge/push/integration/android.md +21 -21
- package/resource/knowledge/push/integration/donut.md +24 -34
- package/resource/knowledge/push/integration/flutter.md +12 -1
- package/resource/knowledge/push/integration/harmonyos.md +2 -1
- package/resource/knowledge/push/integration/ios.md +16 -10
- package/resource/knowledge/push/integration/react-native.md +10 -14
- package/resource/knowledge/push/integration/uni-app.md +10 -6
- package/resource/knowledge/push/integration/unity.md +19 -22
- package/resource/knowledge/push/integration/unreal-engine.md +7 -9
- package/resource/knowledge/push/overview/prepare.md +2 -2
- package/resource/knowledge/roomkit/core-sdk/android/capability-matrix.md +46 -0
- package/resource/knowledge/roomkit/core-sdk/android/unsupported-features.md +82 -0
- package/resource/knowledge/roomkit/core-sdk/flutter/capability-matrix.md +46 -0
- package/resource/knowledge/roomkit/core-sdk/flutter/room-participant-state.md +1 -1
- package/resource/knowledge/roomkit/core-sdk/flutter/unsupported-features.md +82 -0
- package/resource/knowledge/roomkit/core-sdk/ios/capability-matrix.md +46 -0
- package/resource/knowledge/roomkit/core-sdk/ios/room-state.md +1 -1
- package/resource/knowledge/roomkit/core-sdk/ios/unsupported-features.md +82 -0
- package/resource/knowledge/roomkit/core-sdk/vue/call-user-to-room.md +1 -1
- package/resource/knowledge/roomkit/core-sdk/vue/device-state.md +0 -4
- package/resource/knowledge/roomkit/core-sdk/vue/free-beauty-panel.md +2 -5
- package/resource/knowledge/roomkit/core-sdk/vue/room-chat.md +0 -3
- package/resource/knowledge/roomkit/core-sdk/vue/room-participant-state.md +0 -2
- package/resource/knowledge/roomkit/core-sdk/vue/room-state.md +2 -6
- package/resource/knowledge/roomkit/core-sdk/vue/room-view.md +0 -1
- package/resource/knowledge/roomkit/core-sdk/vue/schedule-room.md +1 -1
- package/resource/knowledge/roomkit/core-sdk/vue/screen-share.md +2 -4
- package/resource/knowledge/roomkit/core-sdk/vue/virtual-background.md +2 -3
- package/resource/knowledge/roomkit/preset/android/integration.md +14 -16
- package/resource/knowledge/roomkit/preset/flutter/integration.md +9 -17
- package/resource/knowledge/roomkit/preset/ios/integration.md +9 -17
- package/resource/knowledge/roomkit/preset/react/integration.md +0 -4
- package/resource/knowledge/trtc/android/TRTCCloud.md +97 -180
- package/resource/knowledge/trtc/android/TRTCCloudDef.md +20 -20
- package/resource/knowledge/trtc/android/TRTCCloudListener.md +43 -77
- package/resource/knowledge/trtc/android/TRTCStatistics.md +1 -1
- package/resource/knowledge/trtc/android/TXAudioEffectManager.md +4 -24
- package/resource/knowledge/trtc/android/TXDeviceManager.md +2 -2
- package/resource/knowledge/trtc/android/TXLiteAVCode.md +1 -1
- package/resource/knowledge/trtc/c++/ITRTCCloud.md +96 -189
- package/resource/knowledge/trtc/c++/ITRTCStatistics.md +1 -1
- package/resource/knowledge/trtc/c++/ITXAudioEffectManager.md +1 -21
- package/resource/knowledge/trtc/c++/ITXDeviceManager.md +4 -6
- package/resource/knowledge/trtc/c++/TRTCCloudCallback.md +42 -76
- package/resource/knowledge/trtc/c++/TRTCTypeDef.md +18 -19
- package/resource/knowledge/trtc/c++/TXLiteAVCode.md +1 -1
- package/resource/knowledge/trtc/ios/TRTCCloud.md +95 -181
- package/resource/knowledge/trtc/ios/TRTCCloudDelegate.md +43 -78
- package/resource/knowledge/trtc/ios/TRTCStatistics.md +1 -1
- package/resource/knowledge/trtc/ios/TXAudioEffectManager.md +1 -20
- package/resource/knowledge/trtc/ios/TXDeviceManager.md +4 -6
- package/resource/knowledge/trtc/ios/TXLiteAVCode.md +1 -1
- package/resource/knowledge/trtc/ios/TXLiveSDKTypeDef.md +20 -20
- package/server.js +2 -2
- package/tools/common/finalize_answer.js +1 -1
- package/tools/common/present_framework_choice.js +2 -2
- package/tools/common/search_trtc_knowledge.js +3 -3
- package/tools/common/submit_feedback.js +1 -1
- package/tools/definitions/get_native_live_uikit_integration_def.js +60 -0
- package/tools/definitions/get_native_livekit_core_integration_def.js +1 -1
- package/tools/definitions/present_framework_choice_def.js +2 -2
- package/tools/definitions/search_trtc_knowledge_def.js +5 -5
- package/tools/index.js +2 -0
- package/tools/live/get_native_live_uikit_integration.js +69 -0
- package/tools/live/get_native_livekit_core_integration.js +6 -6
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/resource/index/component-slugs.json +0 -1
- package/resource/index/doc-source-urls.json +0 -1
- package/resource/index/manifest.json +0 -1
- package/resource/knowledge/livekit/core-sdk/live/android/live-audio-effect.md +0 -229
- package/resource/knowledge/livekit/core-sdk/live/android/live-gift.md +0 -459
- package/resource/knowledge/livekit/core-sdk/live/flutter/live-barrage.md +0 -506
- package/resource/knowledge/livekit/core-sdk/live/flutter/live-gift.md +0 -427
- package/resource/knowledge/livekit/core-sdk/live/flutter/live-live-list.md +0 -726
- package/resource/knowledge/livekit/core-sdk/live/ios/live-audience-list.md +0 -265
- package/resource/knowledge/livekit/core-sdk/live/ios/live-audio-effect.md +0 -214
- package/resource/knowledge/livekit/core-sdk/live/ios/live-barrage.md +0 -427
- package/resource/knowledge/livekit/core-sdk/voice/android/voice-audience-list.md +0 -272
- package/resource/knowledge/livekit/core-sdk/voice/android/voice-barrage.md +0 -486
- package/resource/knowledge/livekit/core-sdk/voice/android/voice-room-list.md +0 -523
- package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audience-list.md +0 -262
- package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audio-effect.md +0 -600
- package/resource/knowledge/livekit/core-sdk/voice/ios/voice-gift.md +0 -411
- package/resource/knowledge/livekit/core-sdk/voice/ios/voice-room-list.md +0 -404
- /package/resource/knowledge/livekit/core-sdk/api-reference/{web → vue}/index.md +0 -0
- /package/resource/knowledge/livekit/core-sdk/{live/android/live-audience-list.md → features/android/audience-list.md} +0 -0
- /package/resource/knowledge/livekit/core-sdk/{live/flutter/live-audience-list.md → features/flutter/audience-list.md} +0 -0
- /package/resource/knowledge/livekit/core-sdk/{live/flutter/live-base-beauty.md → features/flutter/base-beauty.md} +0 -0
- /package/resource/knowledge/livekit/core-sdk/{voice/uni-app/voice-audience-list.md → features/uni-app/audience-list.md} +0 -0
- /package/resource/knowledge/livekit/core-sdk/live/flutter/{live-co-guest-interaction.md → co-guest-interaction.md} +0 -0
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
本篇文档旨在指导您如何使用 `AtomicXCore` 框架中的 `AudioEffectStore` 和 `DeviceStore` 模块,为您的直播应用快速集成音效控制功能,包括麦克风音量、耳返监听,并添加多种趣味变声效果和混响效果。
|
|
2
|
-
|
|
3
|
-
## 核心功能
|
|
4
|
-
|
|
5
|
-
通过组合 `AudioEffectStore` 和 `DeviceStore`,您将能实现以下核心功能:
|
|
6
|
-
- **人声音量调节**:控制本地音频上行的采集音量大小,即观众听到的您的声音大小。
|
|
7
|
-
|
|
8
|
-
- **耳返功能**:允许主播或连麦用户通过耳机实时听到自己的声音,用于监听和矫正发音。
|
|
9
|
-
|
|
10
|
-
- **变声效果**:提供多种趣味变声选项,例如萝莉、大叔、熊孩子等。
|
|
11
|
-
|
|
12
|
-
- **混响效果**:模拟不同环境的声场效果,例如 KTV、金属声、低沉、洪亮等。
|
|
13
|
-
|
|
14
|
-
## 概念说明
|
|
15
|
-
| <strong>核心概念</strong> | <strong>类型</strong> | <strong>核心职责与描述</strong> |
|
|
16
|
-
| --- | --- | --- |
|
|
17
|
-
| <code>AudioChangerType</code> | <code>enum class</code> | 变声效果枚举,例如,“小孩”,“男人”等。 |
|
|
18
|
-
| <code>AudioReverbType</code> | <code>enum class</code> | 混响效果枚举,例如,“ktv”,“礼堂”等。 |
|
|
19
|
-
| <code>AudioEffectState</code> | <code>data class</code> | 代表音效模块的当前状态,通常用于 UI 渲染。包括变声状态、混响状态、耳返开启状态、耳返音量。 |
|
|
20
|
-
| <code>AudioEffectStore</code> | <code>abstract class</code> | 代表音效模块<strong>单例数据管理类</strong>。通过它您可以调用修改音效接口,当您调用接口后,相应的 <code>state</code> 属性会自动更新,可以通过订阅这个 state 响应式数据来接收和监听状态更新。 |
|
|
21
|
-
| <code>DeviceState</code> | <code>data class</code> | 代表设备模块的当前状态,通常用于 UI 渲染。核心属性包括摄像头、麦克风的设备状态。 |
|
|
22
|
-
| <code>DeviceStore</code> | <code>abstract class</code> | 代表设备模块<strong>单例数据管理类</strong>。通过它您可以调用操作摄像头、麦克风接口,当您调用接口后,相应的 <code>state</code> 属性会自动更新,可以通过订阅这个 state 响应式数据来接收和监听状态更新。 |
|
|
23
|
-
|
|
24
|
-
## 实现步骤
|
|
25
|
-
|
|
26
|
-
### 步骤1:组件集成
|
|
27
|
-
|
|
28
|
-
请参考 开播与收听 集成 **AtomicXCore。**
|
|
29
|
-
|
|
30
|
-
### 步骤2:获取 Store 实例
|
|
31
|
-
|
|
32
|
-
`AudioEffectStore` 和 `DeviceStore` 是单例对象,您可以直接通过 shared 属性在项目的任何位置获取实例。您也可以参考 TUILiveKit 开源 UI Demo 项目中的 [AudioEffectPanel.kt](https://github.com/Tencent-RTC/TUIKit_Android/blob/main/live/tuilivekit/src/main/java/com/trtc/uikit/livekit/component/audioeffect/AudioEffectPanel.kt) 文件来了解完整的实现逻辑。
|
|
33
|
-
``` java
|
|
34
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
35
|
-
import io.trtc.tuikit.atomicxcore.api.device.DeviceStore
|
|
36
|
-
|
|
37
|
-
val audioEffectStore = AudioEffectStore.shared()
|
|
38
|
-
val deviceStore = DeviceStore.shared()
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 步骤3:实现耳返功能
|
|
42
|
-
|
|
43
|
-
耳返功能允许用户实时监听自己的麦克风声音,可以通过调用本节介绍的接口管理耳返功能。
|
|
44
|
-
|
|
45
|
-
> **注意:**
|
|
46
|
-
>
|
|
47
|
-
|
|
48
|
-
> 耳返功能通常需要连接耳机才能正常工作。
|
|
49
|
-
>
|
|
50
|
-
|
|
51
|
-
#### 实现方式:
|
|
52
|
-
1. **开关耳返**:您可以使用 `Switch` 控件实现开关耳返功能。
|
|
53
|
-
|
|
54
|
-
2. **设置耳返音量值**:您可以使用 `SeekBar` 控件实现左右拖动滑块来调节音量的功能,并将 `SeekBar` 的值映射为音量值,调用 `setOutputVolume(volume)。`请注意,该接口接收的参数范围是 `[0, 150],`所以您需要将 UI 控件的值(例如 UISlider 的 `0 - 1.0`)映射到 `0 - 150` 的范围。
|
|
55
|
-
|
|
56
|
-
3. **监听状态更新 UI**:您可以订阅实时的耳返状态值更新 `UI`。
|
|
57
|
-
|
|
58
|
-
#### 代码示例:
|
|
59
|
-
``` java
|
|
60
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
61
|
-
import kotlinx.coroutines.CoroutineScope
|
|
62
|
-
import kotlinx.coroutines.Dispatchers
|
|
63
|
-
import kotlinx.coroutines.launch
|
|
64
|
-
|
|
65
|
-
// 1. 开启耳返(建议提示用户插入耳机)
|
|
66
|
-
audioEffectStore.setVoiceEarMonitorEnable(true)
|
|
67
|
-
|
|
68
|
-
// 2. 调节耳返音量
|
|
69
|
-
audioEffectStore.setVoiceEarMonitorVolume(80)
|
|
70
|
-
|
|
71
|
-
// 3. 关闭耳返
|
|
72
|
-
audioEffectStore.setVoiceEarMonitorEnable(false)
|
|
73
|
-
|
|
74
|
-
// 4. 监听状态
|
|
75
|
-
CoroutineScope(Dispatchers.Main).launch {
|
|
76
|
-
audioEffectStore.audioEffectState.earMonitorVolume.collect {
|
|
77
|
-
print("耳返音量: $it")
|
|
78
|
-
//更新UI 显示数值
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
#### setVoiceEarMonitorEnable 接口参数
|
|
84
|
-
| <strong>参数名</strong> | <strong>类型</strong> | <strong>描述</strong> |
|
|
85
|
-
| --- | --- | --- |
|
|
86
|
-
| <code>enable</code> | <code>Boolean</code> | 是否开启耳返。<br>- true:开启<br>- false:关闭 |
|
|
87
|
-
|
|
88
|
-
#### setVoiceEarMonitorVolume 接口参数
|
|
89
|
-
| <strong>参数名</strong> | <strong>类型</strong> | <strong>描述</strong> |
|
|
90
|
-
| --- | --- | --- |
|
|
91
|
-
| <code>volume</code> | <code>Int</code> | 耳返音量大小。<br>- 取值范围: [0, 150]<br>- 默认值:100 |
|
|
92
|
-
|
|
93
|
-
### 步骤4:实现人声音量调节
|
|
94
|
-
|
|
95
|
-
当主播希望调节自己的上行采集音量大小时,调用 `DeviceStore` 的 `setCaptureVolume(volume)` 方法传入音量值即可。
|
|
96
|
-
|
|
97
|
-
#### 实现方式:
|
|
98
|
-
1. **设置采集音量值**:您可以使用 `SeekBar` 控件实现左右拖动滑块来调节音量的功能,并将 `SeekBar` 的值映射成音量值后调用 `setCaptureVolume(80)。`请注意,该接口接收的参数范围是 `[0, 150],`所以您需要将 `UI` 控件的值(例如 `SeekBar` 的 `0 - 150`)映射到 `0 - 150` 的范围。
|
|
99
|
-
|
|
100
|
-
2. **监听状态更新 UI**:您可以订阅实时的音量状态值更新 UI。
|
|
101
|
-
|
|
102
|
-
#### 示例代码:
|
|
103
|
-
``` java
|
|
104
|
-
import kotlinx.coroutines.CoroutineScope
|
|
105
|
-
import kotlinx.coroutines.Dispatchers
|
|
106
|
-
import kotlinx.coroutines.launch
|
|
107
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
108
|
-
import io.trtc.tuikit.atomicxcore.api.device.DeviceStore
|
|
109
|
-
|
|
110
|
-
// 1. 调节音量
|
|
111
|
-
deviceStore.setCaptureVolume(80)
|
|
112
|
-
|
|
113
|
-
// 2. 监听数据变化
|
|
114
|
-
CoroutineScope(Dispatchers.Main).launch {
|
|
115
|
-
deviceStore.deviceState.captureVolume.collect {
|
|
116
|
-
//更新显示数值
|
|
117
|
-
print("采集音量: $it")
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
#### setCaptureVolume 接口参数
|
|
123
|
-
| <strong>参数名</strong> | <strong>类型</strong> | <strong>描述</strong> |
|
|
124
|
-
| --- | --- | --- |
|
|
125
|
-
| <code>volume</code> | <code>Int</code> | 采集音量大小。<br>- 取值范围: [0, 150]<br>- 默认值:100 |
|
|
126
|
-
|
|
127
|
-
### 步骤5:实现变声效果
|
|
128
|
-
|
|
129
|
-
当主播希望改变自己的声音时,您可以调用 `setAudioChangerType(type)`方法,传入相应的 Type 枚举值即可切换效果。
|
|
130
|
-
|
|
131
|
-
#### 示例代码:
|
|
132
|
-
``` java
|
|
133
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
134
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioChangerType
|
|
135
|
-
|
|
136
|
-
// 示例:设置变声为“萝莉”
|
|
137
|
-
audioEffectStore.setAudioChangerType(AudioChangerType.LITTLE_GIRL)
|
|
138
|
-
|
|
139
|
-
// 示例:关闭变声
|
|
140
|
-
audioEffectStore.setAudioChangerType(AudioChangerType.NONE)
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
#### setAudioChangerType 接口参数
|
|
144
|
-
|
|
145
|
-
|**参数名**|**类型**|**描述**|
|
|
146
|
-
|---------|---------|---------|
|
|
147
|
-
|`type`|`AudioChangerType`|变声效果枚举。|
|
|
148
|
-
|
|
149
|
-
### 步骤6:实现混响效果
|
|
150
|
-
|
|
151
|
-
当主播希望给自己的声音添加混响效果时,您可以调用 `setAudioReverbType(type)` 方法,传入相应的 Type 枚举值即可切换效果。
|
|
152
|
-
``` java
|
|
153
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
154
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioReverbType
|
|
155
|
-
|
|
156
|
-
// 示例:设置混响为“KTV”
|
|
157
|
-
audioEffectStore.setAudioReverbType(AudioReverbType.KTV)
|
|
158
|
-
|
|
159
|
-
// 示例:关闭混响
|
|
160
|
-
audioEffectStore.setAudioReverbType(AudioReverbType.NONE)
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
#### setAudioReverbType 接口参数
|
|
164
|
-
|
|
165
|
-
|**参数名**|**类型**|**描述**|
|
|
166
|
-
|---------|---------|---------|
|
|
167
|
-
|`type`|`AudioReverbType`|混响效果枚举。|
|
|
168
|
-
|
|
169
|
-
### 步骤7:重置音效设置
|
|
170
|
-
|
|
171
|
-
> **重要:**
|
|
172
|
-
>
|
|
173
|
-
|
|
174
|
-
> `AudioEffectStore` 和 `DeviceStore` 是单例,这意味着音效和设备设置是全局生效的,如果您在当前直播间的设置不想影响到您创建的其他直播间,就需要在当前直播间结束的时候重置音效和设备设置。
|
|
175
|
-
>
|
|
176
|
-
|
|
177
|
-
以下两种情况您可能需要重置音效设置:
|
|
178
|
-
1. 当前直播间结束时,需要重置音效设置。
|
|
179
|
-
|
|
180
|
-
2. 您需要提供“一键恢复”的功能,可以通过调用 `store` 的 `reset()` 方法实现。
|
|
181
|
-
|
|
182
|
-
``` java
|
|
183
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
184
|
-
import io.trtc.tuikit.atomicxcore.api.device.DeviceStore
|
|
185
|
-
|
|
186
|
-
// 一键重置所有变声和混响效果
|
|
187
|
-
AudioEffectStore.shared().reset()
|
|
188
|
-
DeviceStore.shared().reset()
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
## API 文档
|
|
193
|
-
|
|
194
|
-
关于 [AudioEffectStore](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.device/-audio-effect-store/index.html) 和 [DeviceStore](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.device/-device-store/index.html) 及其相关类的所有公开接口、属性的详细信息,请参阅随 [AtomicXCore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore) 框架的官方 API 文档。
|
|
195
|
-
|
|
196
|
-
|**Store/Component**|**功能描述**|**API 文档**|
|
|
197
|
-
|---------|---------|---------|
|
|
198
|
-
|**AudioEffectStore**|音效管理:进行音效设置,并获取实时音效状态。|[API 文档](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.device/-audio-effect-store/index.html)|
|
|
199
|
-
|**DeviceStore **|设备管理:进行摄像头、麦克风操作,并获取实时设备状态。|[API 文档](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.device/-device-store/index.html)|
|
|
200
|
-
|
|
201
|
-
## 常见问题
|
|
202
|
-
|
|
203
|
-
### 音效和设备接口的调用时机有没有要求?
|
|
204
|
-
|
|
205
|
-
没有限制。`AudioEffectStore` 和 `DeviceStore` 的设置是全局生效的,您可以在进入直播间之前或之后随时调用相关接口(例如设置变声、混响或耳返),设置会立即生效并被保留。
|
|
206
|
-
|
|
207
|
-
### **“人声音量” 和“耳返音量” 有什么区别?**
|
|
208
|
-
|
|
209
|
-
这是一个非常重要且易混淆的概念,区别如下:
|
|
210
|
-
- **人声音量 (CaptureVolume):**通过 `DeviceStore.setCaptureVolume()` 设置**。它决定了观众**能听到的您的声音大小。
|
|
211
|
-
|
|
212
|
-
- **耳返音量 (EarMonitorVolume):**通过 `AudioEffectStore.setVoiceEarMonitorVolume()`** 设置。它只**决定了**您自己**在耳机里听到的监听声音大小,**不会**影响观众。
|
|
213
|
-
|
|
214
|
-
### **新创建的直播间为什么直接就有音效、或者出现音量很大、很小等问题?**
|
|
215
|
-
|
|
216
|
-
`AudioEffectStore` 和 `DeviceStore` 是单例,这意味着音效和设备设置是全局生效的,出现这种情况很可能是因为您之前设置过音效但是没有重置,需要在合适的地方调用 `reset()` 方法重置。
|
|
217
|
-
|
|
218
|
-
### **为什么我开启了“耳返”,但是听不到自己的声音?**
|
|
219
|
-
|
|
220
|
-
请您按照以下步骤检查:
|
|
221
|
-
1. **是否插入耳机**:耳返功能绝大多数情况下依赖耳机才能生效,请确保已连接有线或蓝牙耳机。
|
|
222
|
-
|
|
223
|
-
2. **音量是否为0**:检查“耳返音量”是否被设置为了 0。
|
|
224
|
-
|
|
225
|
-
3. **麦克风是否开启**:确认 `DeviceStore` 中的麦克风是开启状态(即已调用 `openLocalMicrophone`)。
|
|
226
|
-
|
|
227
|
-
### **变声效果 和混响效果 可以同时生效吗?**
|
|
228
|
-
|
|
229
|
-
可以。`AudioChangerType` 和 `AudioReverbType` 是可以叠加生效的。例如,您可以同时设置 `AudioChangerType.LITTLE_GIRL` 变声和 `AudioReverbType.KTV` 混响。
|
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
`GiftStore` 是 `AtomicXCore` 中专门负责管理直播间礼物功能的模块。通过它,您可以为您的直播应用构建一套完整的礼物系统,实现丰富的营收和互动场景。
|
|
2
|
-
|
|
3
|
-
|礼物面板|弹幕礼物|全屏礼物|
|
|
4
|
-
|---------|---------|---------|
|
|
5
|
-
||||
|
|
6
|
-
|
|
7
|
-
## 核心功能
|
|
8
|
-
- **礼物列表获取**:从服务端拉取礼物面板所需的数据,包括礼物分类和礼物详情。
|
|
9
|
-
|
|
10
|
-
- **发送礼物**:观众可以向主播发送选定的礼物,并附带数量。
|
|
11
|
-
|
|
12
|
-
- **礼物事件广播**:实时接收房间内发生的礼物赠送事件,用于展示礼物动画和弹幕通知。
|
|
13
|
-
|
|
14
|
-
## 核心概念
|
|
15
|
-
|
|
16
|
-
在开始集成之前,我们先通过下表了解一下 `GiftStore` 相关的几个核心概念:
|
|
17
|
-
|
|
18
|
-
|**核心概念**|**类型**|**核心职责与描述**|
|
|
19
|
-
|---------|---------|---------|
|
|
20
|
-
|`Gift`|`data class`|代表一个具体的礼物数据模型。包含了礼物的 ID、名称、图标地址、动画资源地址 (resourceURL) 和价格 (coins) 等。|
|
|
21
|
-
|`GiftCategory`|`data class`|代表一个礼物分类,例如“热门”、“豪华”等。它包含了分类的名称以及该分类下的 **Gift** 列表。|
|
|
22
|
-
|`GiftState`|`data class`|代表礼物模块的当前状态。其核心属性 usableGifts 是一个 `StateFlow`,存储了从服务端拉取到的完整礼物列表。|
|
|
23
|
-
|`GiftEvent`|`abstract class`|代表直播间内发生的礼物事件监听器。目前只有 onReceiveGift,当有任何人(包括自己)发送礼物时,房间内所有人都会收到此事件。|
|
|
24
|
-
|`GiftStore`|`abstract class`|这是与礼物功能交互的核心管理类。通过它,您可以拉取礼物列表、发送礼物,并通过添加监听器来接收礼物事件。|
|
|
25
|
-
|
|
26
|
-
## 实现步骤
|
|
27
|
-
|
|
28
|
-
### 步骤1:组件集成
|
|
29
|
-
|
|
30
|
-
> **说明:**
|
|
31
|
-
>
|
|
32
|
-
|
|
33
|
-
> 使用**礼物系统**要求开通TUILiveKit **多人连麦版**、**大规模直播版**,不同套餐中可配置的礼物数量有所不同,详细参见 功能与计费说明 中的**礼物系统**说明。
|
|
34
|
-
>
|
|
35
|
-
|
|
36
|
-
- **视频直播**:请参考 快速接入 集成 **AtomicXCore**,完成接入。
|
|
37
|
-
|
|
38
|
-
- **语聊房**:请参考 快速接入 集成 **AtomicXCore**,完成接入。
|
|
39
|
-
|
|
40
|
-
### 步骤2:初始化并监听礼物事件
|
|
41
|
-
|
|
42
|
-
获取 GiftStore 实例,并设置监听器以接收礼物事件和礼物列表更新。
|
|
43
|
-
|
|
44
|
-
#### 实现方式:
|
|
45
|
-
1. **获取实例**:使用 `GiftStore.create(liveID)` 获取与当前直播间绑定的 `GiftStore` 实例。
|
|
46
|
-
|
|
47
|
-
2. **添加监听器**:添加 `GiftListener` 以接收 `onReceiveGift` 事件。
|
|
48
|
-
|
|
49
|
-
3. **订阅状态**:订阅 `giftStore.giftState.usableGifts` 以获取礼物列表。
|
|
50
|
-
|
|
51
|
-
#### 代码示例:
|
|
52
|
-
``` kotlin
|
|
53
|
-
import io.trtc.tuikit.atomicxcore.api.gift.Gift
|
|
54
|
-
import io.trtc.tuikit.atomicxcore.api.gift.GiftCategory
|
|
55
|
-
import io.trtc.tuikit.atomicxcore.api.gift.GiftListener
|
|
56
|
-
import io.trtc.tuikit.atomicxcore.api.gift.GiftStore
|
|
57
|
-
import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
|
|
58
|
-
import kotlinx.coroutines.flow.StateFlow
|
|
59
|
-
import kotlinx.coroutines.flow.MutableStateFlow
|
|
60
|
-
import kotlinx.coroutines.flow.asStateFlow
|
|
61
|
-
import kotlinx.coroutines.CoroutineScope
|
|
62
|
-
import kotlinx.coroutines.Dispatchers
|
|
63
|
-
import kotlinx.coroutines.launch
|
|
64
|
-
|
|
65
|
-
class GiftManager(
|
|
66
|
-
private val liveId: String
|
|
67
|
-
) {
|
|
68
|
-
private val giftStore: GiftStore = GiftStore.create(liveId)
|
|
69
|
-
private val coroutineScope = CoroutineScope(Dispatchers.Main)
|
|
70
|
-
// 对外暴露礼物列表
|
|
71
|
-
private val _giftList = MutableStateFlow<List<GiftCategory>>(emptyList())
|
|
72
|
-
val giftList: StateFlow<List<GiftCategory>> = _giftList.asStateFlow()
|
|
73
|
-
|
|
74
|
-
private val giftListener = object : GiftListener() {
|
|
75
|
-
override fun onReceiveGift(liveID: String, gift: Gift, count: Int, sender: LiveUserInfo) {
|
|
76
|
-
// 收到事件后,将其转发给UI层处理
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
init {
|
|
81
|
-
setupGiftListener()
|
|
82
|
-
subscribeToGiftState()
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/// 2. 订阅礼物事件
|
|
86
|
-
private fun setupGiftListener() {
|
|
87
|
-
giftStore.addGiftListener(giftListener)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/// 3. 订阅礼物列表状态
|
|
91
|
-
private fun subscribeToGiftState() {
|
|
92
|
-
coroutineScope.launch(Dispatchers.Main) {
|
|
93
|
-
giftStore.giftState.usableGifts.collect { giftList ->
|
|
94
|
-
// 仅在列表内容变化时才更新
|
|
95
|
-
_giftList.value = giftList
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
#### 礼物列表结构体参数
|
|
103
|
-
- `GiftCategory`**参数说明**
|
|
104
|
-
|
|
105
|
-
|**参数**|**类型**|**描述**|
|
|
106
|
-
|---------|---------|---------|
|
|
107
|
-
|`categoryID`|`String`|礼物分类的唯一 ID。|
|
|
108
|
-
|`name`|`String`|礼物分类的显示名称。|
|
|
109
|
-
|`desc`|`String`|礼物分类的描述信息。|
|
|
110
|
-
|`extensionInfo`|`Map<String, String>`|扩展信息字段。|
|
|
111
|
-
|`giftList`|`List`|该分类下包含的 Gift 礼物对象数组。|
|
|
112
|
-
|
|
113
|
-
- `Gift`** 参数说明**
|
|
114
|
-
|
|
115
|
-
|**参数**|**类型**|**描述**|
|
|
116
|
-
|---------|---------|---------|
|
|
117
|
-
|`giftID`|`String`| 礼物的唯一 ID。|
|
|
118
|
-
|`name`|`String`| 礼物的显示名称。|
|
|
119
|
-
|`desc`|`String`| 礼物的描述信息。|
|
|
120
|
-
|`iconURL`|`String`| 礼物图标 URL。|
|
|
121
|
-
|`resourceURL`|`String`| 礼物动画资源 URL。|
|
|
122
|
-
|`level`|`Long`| 礼物等级。|
|
|
123
|
-
|`coins`|`Long`| 礼物价格。|
|
|
124
|
-
|`extensionInfo`|`Map<String, String>`| 扩展信息字段。|
|
|
125
|
-
|
|
126
|
-
### 步骤3:获取礼物列表
|
|
127
|
-
|
|
128
|
-
调用 `refreshUsableGifts` 方法,从服务端拉取礼物数据。
|
|
129
|
-
|
|
130
|
-
#### 实现方式:
|
|
131
|
-
1. **调用接口**:在合适的时机(如进入直播间后)调用 `giftStore.refreshUsableGifts()`。
|
|
132
|
-
|
|
133
|
-
2. **处理回调**:可选地处理 completion 回调以获知拉取结果。
|
|
134
|
-
|
|
135
|
-
3. **接收数据**:拉取成功后,通过步骤2中对 giftStore.giftState.usableGifts 的订阅,自动接收到更新后的 usableGifts 列表。
|
|
136
|
-
|
|
137
|
-
#### 代码示例:
|
|
138
|
-
``` kotlin
|
|
139
|
-
class GiftManager(
|
|
140
|
-
private val liveId: String
|
|
141
|
-
) {
|
|
142
|
-
private val giftStore: GiftStore = GiftStore.create(liveId)
|
|
143
|
-
|
|
144
|
-
/// 从服务端刷新礼物列表
|
|
145
|
-
fun fetchGiftList() {
|
|
146
|
-
giftStore.refreshUsableGifts(object : CompletionHandler {
|
|
147
|
-
override fun onSuccess() {
|
|
148
|
-
println("礼物列表拉取成功")
|
|
149
|
-
// 成功后,数据会通过 giftState 订阅通道自动更新
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
override fun onFailure(code: Int, desc: String) {
|
|
153
|
-
println("礼物列表拉取失败: $desc")
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### 步骤4:发送礼物
|
|
161
|
-
|
|
162
|
-
当用户在礼物面板选择一个礼物并点击发送时,调用 `sendGift` 接口将礼物发送出去。
|
|
163
|
-
|
|
164
|
-
#### 实现方式:
|
|
165
|
-
1. **获取参数**:从UI获取用户选择的 giftID 和发送数量 count。
|
|
166
|
-
|
|
167
|
-
2. **调用接口**:调用 `giftStore.sendGift(giftID, count, completion)`。
|
|
168
|
-
|
|
169
|
-
3. **处理回调**:在 `completion` 回调中处理发送失败的情况(例如余额不足提示);发送成功后的 UI 更新(动画、弹幕)应由 `onReceiveGift` 事件驱动。
|
|
170
|
-
|
|
171
|
-
#### 代码示例:
|
|
172
|
-
``` kotlin
|
|
173
|
-
class GiftManager(
|
|
174
|
-
private val liveId: String
|
|
175
|
-
) {
|
|
176
|
-
private val giftStore: GiftStore = GiftStore.create(liveId)
|
|
177
|
-
|
|
178
|
-
/// 用户发送一个礼物
|
|
179
|
-
fun sendGift(giftID: String, count: Int) {
|
|
180
|
-
giftStore.sendGift(giftID, count, object : CompletionHandler {
|
|
181
|
-
override fun onSuccess() {
|
|
182
|
-
println("礼物 $giftID 发送成功")
|
|
183
|
-
// 发送成功后,包括发送者在内的所有人都会收到 onReceiveGift 事件
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
override fun onFailure(code: Int, desc: String) {
|
|
187
|
-
println("礼物发送失败: $desc")
|
|
188
|
-
// 可以在此提示用户,例如"余额不足"或"网络错误"
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
#### `sendGift`接口参数
|
|
196
|
-
|
|
197
|
-
|**参数名**|**类型**|**描述**|
|
|
198
|
-
|---------|---------|---------|
|
|
199
|
-
|`giftID`|`String`|要发送的礼物的唯一 ID。|
|
|
200
|
-
|`count`|`Int`|发送的数量。|
|
|
201
|
-
|`completion`|`CompletionHandler?`|发送完成后的回调。|
|
|
202
|
-
|
|
203
|
-
## 功能进阶
|
|
204
|
-
|
|
205
|
-
`GiftStore` 的功能高度依赖于您的业务后台服务。本章将指导您如何通过服务端配置和客户端实现,构建功能丰富、体验卓越的礼物互动系统。
|
|
206
|
-
|
|
207
|
-
### **礼物素材配置**
|
|
208
|
-
|
|
209
|
-
您需要自定义直播间可用的礼物种类、分类、名称、图标、价格以及动画效果,以满足运营需求和品牌特色。
|
|
210
|
-
|
|
211
|
-
#### 实现方式
|
|
212
|
-
1. **服务端配置**:使用 LiveKit 服务端 REST API 管理礼物信息、分类、多语言等。请参考 [礼物配置指引文档](https://cloud.tencent.com/document/product/647/121321)。
|
|
213
|
-
|
|
214
|
-
2. **客户端拉取**:在客户端调用 `refreshUsableGifts` 获取配置数据。
|
|
215
|
-
|
|
216
|
-
3. **UI 展示**:使用拉取到的 `List<GiftCategory>` 数据填充礼物面板。
|
|
217
|
-
|
|
218
|
-
#### **配置时序图**
|
|
219
|
-
|
|
220
|
-
#### **涉及 REST API 接口一览**
|
|
221
|
-
| 接口分类 | 接口 | 请求示例 |
|
|
222
|
-
| --- | --- | --- |
|
|
223
|
-
| 礼物管理 | 添加礼物信息 | 请求示例 |
|
|
224
|
-
| 删除礼物信息 | 请求示例 | |
|
|
225
|
-
| 查询礼物信息 | 请求示例 | |
|
|
226
|
-
| 礼物分类管理 | 添加礼物分类信息 | 请求示例 |
|
|
227
|
-
| 删除指定礼物分类信息 | 请求示例 | |
|
|
228
|
-
| 获取指定礼物分类信息 | 请求示例 | |
|
|
229
|
-
| 礼物关系管理 | 添加指定礼物分类和礼物间的关系 | 请求示例 |
|
|
230
|
-
| 删除指定礼物分类和礼物间的关系 | 请求示例 | |
|
|
231
|
-
| 获取指定礼物分类下的礼物关系 | 请求示例 | |
|
|
232
|
-
| 礼物多语言管理 | 添加礼物多语言信息 | 请求示例 |
|
|
233
|
-
| 删除指定礼物多语言信息 | 请求示例 | |
|
|
234
|
-
| 获取礼物多语言信息 | 请求示例 | |
|
|
235
|
-
| 添加礼物分类多语言信息 | 请求示例 | |
|
|
236
|
-
| 删除指定礼物分类多语言信息 | 请求示例 | |
|
|
237
|
-
| 获取礼物分类多语言信息 | 请求示例 | |
|
|
238
|
-
|
|
239
|
-
### 计费与送礼扣费流程
|
|
240
|
-
|
|
241
|
-
当观众赠送礼物时,需要确保其账户余额充足,并完成实际的扣费操作,然后才能触发礼物特效的播放和广播。
|
|
242
|
-
|
|
243
|
-
#### 实现方式
|
|
244
|
-
1. **后台配置回调**:在 LiveKit 后台配置您的自建计费系统的回调 URL。参考 回调配置文档。
|
|
245
|
-
|
|
246
|
-
2. **客户端发送**:客户端调用 `sendGift`。
|
|
247
|
-
|
|
248
|
-
3. **后台交互**:LiveKit 后台调用您的回调 URL,您的计费系统执行扣费并返回结果。
|
|
249
|
-
|
|
250
|
-
4. **结果同步**:扣费成功,AtomicXCore 广播 `onReceiveGift` 事件;扣费失败,`sendGift` 的 `completion` 收到错误。
|
|
251
|
-
|
|
252
|
-
#### 调用流程图
|
|
253
|
-
|
|
254
|
-
#### 涉及 REST API 接口一览
|
|
255
|
-
|
|
256
|
-
|接口|说明|请求示例|
|
|
257
|
-
|---------|---------|---------|
|
|
258
|
-
|回调配置 - 发送礼物之前回调|客户后台可以通过该回调决定是否通过送礼前校验等场景|调用示例|
|
|
259
|
-
|
|
260
|
-
### 实现全屏礼物动画播放
|
|
261
|
-
|
|
262
|
-
当直播间有用户(包括自己)发送了"火箭"、"嘉年华"等豪华礼物时,全屏播放一个酷炫的礼物动画(例如 SVGA 动画),营造热烈的氛围。
|
|
263
|
-
|
|
264
|
-
#### 实现方式
|
|
265
|
-
|
|
266
|
-
`AtomicXCore` 本身不包含礼物动画播放器,您需要根据业务需求选择并集成第三方库。以下是两种方案的对比:
|
|
267
|
-
|
|
268
|
-
|**对比项**|**基础方案 (SVGAPlayer-Android)**|**高级方案 (TCEffectPlayerKit)**|
|
|
269
|
-
|---------|---------|---------|
|
|
270
|
-
|计费|免费 (开源库)|付费 (需购买 License),请参见 [付费指引](https://cloud.tencent.com/document/product/616/116461)|
|
|
271
|
-
|集成方式|需手动集成 SVGAPlayer 库 (例如通过 Gradle)|需额外集成 TCEffectPlayerKit 并进行鉴权|
|
|
272
|
-
|动画格式支持|仅支持 SVGA|SVGA、PAG、WebP、Lottie、MP4 等多种格式|
|
|
273
|
-
|性能|建议 SVGA 文件 ≤ 10MB|支持更大的动画文件,复杂特效/多动画并发/低端机表现更优|
|
|
274
|
-
|推荐场景|礼物动画格式统一为 SVGA,且文件大小可控|需要支持多种动画格式,或对动画性能/设备兼容性有更高要求|
|
|
275
|
-
|
|
276
|
-
本章节主要演示基础方案的集成。如果您选择高级方案,请参见 [TCEffectPlayer 集成指引](https://cloud.tencent.com/document/product/616/116472)。
|
|
277
|
-
|
|
278
|
-
#### 基础方案实现:使用 SVGAPlayer
|
|
279
|
-
1. **集成 SVGAPlayer**: 在您的 `build.gradle` 文件中,添加 `SVGAPlayer` 的依赖并同步项目。
|
|
280
|
-
|
|
281
|
-
``` gradle
|
|
282
|
-
dependencies {
|
|
283
|
-
// ... other dependencies
|
|
284
|
-
implementation 'com.github.yyued:SVGAPlayer-Android:2.6.1'
|
|
285
|
-
}
|
|
286
|
-
```
|
|
287
|
-
2. **监听礼物事件**: 订阅 `GiftStore` 的 `GiftListener`。
|
|
288
|
-
|
|
289
|
-
3. **解析并播放**: 当收到 `onReceiveGift` 事件时,检查 `gift.resourceURL` 是否有效且指向一个 SVGA 文件。如果是,则使用 `SVGAParser` 解析 URL,并将解析后的 `SVGAVideoEntity` 交给 `SVGAPlayer` 实例播放。
|
|
290
|
-
|
|
291
|
-
#### 代码示例
|
|
292
|
-
``` kotlin
|
|
293
|
-
import android.os.Bundle
|
|
294
|
-
import androidx.appcompat.app.AppCompatActivity
|
|
295
|
-
import com.opensource.svgaplayer.SVGACallback
|
|
296
|
-
import com.opensource.svgaplayer.SVGAParser
|
|
297
|
-
import com.opensource.svgaplayer.SVGAVideoEntity
|
|
298
|
-
import com.opensource.svgaplayer.SVGAImageView
|
|
299
|
-
import io.trtc.tuikit.atomicxcore.api.gift.Gift
|
|
300
|
-
import io.trtc.tuikit.atomicxcore.api.gift.GiftListener
|
|
301
|
-
import io.trtc.tuikit.atomicxcore.api.gift.GiftStore
|
|
302
|
-
import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
|
|
303
|
-
import java.net.URL
|
|
304
|
-
|
|
305
|
-
class LiveRoomActivity : AppCompatActivity() {
|
|
306
|
-
private lateinit var giftStore: GiftStore
|
|
307
|
-
private lateinit var svgaImageView: SVGAImageView
|
|
308
|
-
private lateinit var svgaParser: SVGAParser
|
|
309
|
-
|
|
310
|
-
override fun onCreate(savedInstanceState: Bundle?) {
|
|
311
|
-
super.onCreate(savedInstanceState)
|
|
312
|
-
setContentView(R.layout.activity_live_room)
|
|
313
|
-
setupSVGAPlayer()
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
private fun setupSVGAPlayer() {
|
|
317
|
-
svgaImageView = findViewById(R.id.svga_player)
|
|
318
|
-
svgaParser = SVGAParser(this)
|
|
319
|
-
svgaImageView.visibility = android.view.View.GONE
|
|
320
|
-
|
|
321
|
-
// 设置礼物播放次数为一次
|
|
322
|
-
svgaImageView.loops = 1
|
|
323
|
-
|
|
324
|
-
// 设置播放完成回调,用于隐藏和清理
|
|
325
|
-
svgaImageView.callback = object : SVGACallback {
|
|
326
|
-
override fun onFinished() {
|
|
327
|
-
svgaImageView.visibility = android.view.View.GONE
|
|
328
|
-
svgaImageView.clear()
|
|
329
|
-
}
|
|
330
|
-
override fun onPause() {}
|
|
331
|
-
override fun onRepeat() {}
|
|
332
|
-
override fun onStep(frame: Int, percentage: Double) {}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
private val giftListener = object : GiftListener() {
|
|
337
|
-
override fun onReceiveGift(liveID: String, gift: Gift, count: Int, sender: LiveUserInfo) {
|
|
338
|
-
if (gift.resourceURL.isNotEmpty()) {
|
|
339
|
-
try {
|
|
340
|
-
val url = URL(gift.resourceURL)
|
|
341
|
-
playAnimation(url)
|
|
342
|
-
} catch (e: Exception) {
|
|
343
|
-
println("无效的动画URL: ${gift.resourceURL}")
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
fun setupGiftSubscription(liveId: String) {
|
|
350
|
-
giftStore = GiftStore.create(liveId)
|
|
351
|
-
|
|
352
|
-
giftStore.addGiftListener(giftListener)
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
private fun playAnimation(url: URL) {
|
|
356
|
-
// 4. 解析播放
|
|
357
|
-
svgaParser.decodeFromURL(url, object : SVGAParser.ParseCompletion {
|
|
358
|
-
override fun onComplete(videoItem: SVGAVideoEntity) {
|
|
359
|
-
runOnUiThread {
|
|
360
|
-
svgaImageView.setVideoItem(videoItem)
|
|
361
|
-
svgaImageView.visibility = android.view.View.VISIBLE
|
|
362
|
-
svgaImageView.startAnimation()
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
override fun onError() {
|
|
367
|
-
println("SVGA 动画解析失败")
|
|
368
|
-
// 可以在此添加失败重试或上报逻辑
|
|
369
|
-
}
|
|
370
|
-
})
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
### 在弹幕区展示礼物赠送消息
|
|
376
|
-
|
|
377
|
-
当有用户发送礼物时,不仅播放动画,同时在公屏弹幕区域显示一条系统消息,例如:“【观众昵称】送出了【礼物名称】x【数量】”,让所有观众都能看到。
|
|
378
|
-
|
|
379
|
-
#### 实现方式
|
|
380
|
-
1. **监听事件**:订阅 `giftStore` 的 `GiftListener`。
|
|
381
|
-
|
|
382
|
-
2. **获取信息**:收到 `onReceiveGift` 事件后,提取发送者 sender、礼物 gift 和数量 count。
|
|
383
|
-
|
|
384
|
-
3. **获取弹幕 Store**:使用 `BarrageStore.create(liveID)` 获取与当前房间绑定的实例。
|
|
385
|
-
|
|
386
|
-
4. **拼接消息**:创建一条 `Barrage` 结构体,设置 `messageType = BarrageType.TEXT`,textContent 为拼接好的字符串(例如 “[`sender.userName`] 送出了 [`gift.name`] x [`count`]”)。
|
|
387
|
-
|
|
388
|
-
5. **本地插入**:调用 `barrageStore.appendLocalTip(message: giftTip)` 将消息插入本地列表。
|
|
389
|
-
|
|
390
|
-
#### 代码示例
|
|
391
|
-
``` kotlin
|
|
392
|
-
import io.trtc.tuikit.atomicxcore.api.barrage.Barrage
|
|
393
|
-
import io.trtc.tuikit.atomicxcore.api.barrage.BarrageStore
|
|
394
|
-
import io.trtc.tuikit.atomicxcore.api.barrage.BarrageType
|
|
395
|
-
import io.trtc.tuikit.atomicxcore.api.gift.Gift
|
|
396
|
-
import io.trtc.tuikit.atomicxcore.api.gift.GiftListener
|
|
397
|
-
import io.trtc.tuikit.atomicxcore.api.gift.GiftStore
|
|
398
|
-
import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
|
|
399
|
-
|
|
400
|
-
// 在 LiveRoomManager 或类似的顶层管理器中
|
|
401
|
-
class LiveRoomManager(
|
|
402
|
-
private val liveId: String
|
|
403
|
-
) {
|
|
404
|
-
private val giftStore: GiftStore = GiftStore.create(liveId)
|
|
405
|
-
private val barrageStore: BarrageStore = BarrageStore.create(liveId)
|
|
406
|
-
private val giftListener = object : GiftListener() {
|
|
407
|
-
override fun onReceiveGift(liveID: String, gift: Gift, count: Int, sender: LiveUserInfo) {
|
|
408
|
-
val tipText = "送出了 ${gift.name} x $count"
|
|
409
|
-
val giftTip = Barrage(
|
|
410
|
-
liveID = liveID,
|
|
411
|
-
messageType = BarrageType.TEXT,
|
|
412
|
-
textContent = tipText
|
|
413
|
-
sender = sender
|
|
414
|
-
)
|
|
415
|
-
barrageStore.appendLocalTip(giftTip)
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
private fun setupGiftToBarrageFlow() {
|
|
420
|
-
giftStore.addGiftListener(giftListener)
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
## API 文档
|
|
426
|
-
|
|
427
|
-
关于 [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) 及其相关类的所有公开接口、属性和方法的详细信息,请参阅随 [AtomicXCore](https://tencent-rtc.github.io/TUIKit_Android/index.html) 框架的官方 API 文档。本指南使用到的相关 Store 如下:
|
|
428
|
-
|
|
429
|
-
|Store/Component|功能描述|API 文档|
|
|
430
|
-
|---------|---------|---------|
|
|
431
|
-
|GiftStore|礼物互动:获取礼物列表,发送 / 接收礼物,监听礼物事件(含发送者、礼物详情)。|[API 文档](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)|
|
|
432
|
-
|BarrageStore|弹幕功能:发送文本 / 自定义弹幕,维护弹幕列表,实时监听弹幕状态。|[API 文档](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)|
|
|
433
|
-
|
|
434
|
-
## 常见问题
|
|
435
|
-
|
|
436
|
-
### `GiftStore` 的礼物列表是空的,我该怎么办?
|
|
437
|
-
|
|
438
|
-
您必须主动调用 `refreshUsableGifts(completion)`来从您的业务后台拉取礼物数据。这些礼物数据需要在您的业务后台通过服务端 REST API 进行配置。
|
|
439
|
-
|
|
440
|
-
### 如何实现礼物的多语言展示(例如中文、英文)?
|
|
441
|
-
|
|
442
|
-
`GiftStore` 提供了 `setLanguage(language: String)`接口。您可以在 `refreshUsableGifts` 之前调用此方法,传入目标语言代码(例如 "en" 或 "zh-CN")。服务端会根据此语言代码,返回对应语言的礼物名称和描述。
|
|
443
|
-
|
|
444
|
-
### 我调用 sendGift 发送了礼物,礼物动画为什么重复播放了两次?
|
|
445
|
-
|
|
446
|
-
`onReceiveGift` 事件是对房间内所有成员的广播(包括发送者自己)。如果您在 `sendGift` 的 `completion` 成功回调里执行了一次UI操作,同时又在 `onReceiveGift` 订阅中执行了相同的UI操作,就会造成重复。
|
|
447
|
-
- **实践教程**:UI 的更新(例如播放动画、弹幕提示)只在 `onReceiveGift` 事件的订阅中处理。`sendGift` 的 `completion`回调仅用于处理发送失败的逻辑(例如提示用户"发送失败"或"余额不足")。
|
|
448
|
-
|
|
449
|
-
### 礼物扣费逻辑在哪里实现?
|
|
450
|
-
|
|
451
|
-
礼物扣费逻辑完全由您的自建计费系统负责。`AtomicXCore` 通过后台回调机制与您的计费系统对接。客户端调用 `sendGift` 触发回调,您的后台服务完成扣费后,将结果返回给 `AtomicXCore` 后台,从而决定礼物事件是否广播。
|
|
452
|
-
|
|
453
|
-
### 送礼通知会被禁言或频控拦截吗?
|
|
454
|
-
|
|
455
|
-
不会。送礼通知(`onReceiveGift` 事件)不受禁言或消息频控影响,确保可靠投递。
|
|
456
|
-
|
|
457
|
-
### 礼物动画播放卡顿怎么办?
|
|
458
|
-
|
|
459
|
-
请检查您的 SVGA 文件大小,基础播放器建议不要超过 10MB。如果文件过大或动画复杂,您可以考虑集成 TUILiveKit 提供的高级特效播放器,以获得更优的性能表现。
|