@tencent-rtc/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.
- package/index.js +0 -4
- package/knowledge/chunker.js +83 -54
- package/knowledge/path-meta.js +179 -26
- package/knowledge/search/exact-lookup.js +153 -0
- package/knowledge/search/filter-pool.js +73 -19
- package/knowledge/search/product-scope-intent.js +2 -2
- package/knowledge/search/requires-framework.js +2 -2
- package/knowledge/search/search-knowledge.js +235 -58
- package/package.json +1 -1
- package/resource/index/manifest.json +1 -1
- package/resource/integration/callkit/preset/android/integration.md +2 -4
- package/resource/integration/callkit/preset/flutter/integration.md +4 -5
- package/resource/integration/callkit/preset/ios/integration.md +1 -4
- package/resource/integration/callkit/preset/react/integration.md +13 -20
- package/resource/integration/callkit/preset/vue/integration.md +14 -21
- package/resource/integration/chat/preset/android/integration.md +6 -9
- package/resource/integration/chat/preset/flutter/integration.md +9 -12
- package/resource/integration/chat/preset/ios/integration.md +2 -4
- package/resource/integration/chat/preset/react/integration.md +0 -10
- package/resource/integration/livekit/preset/live/android/live-audience-integration.md +129 -0
- package/resource/integration/livekit/preset/live/android/live-host-integration.md +219 -0
- package/resource/integration/livekit/preset/live/android/live-list-integration.md +261 -0
- package/resource/integration/livekit/preset/live/android/prepare-integration.md +254 -0
- package/resource/integration/livekit/preset/live/ios/live-audience-integration.md +202 -0
- package/resource/integration/livekit/preset/live/ios/live-host-integration.md +369 -0
- package/resource/integration/livekit/preset/live/ios/live-list-integration.md +229 -0
- package/resource/integration/livekit/preset/live/ios/prepare-integration.md +204 -0
- package/resource/integration/livekit/preset/live/vue/live-list-integration.md +0 -3
- package/resource/integration/livekit/preset/live/vue/live-player-desk-integration.md +0 -5
- package/resource/integration/livekit/preset/live/vue/live-player-h5-integration.md +0 -6
- package/resource/integration/livekit/preset/live/vue/live-pusher-integration.md +5 -10
- package/resource/integration/roomkit/preset/vue/integration.md +0 -4
- package/resource/knowledge/callkit/best-practice/web/callengine-invitation.md +80 -0
- package/resource/knowledge/callkit/best-practice/web/callengine-log-control.md +24 -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 +7 -8
- package/resource/knowledge/callkit/core-sdk/android/make-call.md +5 -7
- package/resource/knowledge/callkit/core-sdk/android/offline-push.md +3 -5
- package/resource/knowledge/callkit/core-sdk/flutter/answer-call.md +2 -6
- package/resource/knowledge/callkit/core-sdk/flutter/make-call.md +2 -6
- package/resource/knowledge/callkit/core-sdk/flutter/offline-push.md +4 -9
- package/resource/knowledge/callkit/core-sdk/ios/answer-call.md +1 -4
- package/resource/knowledge/callkit/core-sdk/ios/make-call.md +8 -11
- package/resource/knowledge/callkit/core-sdk/ios/offline-push.md +17 -23
- package/resource/knowledge/callkit/core-sdk/web/call-engine.md +33 -0
- package/resource/knowledge/callkit/core-sdk/web/call-event.md +327 -0
- package/resource/knowledge/callkit/core-sdk/web/callengine-api-overview.md +33 -0
- package/resource/knowledge/callkit/faq/android.md +0 -2
- package/resource/knowledge/callkit/faq/error-code.md +0 -2
- package/resource/knowledge/callkit/faq/flutter.md +2 -2
- package/resource/knowledge/callkit/faq/ios.md +3 -5
- package/resource/knowledge/callkit/faq/web.md +2 -3
- package/resource/knowledge/callkit/preset/android/api.md +2 -5
- package/resource/knowledge/callkit/preset/ios/api.md +0 -2
- package/resource/knowledge/callkit/preset/react/api.md +445 -0
- package/resource/knowledge/callkit/preset/react/uikit-api-reference.md +445 -0
- package/resource/knowledge/callkit/preset/vue/api.md +465 -0
- package/resource/knowledge/callkit/preset/vue/uikit-api-reference.md +465 -0
- 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 +1 -1
- package/resource/knowledge/chat/preset/android/features/language.md +0 -1
- package/resource/knowledge/chat/preset/android/features/message-input.md +1 -1
- package/resource/knowledge/chat/preset/android/features/message-list.md +2 -3
- 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 +3 -11
- package/resource/knowledge/chat/preset/flutter/features/conversation-list.md +0 -1
- package/resource/knowledge/chat/preset/flutter/features/message-list.md +1 -2
- package/resource/knowledge/chat/preset/flutter/features/search.md +5 -6
- package/resource/knowledge/chat/preset/flutter/features/theme.md +2 -2
- package/resource/knowledge/chat/preset/ios/features/chat-setting.md +1 -1
- package/resource/knowledge/chat/preset/ios/features/conversation-list.md +1 -2
- package/resource/knowledge/chat/preset/ios/features/message-list.md +1 -2
- package/resource/knowledge/chat/preset/ios/features/search.md +0 -1
- package/resource/knowledge/chat/preset/ios-uikit/integration.md +13 -15
- package/resource/knowledge/chat/preset/react/features/conversation-list.md +5 -5
- 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/react/features/theme.md +0 -1
- package/resource/knowledge/livekit/core-sdk/api-reference/android/AudioEffectStore.md +7 -14
- package/resource/knowledge/livekit/core-sdk/api-reference/android/BarrageStore.md +5 -8
- package/resource/knowledge/livekit/core-sdk/api-reference/android/BattleStore.md +15 -18
- package/resource/knowledge/livekit/core-sdk/api-reference/android/CameraView.md +1 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/android/CoGuestStore.md +15 -20
- package/resource/knowledge/livekit/core-sdk/api-reference/android/CoHostStore.md +10 -13
- package/resource/knowledge/livekit/core-sdk/api-reference/android/DeviceStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/android/GiftStore.md +4 -6
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LikeStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveAudienceStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveCoreView.md +1 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LiveSeatStore.md +8 -10
- package/resource/knowledge/livekit/core-sdk/api-reference/android/LoginStore.md +5 -7
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/AudioEffectStore.md +7 -14
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BarrageStore.md +6 -9
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BaseBeautyStore.md +1 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/BattleStore.md +15 -18
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoGuestStore.md +15 -20
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/CoHostStore.md +10 -13
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/DeviceStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/GiftStore.md +4 -6
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LikeStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveAudienceStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveCoreView.md +1 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LiveSeatStore.md +8 -10
- package/resource/knowledge/livekit/core-sdk/api-reference/flutter/LoginStore.md +3 -5
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/AudioEffectStore.md +7 -14
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/BarrageStore.md +5 -8
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/BaseBeautyStore.md +1 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/BattleStore.md +6 -9
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoGuestStore.md +5 -10
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/CoHostStore.md +3 -6
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/DeviceStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/GiftStore.md +4 -6
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LikeStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveAudienceStore.md +2 -4
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveCoreView.md +1 -2
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LiveSeatStore.md +4 -6
- package/resource/knowledge/livekit/core-sdk/api-reference/ios/LoginStore.md +3 -5
- package/resource/knowledge/livekit/core-sdk/api-reference/{web → vue}/index.md +24 -24
- package/resource/knowledge/livekit/core-sdk/{voice/android/voice-audio-effect.md → features/android/audio-effect.md} +1 -2
- package/resource/knowledge/livekit/core-sdk/{live/android/live-gift.md → features/android/gift.md} +2 -3
- package/resource/knowledge/livekit/core-sdk/{voice/android/voice-room-list.md → features/android/live-list.md} +2 -4
- 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} +2 -2
- package/resource/knowledge/livekit/core-sdk/{live/flutter/live-gift.md → features/flutter/gift.md} +2 -3
- 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 -2
- 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/{live/ios/live-base-beauty.md → features/ios/base-beauty.md} +2 -2
- package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-gift.md → features/ios/gift.md} +2 -3
- package/resource/knowledge/livekit/core-sdk/{voice/ios/voice-room-list.md → features/ios/live-list.md} +2 -4
- package/resource/knowledge/livekit/core-sdk/live/android/{live-co-guest-interaction.md → co-guest-interaction.md} +0 -1
- package/resource/knowledge/livekit/core-sdk/live/android/{live-host-interaction.md → host-interaction.md} +5 -7
- package/resource/knowledge/livekit/core-sdk/live/android/{live-integration.md → integration.md} +3 -6
- package/resource/knowledge/livekit/core-sdk/live/flutter/{live-co-guest-interaction.md → co-guest-interaction.md} +1 -1
- package/resource/knowledge/livekit/core-sdk/live/flutter/{live-host-interaction.md → host-interaction.md} +0 -2
- package/resource/knowledge/livekit/core-sdk/live/flutter/{live-integration.md → integration.md} +1 -4
- package/resource/knowledge/livekit/core-sdk/live/ios/{live-co-guest-interaction.md → co-guest-interaction.md} +0 -1
- package/resource/knowledge/livekit/core-sdk/live/ios/{live-host-interaction.md → host-interaction.md} +2 -4
- package/resource/knowledge/livekit/core-sdk/live/ios/{live-integration.md → integration.md} +2 -5
- package/resource/knowledge/livekit/core-sdk/voice/android/{voice-host-interaction.md → host-interaction.md} +3 -5
- package/resource/knowledge/livekit/core-sdk/voice/android/{voice-integration.md → integration.md} +3 -6
- package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-co-guest-interaction.md → co-guest-interaction.md} +1 -2
- package/resource/knowledge/livekit/core-sdk/voice/flutter/{voice-integration.md → integration.md} +6 -9
- package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-co-guest-interaction.md → co-guest-interaction.md} +2 -2
- package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-host-interaction.md → host-interaction.md} +4 -6
- package/resource/knowledge/livekit/core-sdk/voice/ios/{voice-integration.md → integration.md} +1 -4
- package/resource/knowledge/livekit/preset/live/vue/features/barrage.md +0 -2
- package/resource/knowledge/push/api-reference/android.md +123 -0
- package/resource/knowledge/push/api-reference/flutter.md +176 -0
- package/resource/knowledge/push/api-reference/harmonyos.md +138 -0
- package/resource/knowledge/push/api-reference/ios.md +176 -0
- package/resource/knowledge/push/api-reference/react-native.md +147 -0
- package/resource/knowledge/push/api-reference/uni-app.md +147 -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.md +4 -7
- package/resource/knowledge/push/config/harmonyos.md +0 -3
- package/resource/knowledge/push/config/ios.md +12 -20
- package/resource/knowledge/push/config/react-native.md +18 -26
- package/resource/knowledge/push/config/unity.md +20 -28
- package/resource/knowledge/push/config/unreal-engine.md +21 -29
- package/resource/knowledge/push/integration/android.md +6 -8
- package/resource/knowledge/push/integration/flutter.md +6 -9
- package/resource/knowledge/push/integration/harmonyos.md +1 -0
- package/resource/knowledge/push/integration/ios.md +7 -9
- package/resource/knowledge/push/integration/react-native.md +9 -13
- package/resource/knowledge/push/integration/uni-app.md +7 -7
- package/resource/knowledge/push/integration/unity.md +10 -13
- package/resource/knowledge/push/integration/unreal-engine.md +6 -9
- package/resource/knowledge/push/overview/prepare.md +2 -2
- package/resource/knowledge/roomkit/core-sdk/android/call-user-to-room.md +3 -3
- package/resource/knowledge/roomkit/core-sdk/android/capability-matrix.md +46 -0
- package/resource/knowledge/roomkit/core-sdk/android/room-participant-state.md +1 -1
- package/resource/knowledge/roomkit/core-sdk/android/room-state.md +2 -2
- package/resource/knowledge/roomkit/core-sdk/android/schedule-room.md +6 -6
- package/resource/knowledge/roomkit/core-sdk/android/unsupported-features.md +79 -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 +79 -0
- package/resource/knowledge/roomkit/core-sdk/ios/capability-matrix.md +46 -0
- package/resource/knowledge/roomkit/core-sdk/ios/room-participant-state.md +1 -1
- package/resource/knowledge/roomkit/core-sdk/ios/unsupported-features.md +79 -0
- package/resource/knowledge/roomkit/preset/android/integration.md +5 -7
- package/resource/knowledge/roomkit/preset/flutter/integration.md +2 -7
- package/resource/knowledge/roomkit/preset/ios/integration.md +3 -9
- package/resource/knowledge/roomkit/preset/react/integration.md +12 -16
- package/resource/knowledge/trtc/android/TRTCCloud.md +154 -238
- package/resource/knowledge/trtc/android/TRTCCloudDef.md +133 -134
- package/resource/knowledge/trtc/android/TRTCCloudListener.md +86 -120
- package/resource/knowledge/trtc/android/TRTCStatistics.md +10 -10
- package/resource/knowledge/trtc/android/TXAudioEffectManager.md +10 -30
- package/resource/knowledge/trtc/android/TXBeautyManager.md +25 -25
- package/resource/knowledge/trtc/android/TXDeviceManager.md +2 -2
- package/resource/knowledge/trtc/android/TXLiteAVCode.md +12 -12
- package/resource/knowledge/trtc/c++/ITRTCCloud.md +166 -261
- package/resource/knowledge/trtc/c++/ITRTCStatistics.md +12 -12
- package/resource/knowledge/trtc/c++/ITXAudioEffectManager.md +10 -30
- package/resource/knowledge/trtc/c++/ITXDeviceManager.md +9 -11
- package/resource/knowledge/trtc/c++/TRTCCloudCallback.md +96 -130
- package/resource/knowledge/trtc/c++/TRTCTypeDef.md +122 -123
- package/resource/knowledge/trtc/c++/TXLiteAVCode.md +12 -12
- package/resource/knowledge/trtc/ios/TRTCCloud.md +168 -255
- package/resource/knowledge/trtc/ios/TRTCCloudDef.md +124 -125
- package/resource/knowledge/trtc/ios/TRTCCloudDelegate.md +89 -124
- package/resource/knowledge/trtc/ios/TRTCStatistics.md +10 -10
- package/resource/knowledge/trtc/ios/TXAudioEffectManager.md +9 -28
- package/resource/knowledge/trtc/ios/TXBeautyManager.md +25 -25
- package/resource/knowledge/trtc/ios/TXDeviceManager.md +9 -11
- package/resource/knowledge/trtc/ios/TXLiteAVCode.md +12 -12
- package/server-config.js +7 -4
- package/server.js +21 -21
- 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 +61 -0
- package/tools/definitions/get_native_livekit_core_integration_def.js +3 -3
- 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/is-valid-sdkappid.js +4 -0
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/resource/knowledge/callkit/preset/web/api.md +0 -83
- package/resource/knowledge/livekit/core-sdk/live/android/live-audio-effect.md +0 -226
- package/resource/knowledge/livekit/core-sdk/live/android/live-live-list.md +0 -438
- package/resource/knowledge/livekit/core-sdk/live/flutter/live-barrage.md +0 -490
- 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 -264
- package/resource/knowledge/livekit/core-sdk/live/ios/live-audio-effect.md +0 -216
- package/resource/knowledge/livekit/core-sdk/live/ios/live-gift.md +0 -407
- package/resource/knowledge/livekit/core-sdk/live/ios/live-live-list.md +0 -349
- package/resource/knowledge/livekit/core-sdk/voice/android/voice-audience-list.md +0 -269
- package/resource/knowledge/livekit/core-sdk/voice/android/voice-barrage.md +0 -456
- package/resource/knowledge/livekit/core-sdk/voice/android/voice-gift.md +0 -455
- package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audience-list.md +0 -260
- package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-audio-effect.md +0 -598
- package/resource/knowledge/livekit/core-sdk/voice/flutter/voice-gift.md +0 -424
- package/resource/knowledge/livekit/core-sdk/voice/ios/voice-barrage.md +0 -408
- /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/android/live-barrage.md → features/android/barrage.md} +0 -0
- /package/resource/knowledge/livekit/core-sdk/{live/android/live-base-beauty.md → features/android/base-beauty.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/{live/ios/live-barrage.md → features/ios/barrage.md} +0 -0
- /package/resource/knowledge/livekit/core-sdk/voice/android/{voice-co-guest-interaction.md → co-guest-interaction.md} +0 -0
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
This document provides guidance on integrating audio effect controls into your live streaming application using the `AudioEffectStore` and `DeviceStore` modules from the **AtomicXCore** framework. These modules enable features such as microphone volume control, ear monitoring, and a variety of voice changing and reverb effects.
|
|
2
|
-
|
|
3
|
-
## Core Features
|
|
4
|
-
|
|
5
|
-
By combining `AudioEffectStore` and DeviceStore, you can implement the following core features:
|
|
6
|
-
- **Microphone Volume Adjustment**: Control the local microphone (capture) volume, which determines the volume your audience hears.
|
|
7
|
-
|
|
8
|
-
- **Ear Monitoring**: Allow hosts or co-hosts to hear their own voice in real time through headphones for monitoring and pronunciation correction.
|
|
9
|
-
|
|
10
|
-
- **Voice Effects**: Apply various voice changing effects, such as "Little Girl", "Deep Male", "Naughty Child", and more.
|
|
11
|
-
|
|
12
|
-
- **Reverb Effects**: Simulate different acoustic environments, such as KTV, metallic, deep, bright, and others.
|
|
13
|
-
|
|
14
|
-
## Core Concepts
|
|
15
|
-
|
|
16
|
-
|**Core Concept**|**Type**|**Core Responsibility & Description**|
|
|
17
|
-
|---------|---------|---------|
|
|
18
|
-
|`AudioChangerType`|`enum`|Enumerates available voice effects, such as "child", "man", etc.|
|
|
19
|
-
|`AudioReverbType`|`enum`|Enumerates available reverb effects, such as "ktv", "hall", etc.|
|
|
20
|
-
|`AudioEffectState`|`data`|Represents the current state of the audio effect module, typically used for UI rendering. Includes voice effect state, reverb state, ear monitoring enabled state, and ear monitor volume.|
|
|
21
|
-
|`AudioEffectStore`|`abstract`|Singleton data management class for audio effects. Use it to invoke audio effect APIs. After calling an API, the corresponding state property is automatically updated. Subscribe to this reactive state to receive and monitor updates.|
|
|
22
|
-
|`DeviceState`|`data`|Represents the current state of the device module, typically used for UI rendering. Core properties include camera and microphone status.|
|
|
23
|
-
|`DeviceStore`|`abstract`|Singleton data management class for device operations. Use it to control the camera and microphone. After calling an API, the corresponding state property is automatically updated. Subscribe to this reactive state to receive and monitor updates.|
|
|
24
|
-
|
|
25
|
-
## Implementation
|
|
26
|
-
|
|
27
|
-
### Step 1: Component Integration
|
|
28
|
-
- **Video Live Streaming**: Please refer to Quick Start to integrate **AtomicXCore.**
|
|
29
|
-
|
|
30
|
-
- **Voice Chat Room**: Please refer to Quick Start to integrate **AtomicXCore**.
|
|
31
|
-
|
|
32
|
-
### Step 2: Obtain Store Instances
|
|
33
|
-
|
|
34
|
-
`AudioEffectStore` and `DeviceStore` are singleton objects. Access their instances anywhere in your project via the shared property. For a complete implementation example, see [AudioEffectPanel.kt](https://github.com/Tencent-RTC/TUIKit_Android/blob/main/live/tuilivekit/src/main/java/com/trtc/uikit/livekit/component/audioeffect/AudioEffectPanel.kt) in the TUILiveKit open-source UI demo.
|
|
35
|
-
``` java
|
|
36
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
37
|
-
import io.trtc.tuikit.atomicxcore.api.device.DeviceStore
|
|
38
|
-
|
|
39
|
-
val audioEffectStore = AudioEffectStore.shared()
|
|
40
|
-
val deviceStore = DeviceStore.shared()
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Step 3: Implement In-Ear Monitoring
|
|
44
|
-
|
|
45
|
-
Ear monitoring allows users to hear their own microphone audio in real time. Manage ear monitoring using the following APIs.
|
|
46
|
-
|
|
47
|
-
> **Note:**Ear monitoring typically requires headphones to function properly.
|
|
48
|
-
>
|
|
49
|
-
|
|
50
|
-
#### Implementation
|
|
51
|
-
1. **Toggle Ear Monitoring**: Use a `Switch` control to enable or disable ear monitoring.
|
|
52
|
-
|
|
53
|
-
2. **Set Ear Monitor Volume**: Use a `SeekBar` (or similar control) to adjust the ear monitor volume. Map the UI control's value to the [0, 150] range and call setVoiceEarMonitorVolume(volume).
|
|
54
|
-
|
|
55
|
-
3. **Listen for State Updates**: Subscribe to ear monitor state changes to update the UI in real time.
|
|
56
|
-
|
|
57
|
-
#### Code Example
|
|
58
|
-
``` java
|
|
59
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
60
|
-
import kotlinx.coroutines.CoroutineScope
|
|
61
|
-
import kotlinx.coroutines.Dispatchers
|
|
62
|
-
import kotlinx.coroutines.launch
|
|
63
|
-
|
|
64
|
-
// 1. Enable ear monitoring (prompt the user to connect headphones)
|
|
65
|
-
audioEffectStore.setVoiceEarMonitorEnable(true)
|
|
66
|
-
|
|
67
|
-
// 2. Set ear monitor volume
|
|
68
|
-
audioEffectStore.setVoiceEarMonitorVolume(80)
|
|
69
|
-
|
|
70
|
-
// 3. Disable ear monitoring
|
|
71
|
-
audioEffectStore.setVoiceEarMonitorEnable(false)
|
|
72
|
-
|
|
73
|
-
// 4. Listen for state updates
|
|
74
|
-
CoroutineScope(Dispatchers.Main).launch {
|
|
75
|
-
audioEffectStore.audioEffectState.earMonitorVolume.collect {
|
|
76
|
-
print("Ear monitor volume: $it")
|
|
77
|
-
// Update UI with the value
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
#### setVoiceEarMonitorEnable Parameters
|
|
83
|
-
| <strong>Parameter Name</strong> | <strong>Type</strong> | <strong>Description</strong> |
|
|
84
|
-
| --- | --- | --- |
|
|
85
|
-
| <code>enable</code> | <code>Boolean</code> | Whether to enable ear monitoring.<br>- true: Enable<br>- false: Disable |
|
|
86
|
-
|
|
87
|
-
#### setVoiceEarMonitorVolume Parameters
|
|
88
|
-
| <strong>Parameter Name</strong> | <strong>Type</strong> | <strong>Description</strong> |
|
|
89
|
-
| --- | --- | --- |
|
|
90
|
-
| <code>volume</code> | <code>Int</code> | Ear monitor volume.<br>- Range: [0, 150]<br>- Default: 100 |
|
|
91
|
-
|
|
92
|
-
### Step 4: Implement Microphone Volume Adjustment
|
|
93
|
-
|
|
94
|
-
To adjust the microphone (capture) volume, call `setCaptureVolume(volume) `on `DeviceStore` with the desired value.
|
|
95
|
-
|
|
96
|
-
#### Implementation
|
|
97
|
-
1. **Set Capture Volume**: Use a `SeekBar` or similar control to adjust the microphone volume. Map the UI control's value to the [0, 150] range and call `setCaptureVolume(volume)`.
|
|
98
|
-
|
|
99
|
-
2. **Listen for State Updates**: Subscribe to capture volume state changes to update the UI in real time.
|
|
100
|
-
|
|
101
|
-
#### Code Example
|
|
102
|
-
``` java
|
|
103
|
-
import kotlinx.coroutines.CoroutineScope
|
|
104
|
-
import kotlinx.coroutines.Dispatchers
|
|
105
|
-
import kotlinx.coroutines.launch
|
|
106
|
-
import io.trtc.tuikit.atomicxcore.api.device.DeviceStore
|
|
107
|
-
|
|
108
|
-
// 1. Adjust microphone volume
|
|
109
|
-
deviceStore.setCaptureVolume(80)
|
|
110
|
-
|
|
111
|
-
// 2. Listen for volume changes
|
|
112
|
-
CoroutineScope(Dispatchers.Main).launch {
|
|
113
|
-
deviceStore.deviceState.captureVolume.collect {
|
|
114
|
-
print("Capture volume: $it")
|
|
115
|
-
// Update UI with the value
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### setCaptureVolume Parameters
|
|
121
|
-
| <strong>Parameter Name</strong> | <strong>Type</strong> | <strong>Description</strong> |
|
|
122
|
-
| --- | --- | --- |
|
|
123
|
-
| <code>volume</code> | <code>Int</code> | Microphone (capture) volume.<br>- Range: [0, 150]<br>- Default: 100 |
|
|
124
|
-
|
|
125
|
-
### Step 5: Implement Voice Effects
|
|
126
|
-
|
|
127
|
-
To apply a voice effect, call `setAudioChangerType(type)` with the desired `AudioChangerType` enum value.
|
|
128
|
-
|
|
129
|
-
#### Code Example
|
|
130
|
-
``` java
|
|
131
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
132
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioChangerType
|
|
133
|
-
|
|
134
|
-
// Set voice effect to "Little Girl"
|
|
135
|
-
audioEffectStore.setAudioChangerType(AudioChangerType.LITTLE_GIRL)
|
|
136
|
-
|
|
137
|
-
// Disable voice effect
|
|
138
|
-
audioEffectStore.setAudioChangerType(AudioChangerType.NONE)
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
#### setAudioChangerType Parameters
|
|
142
|
-
|
|
143
|
-
|**Parameter Name**|**Type**|**Description**|
|
|
144
|
-
|---------|---------|---------|
|
|
145
|
-
|`type`|`AudioChangerType`|Voice effect enum value.|
|
|
146
|
-
|
|
147
|
-
### Step 6: Implement Reverb Effects
|
|
148
|
-
|
|
149
|
-
To apply a reverb effect, call `setAudioReverbType(type)` with the desired `AudioReverbType` enum value.
|
|
150
|
-
``` java
|
|
151
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
152
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioReverbType
|
|
153
|
-
|
|
154
|
-
// Set reverb to "KTV"
|
|
155
|
-
audioEffectStore.setAudioReverbType(AudioReverbType.KTV)
|
|
156
|
-
|
|
157
|
-
// Disable reverb
|
|
158
|
-
audioEffectStore.setAudioReverbType(AudioReverbType.NONE)
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
#### setAudioReverbType Parameters
|
|
162
|
-
|
|
163
|
-
|**Parameter Name**|**Type**|**Description**|
|
|
164
|
-
|---------|---------|---------|
|
|
165
|
-
|`type`|`AudioReverbType`|Reverb effect enum value.|
|
|
166
|
-
|
|
167
|
-
### Step 7: Reset Audio Effect Settings
|
|
168
|
-
|
|
169
|
-
> **Note:**
|
|
170
|
-
>
|
|
171
|
-
|
|
172
|
-
> `AudioEffectStore` and `DeviceStore` are singletons, so audio effect and device settings are globally applied. To prevent settings from one live room affecting others, reset audio effect and device settings when the current live room ends.
|
|
173
|
-
>
|
|
174
|
-
|
|
175
|
-
Reset audio effect settings in the following scenarios:
|
|
176
|
-
1. When the current live room ends.
|
|
177
|
-
|
|
178
|
-
2. To provide a "one-click restore" feature, call the`reset()`() method on each store.
|
|
179
|
-
|
|
180
|
-
``` java
|
|
181
|
-
import io.trtc.tuikit.atomicxcore.api.device.AudioEffectStore
|
|
182
|
-
import io.trtc.tuikit.atomicxcore.api.device.DeviceStore
|
|
183
|
-
|
|
184
|
-
// One-click reset for all voice and reverb effects
|
|
185
|
-
AudioEffectStore.shared().reset()
|
|
186
|
-
DeviceStore.shared().reset()
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## API Documentation
|
|
190
|
-
|
|
191
|
-
For detailed information on all public interfaces and properties of [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), and their related classes, refer to the official API documentation for the [AtomicXCore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore) framework.
|
|
192
|
-
|
|
193
|
-
|**Store/Component**|**Feature Description**|**API Documentation**|
|
|
194
|
-
|---------|---------|---------|
|
|
195
|
-
|AudioEffectStore|Manage audio effects: configure and retrieve real-time audio effect status.|[API Documentation](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)|
|
|
196
|
-
|DeviceStore|Manage devices: control camera and microphone, and retrieve real-time device status.|[API Documentation](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)|
|
|
197
|
-
|
|
198
|
-
## FAQs
|
|
199
|
-
|
|
200
|
-
### Are there any restrictions on when to call audio effect and device APIs?
|
|
201
|
-
|
|
202
|
-
No. `AudioEffectStore` and `DeviceStore` settings are globally effective. You can call relevant APIs (such as setting voice effects, reverb, or ear monitoring) at any time before or after entering a live room. Settings take effect immediately and persist.
|
|
203
|
-
|
|
204
|
-
### What is the difference between "Microphone Volume" and "Ear Monitor Volume"?
|
|
205
|
-
|
|
206
|
-
This is a common point of confusion:
|
|
207
|
-
- **Microphone Volume (Capture Volume)**: Set via `DeviceStore.setCaptureVolume()`. Controls the volume your audience hears.
|
|
208
|
-
|
|
209
|
-
- **Ear Monitor Volume**: Set via `AudioEffectStore.setVoiceEarMonitorVolume()`. It only determines the volume level you hear in your in-ear monitor and does not affect the audience.
|
|
210
|
-
|
|
211
|
-
### Why does a newly created live room already have audio effects, or why is the volume too high or too low?
|
|
212
|
-
|
|
213
|
-
Because `AudioEffectStore` and `DeviceStore` are singletons, audio effect and device settings are globally applied. If you previously set audio effects and did not reset them, those settings persist. Call the `reset()` method at the appropriate time to clear them.
|
|
214
|
-
|
|
215
|
-
### Why can't I hear my own voice after enabling "Ear Monitoring"?
|
|
216
|
-
|
|
217
|
-
Check the following:
|
|
218
|
-
1. **Are headphones connected?** Ear monitoring generally requires headphones. Ensure wired or Bluetooth headphones are connected.
|
|
219
|
-
|
|
220
|
-
2. **Is the ear monitor volume set to 0?** Check that the ear monitor volume is above 0.
|
|
221
|
-
|
|
222
|
-
3. **Is the microphone enabled?** Confirm that the microphone is enabled in DeviceStore (i.e., openLocalMicrophone has been called).
|
|
223
|
-
|
|
224
|
-
### Can voice effects and reverb be enabled at the same time?
|
|
225
|
-
|
|
226
|
-
Yes. `AudioChangerType` and `AudioReverbType` can be enabled simultaneously. For example, you can set both `AudioChangerType.LITTLE_GIRL`and `AudioReverbType.KTV` at the same time.
|
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
`LiveListStore` is the core module of **AtomicXCore** responsible for managing the live room list, creating and joining rooms, and maintaining room state. With LiveListStore, you can implement comprehensive live streaming lifecycle management in your application.
|
|
2
|
-
|
|
3
|
-
## Core Features
|
|
4
|
-
- **Live Room List Fetching**: Retrieve a paginated list of all currently public live rooms.
|
|
5
|
-
|
|
6
|
-
- **Live Lifecycle Management**: Provides a complete set of interfaces for the entire live streaming workflow, including room creation, going live, joining, leaving, and ending a live session.
|
|
7
|
-
|
|
8
|
-
- **Real-Time Event Listening**: Listen for key events such as live session end or users being removed from a room.
|
|
9
|
-
|
|
10
|
-
## Core Concepts
|
|
11
|
-
|
|
12
|
-
|**Core Concept**|**Type**|**Core Responsibility & Description**|
|
|
13
|
-
|---------|---------|---------|
|
|
14
|
-
|`LiveInfo`|`data class`|Represents the complete information model of a live room. Includes the live room ID (liveID), name (liveName), owner information (liveOwner), and custom metadata (metaData), among other properties.|
|
|
15
|
-
|`LiveListState`|`data class`|Represents the current state of the live list module. The core property liveList is a StateFlow containing the fetched live room list; currentLive represents the information of the live room the user is currently in.|
|
|
16
|
-
|`LiveListListener`|`abstract class`|Handles global live room events, including onLiveEnded (live ended) and onKickedOutOfLive (user removed from live), for responding to key room state changes.|
|
|
17
|
-
|`LiveListStore`|`abstract class`|The core management class for interacting with the live room list and room lifecycle. It is a global singleton responsible for all operations such as creating, joining, and updating live room information.|
|
|
18
|
-
|
|
19
|
-
## Implementation
|
|
20
|
-
|
|
21
|
-
### Step 1: Component Integration
|
|
22
|
-
- **Video Live Streaming**:Refer to Quick Start to integrate AtomicXCore and complete the implementation of the Host Video Streaming and Audience Join and Watch features.
|
|
23
|
-
|
|
24
|
-
- **Voice Chat Room**:Refer to Quick Start to integrate AtomicXCore and complete the implementation of the Host Audio Streaming and Audience Join and Watch features.
|
|
25
|
-
|
|
26
|
-
### Step 2: Implement Audience Entry from Live Room List
|
|
27
|
-
|
|
28
|
-
Create a page to display the live room list using RecyclerView to layout live room cards. When a user taps a card, retrieve the liveId for that room and navigate to the audience viewing page.
|
|
29
|
-
``` kotlin
|
|
30
|
-
import android.content.Intent
|
|
31
|
-
import android.os.Bundle
|
|
32
|
-
import android.view.LayoutInflater
|
|
33
|
-
import android.view.View
|
|
34
|
-
import android.view.ViewGroup
|
|
35
|
-
import androidx.appcompat.app.AppCompatActivity
|
|
36
|
-
import androidx.recyclerview.widget.GridLayoutManager
|
|
37
|
-
import androidx.recyclerview.widget.RecyclerView
|
|
38
|
-
import io.trtc.tuikit.atomicxcore.api.CompletionHandler
|
|
39
|
-
import io.trtc.tuikit.atomicxcore.api.live.LiveInfo
|
|
40
|
-
import io.trtc.tuikit.atomicxcore.api.live.LiveListStore
|
|
41
|
-
import kotlinx.coroutines.*
|
|
42
|
-
import kotlinx.coroutines.flow.*
|
|
43
|
-
|
|
44
|
-
class LiveListActivity : AppCompatActivity() {
|
|
45
|
-
private val liveListStore = LiveListStore.shared()
|
|
46
|
-
private var liveList: List<LiveInfo> = emptyList()
|
|
47
|
-
private val coroutineScope = CoroutineScope(Dispatchers.Main)
|
|
48
|
-
|
|
49
|
-
private lateinit var recyclerView: RecyclerView
|
|
50
|
-
private lateinit var adapter: LiveListAdapter
|
|
51
|
-
|
|
52
|
-
override fun onCreate(savedInstanceState: Bundle?) {
|
|
53
|
-
super.onCreate(savedInstanceState)
|
|
54
|
-
setContentView(R.layout.activity_live_list)
|
|
55
|
-
setupUI()
|
|
56
|
-
bindStore()
|
|
57
|
-
fetchLiveList()
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
private fun bindStore() {
|
|
61
|
-
// Subscribe to the state to automatically receive list updates
|
|
62
|
-
coroutineScope.launch {
|
|
63
|
-
liveListStore.liveState.liveList.collect { fetchedList ->
|
|
64
|
-
liveList = fetchedList
|
|
65
|
-
adapter.notifyDataSetChanged()
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
private fun fetchLiveList() {
|
|
71
|
-
liveListStore.fetchLiveList(
|
|
72
|
-
cursor = "",
|
|
73
|
-
count = 20,
|
|
74
|
-
completion = object : CompletionHandler {
|
|
75
|
-
override fun onSuccess() {
|
|
76
|
-
println("Live room list fetched successfully")
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
override fun onFailure(code: Int, desc: String) {
|
|
80
|
-
println("Failed to fetch live room list: $desc")
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// When a user clicks an item in the list
|
|
87
|
-
private fun onLiveItemClick(liveInfo: LiveInfo) {
|
|
88
|
-
// Create the audience viewing page and pass the liveId
|
|
89
|
-
val intent = Intent(this, YourAudienceActivity::class.java)
|
|
90
|
-
intent.putExtra("liveId", liveInfo.liveID)
|
|
91
|
-
startActivity(intent)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// --- RecyclerView related methods ---
|
|
95
|
-
private fun setupUI() {
|
|
96
|
-
recyclerView = findViewById(R.id.recyclerView)
|
|
97
|
-
adapter = LiveListAdapter(liveList) { liveInfo ->
|
|
98
|
-
onLiveItemClick(liveInfo)
|
|
99
|
-
}
|
|
100
|
-
recyclerView.layoutManager = GridLayoutManager(this, 2)
|
|
101
|
-
recyclerView.adapter = adapter
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
override fun onDestroy() {
|
|
105
|
-
super.onDestroy()
|
|
106
|
-
coroutineScope.cancel()
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// RecyclerView Adapter
|
|
111
|
-
class LiveListAdapter(
|
|
112
|
-
private var liveList: List<LiveInfo>,
|
|
113
|
-
private val onItemClick: (LiveInfo) -> Unit
|
|
114
|
-
) : RecyclerView.Adapter<LiveListAdapter.LiveViewHolder>() {
|
|
115
|
-
|
|
116
|
-
class LiveViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
|
117
|
-
// Define your ViewHolder view components
|
|
118
|
-
// val titleTextView: TextView = itemView.findViewById(R.id.titleTextView)
|
|
119
|
-
// val coverImageView: ImageView = itemView.findViewById(R.id.coverImageView)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LiveViewHolder {
|
|
123
|
-
val view = LayoutInflater.from(parent.context)
|
|
124
|
-
.inflate(R.layout.item_live_card, parent, false)
|
|
125
|
-
return LiveViewHolder(view)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
override fun onBindViewHolder(holder: LiveViewHolder, position: Int) {
|
|
129
|
-
val liveInfo = liveList[position]
|
|
130
|
-
// Set data to ViewHolder
|
|
131
|
-
// holder.titleTextView.text = liveInfo.liveName
|
|
132
|
-
// Load cover image, etc.
|
|
133
|
-
|
|
134
|
-
holder.itemView.setOnClickListener {
|
|
135
|
-
onItemClick(liveInfo)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
override fun getItemCount(): Int = liveList.size
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
#### LiveInfo Parameter Reference
|
|
144
|
-
|
|
145
|
-
|**Parameter Name**|**Type**|**Description**|
|
|
146
|
-
|---------|---------|---------|
|
|
147
|
-
|`liveID`|`String`|Unique identifier for the live room|
|
|
148
|
-
|`liveName`|`String`|Title of the live room|
|
|
149
|
-
|`coverURL`|`String`|Cover image URL for the live room|
|
|
150
|
-
|`liveOwner`|[LiveUserInfo](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.live/-live-user-info/index.html)|Personal information of the room owner|
|
|
151
|
-
|`totalViewerCount`|`Int`|Total number of viewers in the live room|
|
|
152
|
-
|`categoryList`|`List<Int>`|List of category tags for the live room|
|
|
153
|
-
|`notice`|`String`|Announcement information for the live room|
|
|
154
|
-
|`metaData`|`Map<String, String>`|Developer-defined metadata for implementing advanced business scenarios|
|
|
155
|
-
|
|
156
|
-
## Advanced Features
|
|
157
|
-
|
|
158
|
-
### Scenario 1: Category Filtering for Live Room List
|
|
159
|
-
|
|
160
|
-
On the live plaza page, users can select category tags such as "Hot", "Music", "Games", etc. When a tag is selected, the live room list dynamically filters to display only rooms in the chosen category, helping users quickly discover relevant content.
|
|
161
|
-
|
|
162
|
-
#### Implementation
|
|
163
|
-
|
|
164
|
-
Use the `categoryList` property in the `LiveInfo` model. When the host selects a category while going live, the `fetchLiveList` API returns LiveInfo objects that include these category details. After retrieving the full live room list, filter it on the client based on the user’s selected category and refresh the UI.
|
|
165
|
-
|
|
166
|
-
#### Code Example
|
|
167
|
-
|
|
168
|
-
The following example shows how to extend a `LiveListManager` within `LiveListActivity` to handle data retrieval and filtering logic.
|
|
169
|
-
``` kotlin
|
|
170
|
-
import android.os.Bundle
|
|
171
|
-
import androidx.appcompat.app.AppCompatActivity
|
|
172
|
-
import androidx.recyclerview.widget.RecyclerView
|
|
173
|
-
import io.trtc.tuikit.atomicxcore.api.live.LiveInfo
|
|
174
|
-
import io.trtc.tuikit.atomicxcore.api.live.LiveListStore
|
|
175
|
-
import kotlinx.coroutines.*
|
|
176
|
-
import kotlinx.coroutines.flow.*
|
|
177
|
-
|
|
178
|
-
// 1. Create a data manager to encapsulate data retrieval and filtering logic
|
|
179
|
-
class LiveListManager {
|
|
180
|
-
private val liveListStore = LiveListStore.shared()
|
|
181
|
-
private var fullLiveList: List<LiveInfo> = emptyList()
|
|
182
|
-
|
|
183
|
-
// Expose the final filtered live list externally
|
|
184
|
-
private val _filteredLiveList = MutableStateFlow<List<LiveInfo>>(emptyList())
|
|
185
|
-
val filteredLiveList: StateFlow<List<LiveInfo>> = _filteredLiveList
|
|
186
|
-
|
|
187
|
-
init {
|
|
188
|
-
// Listen for full list changes
|
|
189
|
-
CoroutineScope(Dispatchers.Main).launch {
|
|
190
|
-
liveListStore.liveState.liveList.collect { fetchedList ->
|
|
191
|
-
fullLiveList = fetchedList
|
|
192
|
-
// By default, publish the complete list
|
|
193
|
-
_filteredLiveList.value = fetchedList
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
fun fetchFirstPage() {
|
|
199
|
-
liveListStore.fetchLiveList(cursor = "", count = 20, completion = null)
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/// Filter the live list by category
|
|
203
|
-
fun filterLiveList(categoryId: Int?) {
|
|
204
|
-
if (categoryId == null) {
|
|
205
|
-
// If categoryId is null, show the complete list
|
|
206
|
-
_filteredLiveList.value = fullLiveList
|
|
207
|
-
return
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
val filteredList = fullLiveList.filter { liveInfo ->
|
|
211
|
-
liveInfo.categoryList.contains(categoryId)
|
|
212
|
-
}
|
|
213
|
-
_filteredLiveList.value = filteredList
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// 2. Use the Manager in your LiveListActivity
|
|
218
|
-
class LiveListActivity : AppCompatActivity() {
|
|
219
|
-
private val manager = LiveListManager()
|
|
220
|
-
private lateinit var recyclerView: RecyclerView
|
|
221
|
-
|
|
222
|
-
override fun onCreate(savedInstanceState: Bundle?) {
|
|
223
|
-
super.onCreate(savedInstanceState)
|
|
224
|
-
setContentView(R.layout.activity_live_list)
|
|
225
|
-
// setupUI()
|
|
226
|
-
|
|
227
|
-
// Bind data
|
|
228
|
-
CoroutineScope(Dispatchers.Main).launch {
|
|
229
|
-
manager.filteredLiveList.collect { filteredList ->
|
|
230
|
-
// Refresh UI
|
|
231
|
-
// adapter.updateList(filteredList)
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Fetch first page
|
|
236
|
-
manager.fetchFirstPage()
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// When the user clicks a top category tag
|
|
240
|
-
fun onCategorySelected(categoryId: Int) {
|
|
241
|
-
manager.filterLiveList(categoryId)
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// ... (RecyclerView related code)
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Scenario 2: Swipe-to-Play for Live Room List
|
|
249
|
-
|
|
250
|
-
Users can switch between live rooms by swiping up and down. When a new live room is centered on the screen, the video preview automatically starts playing. When it leaves the screen, playback stops automatically to save bandwidth and device resources.
|
|
251
|
-
|
|
252
|
-
> **Note:**
|
|
253
|
-
>
|
|
254
|
-
|
|
255
|
-
> **Swipe-to-Play **is currently only supported for Video Live Streaming.
|
|
256
|
-
>
|
|
257
|
-
|
|
258
|
-
#### Interaction Flow
|
|
259
|
-
|
|
260
|
-
#### Implementation
|
|
261
|
-
|
|
262
|
-
`LiveCoreView` supports multiple instances. Create a separate `LiveCoreView` for each `RecyclerView.ViewHolder`. By monitoring the scroll state of the `RecyclerView`, you can precisely control when to start or stop streaming in each ViewHolder, achieving "play on swipe in, stop on swipe out" behavior.
|
|
263
|
-
|
|
264
|
-
#### Code Example
|
|
265
|
-
|
|
266
|
-
We create a custom `LiveFeedViewHolder` that holds a `LiveCoreView` internally. We then manage the playback state of these ViewHolders in the `Activity`.
|
|
267
|
-
``` kotlin
|
|
268
|
-
import android.os.Bundle
|
|
269
|
-
import android.view.LayoutInflater
|
|
270
|
-
import android.view.View
|
|
271
|
-
import android.view.ViewGroup
|
|
272
|
-
import androidx.appcompat.app.AppCompatActivity
|
|
273
|
-
import androidx.recyclerview.widget.LinearLayoutManager
|
|
274
|
-
import androidx.recyclerview.widget.RecyclerView
|
|
275
|
-
import io.trtc.tuikit.atomicxcore.api.live.LiveInfo
|
|
276
|
-
import io.trtc.tuikit.atomicxcore.api.view.CoreViewType
|
|
277
|
-
import io.trtc.tuikit.atomicxcore.api.view.LiveCoreView
|
|
278
|
-
|
|
279
|
-
// 1. Custom RecyclerView.ViewHolder, containing a LiveCoreView internally
|
|
280
|
-
class LiveFeedViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
|
281
|
-
private var liveCoreView: LiveCoreView? = null
|
|
282
|
-
|
|
283
|
-
fun setLiveInfo(liveInfo: LiveInfo) {
|
|
284
|
-
// Create a new LiveCoreView for the new live info
|
|
285
|
-
liveCoreView = LiveCoreView(itemView.context, viewType = CoreViewType.PLAY_VIEW)
|
|
286
|
-
liveCoreView?.let { view ->
|
|
287
|
-
(itemView as ViewGroup).addView(view)
|
|
288
|
-
view.layoutParams = ViewGroup.LayoutParams(
|
|
289
|
-
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
290
|
-
ViewGroup.LayoutParams.MATCH_PARENT
|
|
291
|
-
)
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
fun startPlay(roomId: String) {
|
|
296
|
-
liveCoreView?.startPreviewLiveStream(roomId, false, callback = null)
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
fun stopPlay(roomId: String) {
|
|
300
|
-
liveCoreView?.stopPreviewLiveStream(roomId)
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// 2. Manage playback logic in the Activity
|
|
305
|
-
class LiveFeedActivity : AppCompatActivity() {
|
|
306
|
-
|
|
307
|
-
private lateinit var recyclerView: RecyclerView
|
|
308
|
-
private var liveList: List<LiveInfo> = emptyList()
|
|
309
|
-
private var currentPlayingPosition: Int = -1
|
|
310
|
-
|
|
311
|
-
override fun onCreate(savedInstanceState: Bundle?) {
|
|
312
|
-
super.onCreate(savedInstanceState)
|
|
313
|
-
setContentView(R.layout.activity_live_feed)
|
|
314
|
-
setupRecyclerView()
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
private fun setupRecyclerView() {
|
|
318
|
-
recyclerView = findViewById(R.id.recyclerView)
|
|
319
|
-
recyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
|
320
|
-
recyclerView.adapter = LiveFeedAdapter(liveList) { position ->
|
|
321
|
-
playVideoAtPosition(position)
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Listen for scroll state
|
|
325
|
-
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
326
|
-
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
|
327
|
-
super.onScrollStateChanged(recyclerView, newState)
|
|
328
|
-
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
|
329
|
-
val layoutManager = recyclerView.layoutManager as LinearLayoutManager
|
|
330
|
-
val firstVisiblePosition = layoutManager.findFirstCompletelyVisibleItemPosition()
|
|
331
|
-
if (firstVisiblePosition != RecyclerView.NO_POSITION) {
|
|
332
|
-
playVideoAtPosition(firstVisiblePosition)
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
})
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
private fun playVideoAtPosition(position: Int) {
|
|
340
|
-
// Only switch playback when the centered position changes
|
|
341
|
-
if (currentPlayingPosition != position) {
|
|
342
|
-
// Stop current playback
|
|
343
|
-
if (currentPlayingPosition != -1) {
|
|
344
|
-
val currentViewHolder = recyclerView.findViewHolderForAdapterPosition(currentPlayingPosition)
|
|
345
|
-
if (currentViewHolder is LiveFeedViewHolder) {
|
|
346
|
-
val liveInfo = liveList[currentPlayingPosition]
|
|
347
|
-
currentViewHolder.stopPlay(liveInfo.liveID)
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Start new playback
|
|
352
|
-
val newViewHolder = recyclerView.findViewHolderForAdapterPosition(position)
|
|
353
|
-
if (newViewHolder is LiveFeedViewHolder) {
|
|
354
|
-
val liveInfo = liveList[position]
|
|
355
|
-
newViewHolder.startPlay(liveInfo.liveID)
|
|
356
|
-
currentPlayingPosition = position
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// RecyclerView Adapter
|
|
362
|
-
inner class LiveFeedAdapter(
|
|
363
|
-
private var liveList: List<LiveInfo>,
|
|
364
|
-
private val onItemClick: (Int) -> Unit
|
|
365
|
-
) : RecyclerView.Adapter<LiveFeedViewHolder>() {
|
|
366
|
-
|
|
367
|
-
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LiveFeedViewHolder {
|
|
368
|
-
val view = LayoutInflater.from(parent.context)
|
|
369
|
-
.inflate(R.layout.item_live_feed, parent, false)
|
|
370
|
-
return LiveFeedViewHolder(view)
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
override fun onBindViewHolder(holder: LiveFeedViewHolder, position: Int) {
|
|
374
|
-
val liveInfo = liveList[position]
|
|
375
|
-
holder.setLiveInfo(liveInfo)
|
|
376
|
-
holder.itemView.setOnClickListener {
|
|
377
|
-
onItemClick(position)
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
override fun getItemCount(): Int = liveList.size
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
## API Documentation
|
|
387
|
-
|
|
388
|
-
For detailed information on all public interfaces, properties, and methods of [LiveListStore](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.live/-live-list-store/index.html) and related classes, refer to the official API documentation included with the [AtomicXCore](https://tencent-rtc.github.io/TUIKit_Android/index.html) framework. The relevant Stores used in this document are as follows:
|
|
389
|
-
|
|
390
|
-
|**Store/Component**|**Feature Description**|**API Documentation**|
|
|
391
|
-
|---------|---------|---------|
|
|
392
|
-
|LiveCoreView|Core view component for live video stream display and interaction. Responsible for video stream rendering and view widget handling, supporting scenarios such as host streaming, audience co-hosting, and host linking.|[API Documentation](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.view/-live-core-view/index.html)|
|
|
393
|
-
|LiveListStore|Full lifecycle management of live rooms: create, join, leave, destroy rooms; query room list; modify live information (name, announcement, etc.); listen to live status (such as being removed or ended).|[API Documentation](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.live/-live-list-store/index.html)|
|
|
394
|
-
|
|
395
|
-
## FAQs
|
|
396
|
-
|
|
397
|
-
### Is the list data for voice chat rooms and video live rooms the same?
|
|
398
|
-
|
|
399
|
-
Yes. The data is unified; you do not need to fetch them separately. LiveListStore is a global singleton that manages the lifecycle of all "live" rooms in your application, including both video live rooms and voice chat rooms.
|
|
400
|
-
|
|
401
|
-
### How do I distinguish between voice chat rooms and video live rooms in the live room list?
|
|
402
|
-
|
|
403
|
-
`LiveListStore` does not differentiate between room business types. You must filter and categorize the list after fetching, at the application or UI layer.
|
|
404
|
-
|
|
405
|
-
We recommend two approaches:
|
|
406
|
-
|
|
407
|
-
**Approach 1 (Recommended): Use seatLayoutTemplateID for differentiation.**
|
|
408
|
-
|
|
409
|
-
This template ID defines the room layout. For supported template IDs and effects, refer to Run And Test.
|
|
410
|
-
- **Step 1: Specify ID when creating a room**
|
|
411
|
-
|
|
412
|
-
- When calling `LiveListStore.shared.createLive`, set the `seatLayoutTemplateID` property of `LiveInfo` based on your business scenario:
|
|
413
|
-
|
|
414
|
-
- Voice chat rooms: Use template IDs in the range 1–199.
|
|
415
|
-
|
|
416
|
-
- Video live rooms: Use template IDs in the range 200–999.
|
|
417
|
-
|
|
418
|
-
- **Step 2: Filter when fetching the list**
|
|
419
|
-
|
|
420
|
-
- On the client side, after receiving the list in `LiveListStore.state.liveList`, determine the business scenario by checking the template ID range.
|
|
421
|
-
|
|
422
|
-
> **Note:**
|
|
423
|
-
>
|
|
424
|
-
|
|
425
|
-
> If the seatLayoutTemplateID does not match your business scenario (voice chat room or video live room), seat layout features may not work as expected.
|
|
426
|
-
>
|
|
427
|
-
|
|
428
|
-
**Approach 2:****Add a business prefix to **`liveID`**.**
|
|
429
|
-
|
|
430
|
-
This is an optional, application-layer convention to help you filter rooms quickly.
|
|
431
|
-
|
|
432
|
-
- **Step 1: Add prefix when creating a room**
|
|
433
|
-
|
|
434
|
-
- When generating liveID and calling createLive, assign different prefixes for each business type. For example: video live room IDs start with "Live_" (e.g., Live_12345), voice chat room IDs start with "voice_" (e.g., voice_67890).
|
|
435
|
-
|
|
436
|
-
- **Step 2: Check prefix when fetching the list**
|
|
437
|
-
|
|
438
|
-
- On the client side, after fetching the list, distinguish rooms by checking the liveID prefix.
|