@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
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
UILiveKit's host streaming page offers a comprehensive, ready-to-use interface for live streaming scenarios. It enables rapid integration of essential features for hosts to start streaming, allowing you to efficiently build your live streaming workflow without the complexity of custom UI or business logic.
|
|
2
|
+
|
|
3
|
+
> **Note:**
|
|
4
|
+
>
|
|
5
|
+
> This guide covers the host start process using UI components (including a complete interactive UI). If you prefer to build your own host interface with the Core SDK, see Host Start (Core SDK).
|
|
6
|
+
>
|
|
7
|
+
|
|
8
|
+
## Feature Overview
|
|
9
|
+
- **Pre-Stream Preview:** Configure room name, background, video preview, beauty effects, audio effects, layout templates, and more before going live.
|
|
10
|
+
|
|
11
|
+
- **Co-hosting Interaction:** Engage in real-time with audience members or other hosts across different live rooms during the stream.
|
|
12
|
+
|
|
13
|
+
- **Audience Interaction:** Includes rich engagement features such as live comments and gift support.
|
|
14
|
+
|
|
15
|
+
- **Live Room Management:** View the online user list and manage participants with actions like muting or removing users from the live room.
|
|
16
|
+
|
|
17
|
+
|**Pre-stream Setup**|**Co-Host Interaction**|**Audience Interaction**|**Live Room Management**|
|
|
18
|
+
|---------|---------|---------|---------|
|
|
19
|
+
||||<br>|
|
|
20
|
+
|
|
21
|
+
## Quick Integration
|
|
22
|
+
|
|
23
|
+
### Step 1. Activate the Service
|
|
24
|
+
|
|
25
|
+
Refer to the Activate Service document to enable the **trial version** or activate the **Pro Edition** package.
|
|
26
|
+
|
|
27
|
+
### Step 2. Integrate the SDK
|
|
28
|
+
|
|
29
|
+
Refer to Preparations guide to integrate the `TUILiveKit` SDK.
|
|
30
|
+
|
|
31
|
+
### Step 3. Add the Pre-stream Preparation Page
|
|
32
|
+
|
|
33
|
+
The `AnchorPrepareView` component includes camera preview, audio effect settings, layout configuration, and other built-in features. Create and load the host streaming preparation view as shown below:
|
|
34
|
+
|
|
35
|
+
【Swift】
|
|
36
|
+
``` swift
|
|
37
|
+
import UIKit
|
|
38
|
+
import Snapkit
|
|
39
|
+
import TUILiveKit
|
|
40
|
+
import AtomicXCore
|
|
41
|
+
|
|
42
|
+
// YourAnchorPrepareViewController represents the view controller for loading the host start page
|
|
43
|
+
class YourAnchorPrepareViewController: UIViewController {
|
|
44
|
+
private let roomId = "testLiveId"
|
|
45
|
+
|
|
46
|
+
// Lazy load AnchorPrepareView
|
|
47
|
+
private lazy var prepareView: AnchorPrepareView = {
|
|
48
|
+
// Pass roomId when initializing AnchorPrepareView
|
|
49
|
+
let view = AnchorPrepareView(roomId: roomId)
|
|
50
|
+
return view
|
|
51
|
+
}()
|
|
52
|
+
|
|
53
|
+
public override func viewDidLoad() {
|
|
54
|
+
super.viewDidLoad()
|
|
55
|
+
// Add prepareView to the view
|
|
56
|
+
view.addSubview(prepareView)
|
|
57
|
+
prepareView.snp.makeConstraints { make in
|
|
58
|
+
make.edges.equalToSuperview()
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Step 4. Add the Host Streaming Page
|
|
65
|
+
|
|
66
|
+
The `AnchorView` component brings together audio/video streaming, audience co-hosting, interactive features, and live room management. Simply create and load `AnchorView` as shown below:
|
|
67
|
+
|
|
68
|
+
【Swift】
|
|
69
|
+
``` swift
|
|
70
|
+
import UIKit
|
|
71
|
+
import Snapkit
|
|
72
|
+
import TUILiveKit
|
|
73
|
+
import AtomicXCore
|
|
74
|
+
|
|
75
|
+
// YourAnchorPrepareViewController represents the view controller for loading the host start page
|
|
76
|
+
class YourAnchorViewController: UIViewController {
|
|
77
|
+
// Core view component
|
|
78
|
+
private let coreView: LiveCoreView
|
|
79
|
+
|
|
80
|
+
// Declare anchorView instance
|
|
81
|
+
private let anchorView: AnchorView
|
|
82
|
+
|
|
83
|
+
public init(liveInfo: LiveInfo, coreView: LiveCoreView? = nil, behavior: RoomBehavior = .createRoom) {
|
|
84
|
+
if let coreView = coreView {
|
|
85
|
+
self.coreView = coreView
|
|
86
|
+
} else {
|
|
87
|
+
self.coreView = LiveCoreView(viewType: .pushView)
|
|
88
|
+
}
|
|
89
|
+
// Instantiate the host start page
|
|
90
|
+
self.anchorView = AnchorView(liveInfo: liveInfo, coreView: self.coreView, behavior: behavior)
|
|
91
|
+
super.init(nibName: nil, bundle: nil)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
required init?(coder: NSCoder) {
|
|
95
|
+
fatalError("init(coder:) has not been implemented")
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public override func viewDidLoad() {
|
|
99
|
+
super.viewDidLoad()
|
|
100
|
+
// Add anchorView to the view
|
|
101
|
+
view.addSubview(anchorView)
|
|
102
|
+
anchorView.snp.makeConstraints { make in
|
|
103
|
+
make.edges.equalToSuperview()
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Step 5. Event Callback Customization
|
|
110
|
+
|
|
111
|
+
AnchorView supports a delegate (AnchorViewDelegate) for listening to core lifecycle events such as successful live start, stream end with statistics, floating window clicks, and more. Set the delegate after creating AnchorView in Step 4:
|
|
112
|
+
|
|
113
|
+
|Method|Description|
|
|
114
|
+
|---------|---------|
|
|
115
|
+
|func onStartLiving()|Called when the host has successfully started streaming (room created/joined, streaming started).|
|
|
116
|
+
|func onEndLiving(state: AnchorState)|Called when the host ends the stream. state includes live statistics: totalDuration (duration), totalViewers(audience count), totalMessageSent (live comments), totalGiftCoins (gift revenue), totalGiftUniqueSenders (gifters), totalLikesReceived (likes), liveEndedReason (end reason)—useful for displaying the live summary page.|
|
|
117
|
+
|func onClickFloatWindow()|Called when the user clicks the floating window.|
|
|
118
|
+
|
|
119
|
+
``` swift
|
|
120
|
+
import UIKit
|
|
121
|
+
import Snapkit
|
|
122
|
+
import TUILiveKit
|
|
123
|
+
import AtomicXCore
|
|
124
|
+
|
|
125
|
+
// YourAnchorViewController handles loading the host start streaming page
|
|
126
|
+
class YourAnchorViewController: UIViewController {
|
|
127
|
+
// Core view component
|
|
128
|
+
private let coreView: LiveCoreView
|
|
129
|
+
private let liveID: String
|
|
130
|
+
// AnchorView instance
|
|
131
|
+
private let anchorView: AnchorView
|
|
132
|
+
|
|
133
|
+
public init(liveInfo: LiveInfo, coreView: LiveCoreView? = nil, behavior: RoomBehavior = .createRoom) {
|
|
134
|
+
if let coreView = coreView {
|
|
135
|
+
self.coreView = coreView
|
|
136
|
+
} else {
|
|
137
|
+
self.coreView = LiveCoreView(viewType: .pushView)
|
|
138
|
+
}
|
|
139
|
+
self.liveID = liveInfo.liveID
|
|
140
|
+
// Initialize the host start streaming page
|
|
141
|
+
self.anchorView = AnchorView(liveInfo: liveInfo, coreView: self.coreView, behavior: behavior)
|
|
142
|
+
super.init(nibName: nil, bundle: nil)
|
|
143
|
+
// Set delegate to listen for host page events
|
|
144
|
+
anchorView.delegate = self
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
required init?(coder: NSCoder) {
|
|
148
|
+
fatalError("init(coder:) has not been implemented")
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
public override func viewDidLoad() {
|
|
152
|
+
super.viewDidLoad()
|
|
153
|
+
// Add anchorView to the view
|
|
154
|
+
view.addSubview(anchorView)
|
|
155
|
+
anchorView.snp.makeConstraints { make in
|
|
156
|
+
make.edges.equalToSuperview()
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Implement AnchorViewDelegate callbacks
|
|
162
|
+
extension YourAnchorViewController: AnchorViewDelegate {
|
|
163
|
+
// Host has successfully started streaming
|
|
164
|
+
func onStartLiving() {
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Host ends the stream, display the SDK built-in live summary page
|
|
168
|
+
func onEndLiving(state: AnchorState) {
|
|
169
|
+
let endInfo = AnchorEndStatisticsViewInfo(roomId: liveID,
|
|
170
|
+
liveDuration: state.totalDuration,
|
|
171
|
+
viewCount: state.totalViewers,
|
|
172
|
+
messageCount: state.totalMessageSent,
|
|
173
|
+
giftTotalCoins: state.totalGiftCoins,
|
|
174
|
+
giftTotalUniqueSender: state.totalGiftUniqueSenders,
|
|
175
|
+
likeTotalUniqueSender: state.totalLikesReceived,
|
|
176
|
+
liveEndedReason: state.liveEndedReason)
|
|
177
|
+
let anchorEndView = AnchorEndStatisticsView(endViewInfo: endInfo)
|
|
178
|
+
anchorEndView.delegate = self
|
|
179
|
+
view.addSubview(anchorEndView)
|
|
180
|
+
anchorEndView.snp.makeConstraints { make in
|
|
181
|
+
make.edges.equalToSuperview()
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// User clicked the floating window
|
|
186
|
+
func onClickFloatWindow() {
|
|
187
|
+
FloatWindow.shared.showFloatWindow(controller: self, provider: self)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Implement FloatWindowProvider callbacks
|
|
192
|
+
extension YourAnchorViewController: FloatWindowProvider {
|
|
193
|
+
public func getRoomId() -> String {
|
|
194
|
+
liveID
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public func getOwnerId() -> String {
|
|
198
|
+
LiveListStore.shared.state.value.currentLive.liveOwner.userID
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public func getCoreView() -> AtomicXCore.LiveCoreView {
|
|
202
|
+
coreView
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
public func relayoutCoreView() {
|
|
206
|
+
anchorView.relayoutCoreView()
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
public func getIsLinking() -> Bool {
|
|
210
|
+
let connectedSeats = CoGuestStore.create(liveID: liveID).state.value.connected
|
|
211
|
+
let selfUserID = LoginStore.shared.state.value.loginUserInfo?.userID ?? ""
|
|
212
|
+
return connectedSeats.contains(where: { $0.userID == selfUserID })
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Step 6. Navigate from Preparation Page to Streaming Page
|
|
218
|
+
|
|
219
|
+
Implement the delegate methods for the `AnchorPrepareView` component, as described in Step 3, to handle navigation from the preparation page to the host streaming page. Example code:
|
|
220
|
+
|
|
221
|
+
【Swift】
|
|
222
|
+
``` swift
|
|
223
|
+
import UIKit
|
|
224
|
+
import TUILiveKit
|
|
225
|
+
import AtomicXCore
|
|
226
|
+
|
|
227
|
+
// Set delegate when initializing AnchorPrepareView
|
|
228
|
+
class YourAnchorPrepareViewController: UIViewController {
|
|
229
|
+
private lazy var prepareView: AnchorPrepareView = {
|
|
230
|
+
let view = AnchorPrepareView(roomId: roomId)
|
|
231
|
+
// Set delegate
|
|
232
|
+
view.delegate = self
|
|
233
|
+
return view
|
|
234
|
+
}()
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Implement AnchorPrepareViewDelegate callback
|
|
238
|
+
extension YourAnchorPrepareViewController : AnchorPrepareViewDelegate {
|
|
239
|
+
// Handle start button click event
|
|
240
|
+
// - state: PrepareState encapsulates camera, audio effects, and other settings for the host start page. You only need to configure as shown in the sample code below.
|
|
241
|
+
public func onClickStartButton(state: PrepareState) {
|
|
242
|
+
// Navigate to the host start page
|
|
243
|
+
// Initialize live stream information
|
|
244
|
+
var liveInfo = LiveInfo(seatTemplate: .videoDynamicGrid9Seats)
|
|
245
|
+
// If you used Server APIs to pre-create the room, fill in the RoomId returned by the server here.
|
|
246
|
+
liveInfo.liveID = roomId
|
|
247
|
+
liveInfo.liveName = state.roomName
|
|
248
|
+
liveInfo.coverURL = state.coverUrl
|
|
249
|
+
liveInfo.isPublicVisible = state.privacyMode == .public
|
|
250
|
+
liveInfo.backgroundURL = state.coverUrl
|
|
251
|
+
|
|
252
|
+
// Instantiate your host start view controller
|
|
253
|
+
let anchorVC = YourAnchorViewController(liveInfo: liveInfo, coreView: prepareView.getCoreView())
|
|
254
|
+
anchorVC.modalPresentationStyle = .fullScreen
|
|
255
|
+
|
|
256
|
+
// Destroy the preparation page when going live: do not stack the streaming page on top of the preparation page
|
|
257
|
+
guard let presenter = presentingViewController else {
|
|
258
|
+
present(anchorVC, animated: false)
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
presenter.dismiss(animated: false) {
|
|
262
|
+
presenter.present(anchorVC, animated: false)
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Handle back button click event
|
|
267
|
+
public func onClickBackButton() {
|
|
268
|
+
if let nav = navigationController {
|
|
269
|
+
nav.popViewController(animated: true)
|
|
270
|
+
} else {
|
|
271
|
+
dismiss(animated: true)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Customize Your UI Layout
|
|
278
|
+
|
|
279
|
+
TUILiveKit provides flexible options for customizing features and styles on both the preparation and streaming pages. You can adjust layouts or hide/show feature modules based on your business requirements.
|
|
280
|
+
|
|
281
|
+
### Select Live Stream Layout Templates
|
|
282
|
+
|
|
283
|
+
TUILiveKit includes **4 live stream layout templates**. Select your preferred style from the **"Layout"** option in the host preparation page UI:
|
|
284
|
+
|
|
285
|
+
#### Layout Template Overview
|
|
286
|
+
|
|
287
|
+
|**Layout**|**Dynamic Grid Layout**|**Floating Window Layout**|**Fixed Grid Layout**|**Fixed Floating Window Layout**|
|
|
288
|
+
|---------|---------|---------|---------|---------|
|
|
289
|
+
|**Template Value**|`.videoDynamicGrid9Seats`|`.videoDynamicFloat7Seats`|`.videoFixedGrid9Seats`|`.videoFixedFloat7Seats`|
|
|
290
|
+
|**Description**|Default layout. The grid size adjusts dynamically based on the number of co-hosts.|Co-hosts are shown in floating windows.|The number of co-hosts is fixed. Each guest occupies a dedicated grid cell.|The number of co-hosts is fixed. Guests appear in fixed floating windows.|
|
|
291
|
+
|**Preview**|||||
|
|
292
|
+
|
|
293
|
+
### Customize Preparation Page
|
|
294
|
+
|
|
295
|
+
Use the API on the `prepareView` created in Step 3 to hide the entire operation area or specific features on the preparation page.
|
|
296
|
+
|
|
297
|
+
【Swift】
|
|
298
|
+
``` swift
|
|
299
|
+
import UIKit
|
|
300
|
+
import Snapkit
|
|
301
|
+
import TUILiveKit
|
|
302
|
+
import AtomicXCore
|
|
303
|
+
|
|
304
|
+
// YourAnchorPrepareViewController represents the view controller for loading the host start page
|
|
305
|
+
class YourAnchorPrepareViewController: UIViewController {
|
|
306
|
+
private let roomId = "testLiveId"
|
|
307
|
+
private lazy var prepareView: AnchorPrepareView = {
|
|
308
|
+
let view = AnchorPrepareView(roomId: roomId)
|
|
309
|
+
view.delegate = self
|
|
310
|
+
return view
|
|
311
|
+
}()
|
|
312
|
+
|
|
313
|
+
public override func viewDidLoad() {
|
|
314
|
+
super.viewDidLoad()
|
|
315
|
+
// Add prepareView to the view
|
|
316
|
+
view.addSubview(prepareView)
|
|
317
|
+
prepareView.snp.makeConstraints { make in
|
|
318
|
+
make.edges.equalToSuperview()
|
|
319
|
+
}
|
|
320
|
+
// Customize feature area - Example: Hide beauty feature
|
|
321
|
+
prepareView.disableMenuBeauty(true)
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
|**API**|**Description**|
|
|
327
|
+
|---------|---------|
|
|
328
|
+
|`disableFeatureMenu(true)`|Hide the entire feature area|
|
|
329
|
+
|`disableMenuBeauty(true)`|Hide the beauty button|
|
|
330
|
+
|`disableMenuAudioEffect(true)`|Hide the audio effect button|
|
|
331
|
+
|`disableMenuSwitchCamera(true)`|Hide the camera switch button|
|
|
332
|
+
|
|
333
|
+
### Customize Host Streaming Page UI
|
|
334
|
+
- For host UI customization, refer to Host Core Page. Modify styles and add custom business components in `AnchorView`.
|
|
335
|
+
|
|
336
|
+
- To adjust video stream widgets, see Adjust Video Stream Widgets. Update display elements such as names and avatars on video slots within `AnchorView`.
|
|
337
|
+
|
|
338
|
+
### Customize Texts
|
|
339
|
+
|
|
340
|
+
TUILiveKit manages UI text through the [Apple Strings Catalog](https://developer.apple.com/documentation/xcode/localizing-and-varying-text-with-a-string-catalog), allowing you to visually edit copywriting with Xcode's graphical tools.
|
|
341
|
+
|
|
342
|
+
> **Note:**
|
|
343
|
+
>
|
|
344
|
+
> [Apple Strings Catalog](https://developer.apple.com/documentation/xcode/localizing-and-varying-text-with-a-string-catalog) (.xcstrings) is a localization format introduced in Xcode 15. It supports structured formats for plurals, device-specific variants, and more. This is now the recommended approach for managing localization in iOS and macOS apps.
|
|
345
|
+
>
|
|
346
|
+
|
|
347
|
+
### Customize Icons
|
|
348
|
+
|
|
349
|
+
TUILiveKit uses `TUILiveKit.xcassets` to manage UI image resources. Customize icons for your interface quickly using Xcode's graphical asset tools.
|
|
350
|
+
|
|
351
|
+
## Next Steps
|
|
352
|
+
|
|
353
|
+
Congratulations! You have successfully integrated the **host streaming** feature. Next, you can add capabilities such as **audience viewing**, **live stream list**, and **gift system**. See the table below for more information:
|
|
354
|
+
|
|
355
|
+
|**Feature**|**Description**|**Integration Guide**|
|
|
356
|
+
|---------|---------|---------|
|
|
357
|
+
|**Audience Viewing**|Allow audience to join the host's live room and watch the stream, including audience co-hosting, live room info, online audience list, and live comments display.|Audience Viewing|
|
|
358
|
+
|**Live Stream List**|Show the live stream list interface and features, including live stream list and room info display.|Live Stream List|
|
|
359
|
+
|**Gift System**|Configure custom gift assets, integrate billing, enable PK interactions, and more.|Gift System|
|
|
360
|
+
|
|
361
|
+
## FAQs
|
|
362
|
+
|
|
363
|
+
### No video after starting the stream?
|
|
364
|
+
|
|
365
|
+
Open your phone's **Settings** > **App** > **Camera** and verify that camera permissions are enabled. See the image below:
|
|
366
|
+
|
|
367
|
+
### Unable to start streaming after clicking the start button, showing "Not logged in"?
|
|
368
|
+
|
|
369
|
+
Review the Login Guide and confirm that the login feature has been integrated.
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
## Feature Preview
|
|
2
|
+
|
|
3
|
+
This document provides a detailed introduction to the **Live Stream List Page** in TUILiveKit. You can directly integrate our pre-built live stream list page into your existing project, or deeply customize the page style, layout, and features according to your specific needs.
|
|
4
|
+
- **Double-Column Waterfall Flow**: Default view, simultaneously displaying previews for 2 live rooms.
|
|
5
|
+
|
|
6
|
+
- **Single-Column Waterfall Flow**: Default view, simultaneously displaying a preview for 1 live room.
|
|
7
|
+
|
|
8
|
+
| <strong>Double-Column Waterfall Flow</strong> | <strong>Single-Column Waterfall Flow</strong> |
|
|
9
|
+
| --- | --- |
|
|
10
|
+
| | ### |
|
|
11
|
+
|
|
12
|
+
> **Note:**
|
|
13
|
+
>
|
|
14
|
+
> When previewing live room screens, the preview duration is counted into the viewer's audio/video duration. For detailed billing information, please refer to [Pricing](https://www.tencentcloud.com/document/product/647/66078).
|
|
15
|
+
>
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### Step 1. Activate the Service
|
|
20
|
+
|
|
21
|
+
Refer to the Activate Service document to enable the Free trial or official package.
|
|
22
|
+
|
|
23
|
+
### Step 2. Code Integration
|
|
24
|
+
|
|
25
|
+
Refer to Preparations guide to integrate the TUILiveKit SDK.
|
|
26
|
+
|
|
27
|
+
### Step 3. Add the Live Stream List Page
|
|
28
|
+
|
|
29
|
+
The **LiveListView** component is a dedicated view for displaying the live stream list. It automatically pulls the live room list, supports different display styles (**single-column** and **double-column**).
|
|
30
|
+
|
|
31
|
+
【Swift】
|
|
32
|
+
``` swift
|
|
33
|
+
// Example: YourLiveListViewController is the view controller representing your live stream list waterfall layout
|
|
34
|
+
class YourLiveListViewController: UIViewController {
|
|
35
|
+
|
|
36
|
+
// 1. Declare liveListView as a member variable
|
|
37
|
+
// - style: .doubleColumn // Two-column waterfall layout
|
|
38
|
+
// - style: .singleColumn // Single-column waterfall layout
|
|
39
|
+
// Example shows a two-column waterfall layout, if needed input .singleColumn just
|
|
40
|
+
private let liveListView = LiveListView(style: .doubleColumn)
|
|
41
|
+
|
|
42
|
+
public override func viewDidLoad() {
|
|
43
|
+
super.viewDidLoad()
|
|
44
|
+
// 2. Add liveListView to view
|
|
45
|
+
view.addSubview(liveListView)
|
|
46
|
+
liveListView.snp.makeConstraints { make in
|
|
47
|
+
make.edges.equalToSuperview()
|
|
48
|
+
}
|
|
49
|
+
// 3. Set the click event delegate for the list
|
|
50
|
+
liveListView.itemClickDelegate = self
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 4. Navigate to the Audience Viewing Page
|
|
56
|
+
|
|
57
|
+
You can customize the page navigation by setting a click listener. For audience viewing page implementation, see Audience Viewing:
|
|
58
|
+
|
|
59
|
+
**Example Code**:
|
|
60
|
+
|
|
61
|
+
【Swift】
|
|
62
|
+
``` swift
|
|
63
|
+
// Implement OnItemClickDelegate in your live stream list view controller, for example: YourLiveListViewController
|
|
64
|
+
extension YourLiveListViewController: OnItemClickDelegate {
|
|
65
|
+
|
|
66
|
+
func onItemClick(liveInfo: LiveInfo, frame: CGRect) {
|
|
67
|
+
// 1. Instantiate your audience view controller
|
|
68
|
+
let audienceVC = YourAudienceViewController(roomId: liveInfo.roomId)
|
|
69
|
+
audienceVC.modalPresentationStyle = .fullScreen
|
|
70
|
+
// 2. Navigate to your audience view controller
|
|
71
|
+
present(audienceVC, animated: false)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Step 5. Optimizing Page Transitions for `LiveListView` Interaction
|
|
78
|
+
|
|
79
|
+
To ensure a more complete and smooth experience during page transitions, the `LiveListView` component, combined with iOS page routing system attributes, provides the `refreshLiveList` and `onRouteToNextPage` methods. With just one line of code, you can optimize live list display and video stream playback. The optimization method is as follows:
|
|
80
|
+
|
|
81
|
+
【Swift】
|
|
82
|
+
``` swift
|
|
83
|
+
// Implement in your live stream list view controller, for example: YourLiveListViewController
|
|
84
|
+
class YourLiveListViewController: UIViewController {
|
|
85
|
+
|
|
86
|
+
override func viewDidAppear(_ animated: Bool) {
|
|
87
|
+
super.viewDidAppear(animated)
|
|
88
|
+
// refreshLiveList: Call this method in viewDidAppear to ensure getting the latest list every time returning to current page
|
|
89
|
+
liveListView.refreshLiveList()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
override func viewWillDisappear(_ animated: Bool) {
|
|
93
|
+
super.viewWillDisappear(animated)
|
|
94
|
+
// onRouteToNextPage: Call this method in viewWillDisappear to stop the video stream playback on current live list page when entering another page
|
|
95
|
+
liveListView.onRouteToNextPage()
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Customize Your UI Layout
|
|
101
|
+
|
|
102
|
+
**TUILiveKit** provides flexible interfaces to customize the live list waterfall component. You can customize the data source and list item styles according to your business needs.
|
|
103
|
+
|
|
104
|
+
### Customize Data Source
|
|
105
|
+
|
|
106
|
+
If your backend has a separate live list data, you can customize the data source by implementing the `LiveListDataSource` interface instead of using the component's default list data.
|
|
107
|
+
|
|
108
|
+
【Swift】
|
|
109
|
+
``` swift
|
|
110
|
+
// Example: YourLiveListViewController is the view controller representing your live stream list waterfall layout
|
|
111
|
+
class YourLiveListViewController: UIViewController {
|
|
112
|
+
|
|
113
|
+
private let liveListView: LiveListView = LiveListView(style: .doubleColumn)
|
|
114
|
+
|
|
115
|
+
public override func viewDidLoad() {
|
|
116
|
+
super.viewDidLoad()
|
|
117
|
+
view.addSubview(liveListView)
|
|
118
|
+
liveListView.snp.makeConstraints { make in
|
|
119
|
+
make.edges.equalToSuperview()
|
|
120
|
+
}
|
|
121
|
+
liveListView.itemClickDelegate = self
|
|
122
|
+
// 1. Set custom data source agent
|
|
123
|
+
liveListView.dataSource = self
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 2. Implement custom data source agent: LiveListDataSource
|
|
128
|
+
extension YourLiveListViewController: LiveListDataSource {
|
|
129
|
+
|
|
130
|
+
public func fetchLiveList(cursor: String, onSuccess: @escaping LiveListBlock, onError: @escaping TUIErrorBlock) {
|
|
131
|
+
// 3. Connect to your own backend business and return data to the UI component in the following format
|
|
132
|
+
var liveInfoList: [LiveInfo] = []
|
|
133
|
+
var liveInfo = LiveInfo()
|
|
134
|
+
liveInfo.roomId = "live_123456"
|
|
135
|
+
liveInfo.name = "live_123456"
|
|
136
|
+
liveInfoList.append(liveInfo)
|
|
137
|
+
let cursor = "aabbccdd"
|
|
138
|
+
onSuccess(cursor, liveInfoList)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Custom View
|
|
144
|
+
|
|
145
|
+
The bottom of the waterfall list items displays the video stream or live cover by default. If you need to customize the UI elements at the top of the list items (such as the host's avatar, live title, etc.), you can do so by implementing the `LiveListViewAdapter` interface.
|
|
146
|
+
|
|
147
|
+
【Swift】
|
|
148
|
+
``` swift
|
|
149
|
+
// Example: YourLiveListViewController is the view controller representing your live stream list waterfall layout
|
|
150
|
+
class YourLiveListViewController: UIViewController {
|
|
151
|
+
|
|
152
|
+
private let liveListView: LiveListView = LiveListView(style: .doubleColumn)
|
|
153
|
+
|
|
154
|
+
public override func viewDidLoad() {
|
|
155
|
+
super.viewDidLoad()
|
|
156
|
+
view.addSubview(liveListView)
|
|
157
|
+
liveListView.snp.makeConstraints { make in
|
|
158
|
+
make.edges.equalToSuperview()
|
|
159
|
+
}
|
|
160
|
+
liveListView.itemClickDelegate = self
|
|
161
|
+
liveListView.dataSource = self
|
|
162
|
+
// 1. Set adapter
|
|
163
|
+
liveListView.adapter = self
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// 2. Implement custom widget agent
|
|
168
|
+
extension YourLiveListViewController: LiveListViewAdapter {
|
|
169
|
+
public func createLiveInfoView(info: LiveInfo) -> UIView {
|
|
170
|
+
// Custom view
|
|
171
|
+
return YourCustomView(liveInfo: info)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public func updateLiveInfoView(view: UIView, info: LiveInfo) {
|
|
175
|
+
if let infoView = view as? YourCustomView {
|
|
176
|
+
// Custom view update data
|
|
177
|
+
infoView.updateView(liveInfo: info)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Custom Transition Animation
|
|
184
|
+
|
|
185
|
+
**Double-Column Waterfall Flow** and **Single-Column Waterfall Flow** to navigate to the audience viewing page, custom transition animation is often needed for better transition effects. `TUILiveKit` has open-sourced the live stream transition animation [LiveTransitioningDelegate](https://github.com/Tencent-RTC/TUILiveKit/blob/main/iOS/TUILiveKit/Sources/TUILiveListViewController.swift#L193) in the **GitHub** repository. You just need to set `audienceVC.transitioningDelegate` to achieve the same transition animation as TUILiveKit.
|
|
186
|
+
|
|
187
|
+
【Swift】
|
|
188
|
+
``` swift
|
|
189
|
+
// Implement OnItemClickDelegate in your live stream waterfall layout list view controller, for example: YourLiveListViewController
|
|
190
|
+
extension YourLiveListViewController: OnItemClickDelegate {
|
|
191
|
+
|
|
192
|
+
func onItemClick(liveInfo: LiveInfo, frame: CGRect) {
|
|
193
|
+
let audienceVC = YourAudienceViewController(roomId: liveInfo.roomId)
|
|
194
|
+
audienceVC.modalPresentationStyle = .fullScreen
|
|
195
|
+
// Set the transition animation delegate
|
|
196
|
+
audienceVC.transitioningDelegate = LiveTransitioningDelegate(originFrame: frame)
|
|
197
|
+
present(audienceVC, animated: false)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
|**Double-Column Waterfall Transition Animation**|**Single-Column Waterfall Transition Animation**|
|
|
204
|
+
|---------|---------|
|
|
205
|
+
|||
|
|
206
|
+
|
|
207
|
+
## Next Steps
|
|
208
|
+
|
|
209
|
+
Congratulations! You have successfully integrated the **Live Stream List** feature. Next, you can implement features such as **Host Live Streaming** and **Audience Viewing**. Please refer to the table below:
|
|
210
|
+
| <strong>Feature</strong> | <strong>Description</strong> | <strong>Integration Guide</strong> |
|
|
211
|
+
| --- | --- | --- |
|
|
212
|
+
| <strong>Host Streaming</strong> | The complete workflow for a host to start a stream, including pre-stream setup and various in-stream interactions. | Host Streaming |
|
|
213
|
+
| <strong>Audience Viewing</strong> | Audience can watch live streaming after entering the anchor's live streaming room, with features like audience mic connection, live room information, online audience, and bullet screen display. | Audience Viewing |
|
|
214
|
+
|
|
215
|
+
## FAQs
|
|
216
|
+
|
|
217
|
+
### What should I do if the page shows no live streams after integrating the live list feature?
|
|
218
|
+
|
|
219
|
+
If you see a blank page, you need to check if you have completed the Complete Login. To test this feature, you can use two devices: one device to start a broadcast, and the other on the live list page to pull the list of ongoing live streams.
|
|
220
|
+
|
|
221
|
+
### What is the difference between single-column and double-column waterfall flows?
|
|
222
|
+
|
|
223
|
+
A single-column waterfall flow previews one live room at a time, while a double-column waterfall flow previews two live rooms simultaneously. You can choose the appropriate layout based on your design requirements.
|
|
224
|
+
|
|
225
|
+
### Is there a charge for previewing live streams?
|
|
226
|
+
|
|
227
|
+
Yes, the duration of previewing a live room is counted towards the audience's audio/video duration, which is a paid service. For detailed
|
|
228
|
+
|
|
229
|
+
Pricing, you can refer to the relevant content in the documentation.
|