@tencentcloud/sdk-mcp 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/package.json +1 -1
  2. package/resource/doc/chatuikit/android/features/theme.md +363 -0
  3. package/resource/doc/chatuikit/android/workflow.md +0 -0
  4. package/resource/doc/chatuikit/{android/client_api_android.md → faq/android_sdk/client-api.md} +0 -1
  5. package/resource/doc/chatuikit/faq/{native_sdk/faq.md → common/product.md} +8 -0
  6. package/resource/doc/chatuikit/faq/flutter_sdk/faq.md +54 -0
  7. package/resource/doc/chatuikit/faq/web_sdk/faq.md +1 -1
  8. package/resource/doc/chatuikit/flutter/features/theme.md +379 -0
  9. package/resource/doc/chatuikit/flutter/workflow.md +816 -0
  10. package/resource/doc/chatuikit/iOS/features/theme.md +416 -0
  11. package/resource/doc/chatuikit/iOS/workflow.md +0 -0
  12. package/resource/doc/chatuikit/react/components/chat-setting.md +124 -0
  13. package/resource/doc/chatuikit/react/components/contact-list.md +1331 -0
  14. package/resource/doc/chatuikit/react/components/search.md +885 -0
  15. package/resource/doc/chatuikit/vue/components/chat-setting.md +88 -0
  16. package/resource/doc/chatuikit/vue/components/contact-list.md +679 -0
  17. package/resource/doc/chatuikit/vue/components/search.md +1384 -0
  18. package/resource/doc/livekit/live/android/workflow.md +137 -4
  19. package/resource/doc/livekit/live/flutter/live-audience-list.md +337 -0
  20. package/resource/doc/livekit/live/flutter/live-audio-effect.md +739 -0
  21. package/resource/doc/livekit/live/flutter/live-barrage.md +578 -0
  22. package/resource/doc/livekit/live/flutter/live-base-beauty.md +484 -0
  23. package/resource/doc/livekit/live/flutter/live-co-guest-interaction.md +606 -0
  24. package/resource/doc/livekit/live/flutter/live-gift.md +812 -0
  25. package/resource/doc/livekit/live/flutter/live-host-interaction.md +1113 -0
  26. package/resource/doc/livekit/live/flutter/live-integration.md +1029 -0
  27. package/resource/doc/livekit/live/flutter/live-live-list.md +861 -0
  28. package/resource/doc/livekit/live/ios/live-audience-list.md +335 -0
  29. package/resource/doc/livekit/live/ios/live-audio-effect.md +373 -0
  30. package/resource/doc/livekit/live/ios/live-barrage.md +529 -0
  31. package/resource/doc/livekit/live/ios/live-base-beauty.md +237 -0
  32. package/resource/doc/livekit/live/ios/live-co-guest-interaction.md +483 -0
  33. package/resource/doc/livekit/live/ios/live-gift.md +785 -0
  34. package/resource/doc/livekit/live/ios/live-host-interaction.md +743 -0
  35. package/resource/doc/livekit/live/ios/live-integration.md +822 -0
  36. package/resource/doc/livekit/live/ios/live-live-list.md +535 -0
  37. package/resource/doc/livekit/live/ios/workflow.md +352 -0
  38. package/resource/doc/rtcengine/faq/web/web.md +2 -2
  39. package/resource/doc/rtcengine/web/how_to_integrated_web_sdk.md +2 -2
  40. package/resource/doc/rtcengine/web/plugin/20-advanced-customized-capture-rendering.md +84 -0
  41. package/resource/doc/rtcengine/web/plugin/21-advanced-auto-play-policy.md +86 -0
  42. package/resource/doc/rtcengine/web/plugin/22-advanced-audio-mixer.md +220 -0
  43. package/resource/doc/rtcengine/web/plugin/23-advanced-support-detection.md +217 -0
  44. package/resource/doc/rtcengine/web/plugin/24-advanced-network-quality.md +137 -0
  45. package/resource/doc/rtcengine/web/plugin/25-advanced-device-change.md +97 -0
  46. package/resource/doc/rtcengine/web/plugin/26-advanced-publish-cdn-stream.md +453 -0
  47. package/resource/doc/rtcengine/web/plugin/27-advanced-small-stream.md +180 -0
  48. package/resource/doc/rtcengine/web/plugin/28-advanced-beauty.md +349 -0
  49. package/resource/doc/rtcengine/web/plugin/29-advanced-water-mark.md +149 -0
  50. package/resource/doc/rtcengine/web/plugin/30-advanced-cross-room-link.md +96 -0
  51. package/resource/doc/rtcengine/web/plugin/31-advanced-plugins-overview.md +405 -0
  52. package/resource/doc/rtcengine/web/plugin/34-advanced-proxy.md +244 -0
  53. package/resource/doc/rtcengine/web/plugin/35-advanced-ai-denoiser.md +84 -0
  54. package/resource/doc/rtcengine/web/plugin/36-advanced-virtual-background.md +202 -0
  55. package/resource/doc/rtcengine/web/plugin/37-advanced-voice-changer.md +98 -0
  56. package/resource/doc/rtcengine/web/plugin/38-advanced-basic-beauty.md +95 -0
  57. package/resource/doc/rtcengine/web/plugin/39-advanced-video-decoder.md +33 -0
  58. package/resource/doc/rtcengine/web/plugin/40-advanced-video-mixer.md +380 -0
  59. package/resource/doc/rtcengine/web/plugin/41-advanced-small-stream-auto-switcher.md +91 -0
  60. package/resource/doc/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +314 -0
  61. package/resource/doc/rtcengine/web/plugin/43-advanced-face-detection.md +180 -0
  62. package/tools/chat/get-native-chat-feature-detail.js +30 -0
  63. package/tools/chat/get-native-chat-feature-detail.js.map +1 -0
  64. package/tools/chat/get-native-chat-integration.js +30 -12
  65. package/tools/chat/get-native-chat-integration.js.map +1 -1
  66. package/tools/common/get-faq.js +2 -4
  67. package/tools/common/get-faq.js.map +1 -1
  68. package/tools/definitions/get_native_chat_feature_detail_def.js +32 -0
  69. package/tools/definitions/get_native_chat_feature_detail_def.js.map +1 -0
  70. package/tools/definitions/get_native_chat_uikit_integration_def.js +18 -6
  71. package/tools/definitions/get_native_chat_uikit_integration_def.js.map +1 -1
  72. package/tools/definitions/{get_native_live_extra_features_def.js → get_native_live_uikit_extra_features_def.js} +3 -3
  73. package/tools/definitions/get_native_live_uikit_extra_features_def.js.map +1 -0
  74. package/tools/definitions/{get_native_live_interaction_def.js → get_native_live_uikit_interaction_def.js} +3 -3
  75. package/tools/definitions/get_native_live_uikit_interaction_def.js.map +1 -0
  76. package/tools/definitions/get_web_chat_uikit_component_detail_def.js +46 -7
  77. package/tools/definitions/get_web_chat_uikit_component_detail_def.js.map +1 -1
  78. package/tools/definitions/record_prompt_def.js +41 -10
  79. package/tools/definitions/record_prompt_def.js.map +1 -1
  80. package/tools/definitions/record_result_def.js +1 -1
  81. package/tools/index.js +6 -4
  82. package/tools/index.js.map +1 -1
  83. package/tools/live/{get_native_live_extra_features.js → get_native_live_uikit_extra_features.js} +4 -4
  84. package/tools/live/get_native_live_uikit_extra_features.js.map +1 -0
  85. package/tools/live/{get_native_live_interaction.js → get_native_live_uikit_interaction.js} +4 -4
  86. package/tools/live/get_native_live_uikit_interaction.js.map +1 -0
  87. package/tools/rtcengine/get-trtc-web-sdk-faq.js +1 -1
  88. package/tools/rtcengine/get-trtc-web-sdk-plugin.js +45 -0
  89. package/tools/rtcengine/get-trtc-web-sdk-plugin.js.map +1 -0
  90. package/utils/handle-component-name.js +0 -16
  91. package/utils/handle-component-name.js.map +1 -1
  92. package/utils/report-cls-client.js +1 -1
  93. package/utils/report-es-client.js +1 -1
  94. package/resource/doc/chatuikit/android/integrate_tuichat_only_android.md +0 -382
  95. package/resource/doc/chatuikit/android/ui_api_android.md +0 -418
  96. package/resource/doc/chatuikit/iOS/integrate_tuichat_only_iOS.md +0 -993
  97. package/resource/doc/chatuikit/iOS/ui_api_iOS.md +0 -526
  98. package/tools/definitions/get_native_live_extra_features_def.js.map +0 -1
  99. package/tools/definitions/get_native_live_interaction_def.js.map +0 -1
  100. package/tools/live/get_native_live_extra_features.js.map +0 -1
  101. package/tools/live/get_native_live_interaction.js.map +0 -1
  102. /package/resource/doc/chatuikit/android/{integrate_tuikit_android.md → integration.md} +0 -0
  103. /package/resource/doc/chatuikit/{flutter/client_api_Flutter.md → faq/flutter_sdk/client-api.md} +0 -0
  104. /package/resource/doc/chatuikit/{iOS/client_api_iOS.md → faq/ios_sdk/client-api.md} +0 -0
  105. /package/resource/doc/chatuikit/flutter/{integrate_tuikit_Flutter.md → integration.md} +0 -0
  106. /package/resource/doc/chatuikit/iOS/{integrate_tuikit_iOS.md → integration.md} +0 -0
  107. /package/resource/doc/chatuikit/react/components/{chatheader.md → chat-header.md} +0 -0
  108. /package/resource/doc/chatuikit/vue/components/{chatheader.md → chat-header.md} +0 -0
@@ -0,0 +1,822 @@
1
+ 本文档将帮助您使用 **AtomicXCore SDK **的核心组件 [LiveCoreView](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/livecoreview),快速构建一个包含主播开播和观众观看功能的基础直播 App。
2
+
3
+ ## **核心功能**
4
+
5
+ **LiveCoreView** 是一个专为直播场景设计的轻量级 `UIView` 组件,是您构建直播场景的核心,它封装了所有复杂的底层直播技术(例如推拉流、连麦、音视频渲染)。您可以将 LiveCoreView 作为直播画面的“画布”,专注于上层 UI 与交互的开发。
6
+
7
+ 通过下方的视图层级示意图,您可以直观了解 **LiveCoreView** 在直播界面中的位置和作用:
8
+
9
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/415b5505a5b011f0a90152540099c741.png)
10
+
11
+
12
+ ## 准备工作
13
+
14
+ ### 步骤1:开通服务
15
+
16
+ 请参见 [开通服务](https://write.woa.com/document/141302177829593088),获取体验版或付费版 SDK。
17
+
18
+ ### 步骤2:在当前项目中导入 AtomicXCore
19
+ 1. **安装组件**:请在您的 **Podfile** 文件中添加 `pod 'AtomicXCore'` 依赖,然后执行`pod install`。
20
+
21
+ ``` ruby
22
+ target 'xxxx' do
23
+ pod 'AtomicXCore'
24
+ end
25
+ ```
26
+ 2. **配置工程权限: **请在应用的 `Info.plist` 文件中添加相机和麦克风的使用权限说明。
27
+
28
+ ``` ruby
29
+ <key>NSCameraUsageDescription</key>
30
+ <string>TUILiveKit需要访问你的相机权限,开启后录制的视频才会有画面</string>
31
+ <key>NSMicrophoneUsageDescription</key>
32
+ <string>TUILiveKit需要访问您的麦克风权限,开启后录制的视频才会有声音</string>
33
+ ```
34
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/5f6d26e7a5b011f09936525400e889b2.png)
35
+
36
+
37
+ ### 步骤3:实现登录逻辑
38
+
39
+ 在您的项目中调用 `LoginStore.shared.login` 完成登录,**这是使用 **`AtomicXCore`** 所有功能的关键前提**。
40
+
41
+ > **重要:**
42
+ >
43
+
44
+ > 推荐在您 App 自身的用户账户登录成功后,再调用 LoginStore.shared.login,以确保登录业务逻辑的清晰和一致。
45
+ >
46
+
47
+ ``` swift
48
+ import AtomicXCore
49
+
50
+ // AppDelegate.swift
51
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
52
+ LoginStore.shared.login(sdkAppID: 1400000001, // 替换为您的 SDKAppID
53
+ userID: "test_001", // 替换为您的 UserID
54
+ userSig: "xxxxxxxxxxx") { result in // 替换为您的 UserSig
55
+ switch result {
56
+ case .success(let info):
57
+ debugPrint("login success")
58
+ case .failure(let error):
59
+ debugPrint("login failed code:\(error.code), message:\(error.message)")
60
+ }
61
+ }
62
+ return true
63
+ }
64
+ ```
65
+
66
+ **登录接口参数说明:**
67
+ <table>
68
+ <tr>
69
+ <td rowspan="1" colSpan="1" >参数</td>
70
+
71
+ <td rowspan="1" colSpan="1" >类型</td>
72
+
73
+ <td rowspan="1" colSpan="1" >说明</td>
74
+ </tr>
75
+
76
+ <tr>
77
+ <td rowspan="1" colSpan="1" >sdkAppId</td>
78
+
79
+ <td rowspan="1" colSpan="1" >Int32</td>
80
+
81
+ <td rowspan="1" colSpan="1" >从 [控制台](https://console.cloud.tencent.com/trtc) 获取,通常是以 `140` 或 `160` 开头的 10 位整数。</td>
82
+ </tr>
83
+
84
+ <tr>
85
+ <td rowspan="1" colSpan="1" >userID</td>
86
+
87
+ <td rowspan="1" colSpan="1" >String</td>
88
+
89
+ <td rowspan="1" colSpan="1" >当前用户的唯一 ID,仅包含英文字母、数字、连字符和下划线。为避免多端登录冲突,**请勿使用**`1`、`123`**等简单 ID**。</td>
90
+ </tr>
91
+
92
+ <tr>
93
+ <td rowspan="1" colSpan="1" >userSig</td>
94
+
95
+ <td rowspan="1" colSpan="1" >String</td>
96
+
97
+ <td rowspan="1" colSpan="1" >用于腾讯云鉴权的票据。请注意:<br>- 开发环境:您可以采用本地 `GenerateTestUserSig.genTestSig` 函数生成 userSig 或者通过 [UserSig 辅助工具](https://console.cloud.tencent.com/im/tool-usersig) 生成临时的 UserSig。<br>- 生产环境:为了防止密钥泄露,请务必采用服务端生成 UserSig 的方式。详细信息请参考 [服务端生成 UserSig](https://cloud.tencent.com/document/product/647/17275)。<br>更多信息请参见 [如何计算及使用 UserSig](https://cloud.tencent.com/document/product/647/17275)。</td>
98
+ </tr>
99
+ </table>
100
+
101
+
102
+ ## 搭建基础直播间
103
+
104
+ ### 步骤1:实现主播视频开播
105
+
106
+ 主播开播流程如下,您只需执行以下几步操作,即可快速搭建主播视频直播。
107
+
108
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/8dd049b0a66e11f0bf2352540044a08e.png)
109
+
110
+
111
+ > **提示:**
112
+ >
113
+
114
+ > 主播开播推流的业务代码,您也可以参考 TUILiveKit 开源项目中的 [TUILiveRoomAnchorViewController.swift](https://github.com/Tencent-RTC/TUIKit_iOS/blob/main/live/Sources/LiveStream/TUILiveRoomAnchorViewController.swift) 文件来了解完整的实现逻辑。
115
+ >
116
+
117
+ 1. **初始化主播推流的视图**
118
+
119
+
120
+ 在您的主播视图控制器中,创建一个 `LiveCoreView` 实例,并将 `viewType` 指定为 `.pushView`(推流视图)。
121
+
122
+ ``` swift
123
+ import AtomicXCore
124
+
125
+ // YourAnchorViewController 代表您的主播开播视图控制器
126
+ class YourAnchorViewController: UIViewController {
127
+
128
+ private let liveId: String
129
+ // 1. 将 LiveCoreView 作为您视图控制器的一个属性
130
+ private let coreView = LiveCoreView(viewType:.pushView, frame: UIScreen.main.bounds)
131
+
132
+ // 2. 新增便利构造函数完成实例初始化
133
+ // - liveId: 您需要开播的直播房间 id
134
+ public init(liveId: String) {
135
+ self.liveId = liveId
136
+ super.init(nibName: nil, bundle: nil)
137
+ self.coreView.setLiveID(liveId)
138
+ }
139
+
140
+ required init?(coder: NSCoder) {
141
+ fatalError("init(coder:) has not been implemented")
142
+ }
143
+
144
+ public override func viewDidLoad() {
145
+ super.viewDidLoad()
146
+ // 3. 将主播推流页面加载到您的视图上
147
+ view.addSubview(coreView)
148
+ }
149
+ }
150
+ ```
151
+ 2. **打开摄像头和麦克风**
152
+
153
+
154
+ 通过调用 **DeviceStore** 的 `openLocalCamera、openLocalMicrophone` 接口打开摄像头和麦克风,**您无需做额外操作,LiveCoreView 会自动预览当前摄像头的视频流**,示例代码如下:
155
+
156
+ ``` swift
157
+ import AtomicXCore
158
+
159
+ // YourAnchorViewController 代表您的主播开播视图控制器
160
+ class YourAnchorViewController: UIViewController {
161
+ // ... 其他代码 ...
162
+ public override func viewDidLoad() {
163
+ super.viewDidLoad()
164
+ // 打开设备
165
+ openDevices()
166
+ }
167
+
168
+ private func openDevices() {
169
+ // 1. 打开前置摄像头
170
+ DeviceStore.shared.openLocalCamera(isFront: true, completion: nil)
171
+ // 2. 打开麦克风
172
+ DeviceStore.shared.openLocalMicrophone(completion: nil)
173
+ }
174
+ }
175
+ ```
176
+ 3. **开始直播**
177
+
178
+
179
+ 通过调用 **LiveListStore** 的 `createLive` 接口开始视频直播,完整示例代码如下:
180
+
181
+ ``` swift
182
+ import AtomicXCore
183
+
184
+ // YourAnchorViewController 代表您的主播开播视图控制器
185
+ class YourAnchorViewController: UIViewController {
186
+
187
+ // ... 其他代码 ...
188
+
189
+ // 调用开播接口开始直播
190
+ private func startLive() {
191
+ var liveInfo = LiveInfo()
192
+ // 1. 设置直播的房间 id
193
+ liveInfo.liveID = self.liveId
194
+ // 2. 设置直播的房间名称
195
+ liveInfo.liveName = "test 直播"
196
+ // 3. 配置布局模板,默认:600 动态宫格布局
197
+ liveInfo.seatLayoutTemplateID = 600
198
+ // 4. 配置主播始终在麦位上
199
+ liveInfo.keepOwnerOnSeat = true
200
+ // 5. 调用 LiveListStore.shared.createLive 开始直播
201
+ LiveListStore.shared.createLive(liveInfo) { [weak self] result in
202
+ guard let self = self else { return }
203
+ switch result {
204
+ case .success(let info):
205
+ debugPrint("startLive success")
206
+ case .failure(let error):
207
+ debugPrint("startLive error:\(error.message)")
208
+ }
209
+ }
210
+ }
211
+ }
212
+ ```
213
+
214
+ `LiveInfo`**参数说明:**
215
+
216
+ <table>
217
+ <tr>
218
+ <td rowspan="1" colSpan="1" >**参数名**</td>
219
+
220
+ <td rowspan="1" colSpan="1" >**类型**</td>
221
+
222
+ <td rowspan="1" colSpan="1" >**属性**</td>
223
+
224
+ <td rowspan="1" colSpan="1" >**描述**</td>
225
+ </tr>
226
+
227
+ <tr>
228
+ <td rowspan="1" colSpan="1" >`liveID`</td>
229
+
230
+ <td rowspan="1" colSpan="1" >`String`</td>
231
+
232
+ <td rowspan="1" colSpan="1" >必填</td>
233
+
234
+ <td rowspan="1" colSpan="1" >直播间的唯一标识符。</td>
235
+ </tr>
236
+
237
+ <tr>
238
+ <td rowspan="1" colSpan="1" >`liveName`</td>
239
+
240
+ <td rowspan="1" colSpan="1" >`String`</td>
241
+
242
+ <td rowspan="1" colSpan="1" >选填</td>
243
+
244
+ <td rowspan="1" colSpan="1" >直播间的标题。</td>
245
+ </tr>
246
+
247
+ <tr>
248
+ <td rowspan="1" colSpan="1" >`notice`</td>
249
+
250
+ <td rowspan="1" colSpan="1" >`String`</td>
251
+
252
+ <td rowspan="1" colSpan="1" >选填</td>
253
+
254
+ <td rowspan="1" colSpan="1" >直播间的公告信息。</td>
255
+ </tr>
256
+
257
+ <tr>
258
+ <td rowspan="1" colSpan="1" >`isMessageDisable`</td>
259
+
260
+ <td rowspan="1" colSpan="1" >`Bool`</td>
261
+
262
+ <td rowspan="1" colSpan="1" >选填</td>
263
+
264
+ <td rowspan="1" colSpan="1" >是否禁言(`true`:是,`false`:否)。</td>
265
+ </tr>
266
+
267
+ <tr>
268
+ <td rowspan="1" colSpan="1" >`isPublicVisible`</td>
269
+
270
+ <td rowspan="1" colSpan="1" >`Bool`</td>
271
+
272
+ <td rowspan="1" colSpan="1" >选填</td>
273
+
274
+ <td rowspan="1" colSpan="1" >是否公开可见(`true`:是,`false`:否)。</td>
275
+ </tr>
276
+
277
+ <tr>
278
+ <td rowspan="1" colSpan="1" >`isSeatEnabled`</td>
279
+
280
+ <td rowspan="1" colSpan="1" >`Bool`</td>
281
+
282
+ <td rowspan="1" colSpan="1" >选填</td>
283
+
284
+ <td rowspan="1" colSpan="1" >是否启用麦位功能(`true`:是,`false`:否)。</td>
285
+ </tr>
286
+
287
+ <tr>
288
+ <td rowspan="1" colSpan="1" >`keepOwnerOnSeat`</td>
289
+
290
+ <td rowspan="1" colSpan="1" >`Bool`</td>
291
+
292
+ <td rowspan="1" colSpan="1" >选填</td>
293
+
294
+ <td rowspan="1" colSpan="1" >是否保持房主在麦位上。</td>
295
+ </tr>
296
+
297
+ <tr>
298
+ <td rowspan="1" colSpan="1" >`maxSeatCount`</td>
299
+
300
+ <td rowspan="1" colSpan="1" >`Int`</td>
301
+
302
+ <td rowspan="1" colSpan="1" >必填</td>
303
+
304
+ <td rowspan="1" colSpan="1" >最大麦位数量。</td>
305
+ </tr>
306
+
307
+ <tr>
308
+ <td rowspan="1" colSpan="1" >`seatMode`</td>
309
+
310
+ <td rowspan="1" colSpan="1" >`TakeSeatMode`</td>
311
+
312
+ <td rowspan="1" colSpan="1" >选填</td>
313
+
314
+ <td rowspan="1" colSpan="1" >上麦模式(`.free`:自由上麦,`.apply`:申请上麦)。</td>
315
+ </tr>
316
+
317
+ <tr>
318
+ <td rowspan="1" colSpan="1" >`seatLayoutTemplateID`</td>
319
+
320
+ <td rowspan="1" colSpan="1" >`UInt`</td>
321
+
322
+ <td rowspan="1" colSpan="1" >必填</td>
323
+
324
+ <td rowspan="1" colSpan="1" >麦位布局模板 `ID。`</td>
325
+ </tr>
326
+
327
+ <tr>
328
+ <td rowspan="1" colSpan="1" >`coverURL`</td>
329
+
330
+ <td rowspan="1" colSpan="1" >`String`</td>
331
+
332
+ <td rowspan="1" colSpan="1" >选填</td>
333
+
334
+ <td rowspan="1" colSpan="1" >直播间的封面图片地址。</td>
335
+ </tr>
336
+
337
+ <tr>
338
+ <td rowspan="1" colSpan="1" >`backgroundURL`</td>
339
+
340
+ <td rowspan="1" colSpan="1" >`String`</td>
341
+
342
+ <td rowspan="1" colSpan="1" >选填</td>
343
+
344
+ <td rowspan="1" colSpan="1" >直播间的背景图片地址。</td>
345
+ </tr>
346
+
347
+ <tr>
348
+ <td rowspan="1" colSpan="1" >`categoryList`</td>
349
+
350
+ <td rowspan="1" colSpan="1" >`[NSNumber]`</td>
351
+
352
+ <td rowspan="1" colSpan="1" >选填</td>
353
+
354
+ <td rowspan="1" colSpan="1" >直播间的分类标签列表。</td>
355
+ </tr>
356
+
357
+ <tr>
358
+ <td rowspan="1" colSpan="1" >`activityStatus`</td>
359
+
360
+ <td rowspan="1" colSpan="1" >`Int`</td>
361
+
362
+ <td rowspan="1" colSpan="1" >选填</td>
363
+
364
+ <td rowspan="1" colSpan="1" >直播活动状态。</td>
365
+ </tr>
366
+
367
+ <tr>
368
+ <td rowspan="1" colSpan="1" >`isGiftEnabled`</td>
369
+
370
+ <td rowspan="1" colSpan="1" >`Bool`</td>
371
+
372
+ <td rowspan="1" colSpan="1" >选填</td>
373
+
374
+ <td rowspan="1" colSpan="1" >是否启用礼物功能(`true`:是,`false`:否)。</td>
375
+ </tr>
376
+ </table>
377
+
378
+ 4. **结束直播**
379
+
380
+
381
+ 直播结束后,主播可以调用 **LiveListStore** 的 `endLive` 接口结束直播。SDK 会处理停止推流和销毁房间的逻辑。
382
+
383
+ ``` swift
384
+ import AtomicXCore
385
+
386
+ // YourAnchorViewController 代表您的主播开播视图控制器
387
+ class YourAnchorViewController: UIViewController {
388
+
389
+ // ... 其他代码 ...
390
+
391
+ // 结束直播
392
+ private func stopLive() {
393
+ LiveListStore.shared.endLive { [weak self] result in
394
+ guard let self = self else { return }
395
+ switch result {
396
+ case .success(let data):
397
+ debugPrint("endLive success")
398
+ case .failure(let error):
399
+ debugPrint("endLive error: \(error.message)")
400
+ }
401
+ }
402
+ }
403
+ }
404
+ ```
405
+
406
+ ### 步骤2:实现观众进房观看
407
+
408
+ 观众观看流程如下,通过简单几步操作,即可实现观众观看直播。
409
+
410
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/9ceb345ca66e11f0bf2352540044a08e.png)
411
+
412
+
413
+ > **提示:**
414
+ >
415
+
416
+ > 观众进房拉流的业务代码,您也可以参考 TUILiveKit 开源项目中的 [TUILiveRoomAudienceViewController.swift](https://github.com/Tencent-RTC/TUIKit_iOS/blob/main/live/Sources/LiveStream/TUILiveRoomAudienceViewController.swift) 文件来了解完整的实现逻辑。
417
+ >
418
+
419
+ 1. **实现观众拉流页面**
420
+
421
+
422
+ 在您的观众视图控制器中,创建 `LiveCoreView` 实例,并将 `viewType` 指定为 `.playView`(拉流视图)。
423
+
424
+ ``` swift
425
+ import AtomicXCore
426
+
427
+ // YourAudienceViewController 代表您的观众观看视图控制器
428
+ class YourAudienceViewController: UIViewController {
429
+
430
+ // 1. 初始化观众拉流页面
431
+ private let coreView = LiveCoreView(viewType:.playView, frame: UIScreen.main.bounds)
432
+ private let liveId: String
433
+
434
+ public init(liveId: String) {
435
+ self.liveId = liveId
436
+ super.init(nibName: nil, bundle: nil)
437
+ // 2. 绑定直播 id
438
+ self.coreView.setLiveID(liveId)
439
+ }
440
+
441
+ required init?(coder: NSCoder) {
442
+ fatalError("init(coder:) has not been implemented")
443
+ }
444
+
445
+ public override func viewDidLoad() {
446
+ super.viewDidLoad()
447
+ // 3. 将主播推流页面加载到您的视图上
448
+ view.addSubview(coreView)
449
+ }
450
+ }
451
+ ```
452
+ 2. **进入直播间观看**
453
+
454
+
455
+ 通过调用 **LiveListStore** 的 `joinLive` 接口加入直播,**您无需做额外操作,LiveCoreView 会自动播放当前房间的视频流**,完整示例代码如下:
456
+
457
+ ``` swift
458
+ import AtomicXCore
459
+
460
+ // YourAudienceViewController 代表您的观众观看视图控制器
461
+ class YourAudienceViewController: UIViewController {
462
+ // ... 其他代码 ...
463
+
464
+ public override func viewDidLoad() {
465
+ super.viewDidLoad()
466
+ // 3. 将主播推流页面加载到您的视图上
467
+ view.addSubview(coreView)
468
+
469
+ // 4. 进入直播间
470
+ joinLive()
471
+ }
472
+
473
+ private func joinLive() {
474
+ // 调用 LiveListStore.shared.joinLive 进入直播间
475
+ // - liveId: 与主播开播同样的 liveId
476
+ LiveListStore.shared.joinLive(liveID: liveId) { [weak self] result in
477
+ guard let self = self else { return }
478
+ switch result {
479
+ case .success(let info):
480
+ debugPrint("joinLive success")
481
+ case .failure(let error):
482
+ debugPrint("joinLive error \(error.message)")
483
+ // 进房失败,也需要退出页面
484
+ // self.dismiss(animated: true)
485
+ }
486
+ }
487
+ }
488
+ }
489
+ ```
490
+ 3. **退出直播**
491
+
492
+
493
+ 观众退出直播间时,需要调用 **LiveListStore** 的 `leaveLive` 接口退出直播。SDK 会自动停止拉流并退出房间。
494
+
495
+ ``` swift
496
+ import AtomicXCore
497
+
498
+ // YourAudienceViewController 代表您的观众观看视图控制器
499
+ class YourAudienceViewController: UIViewController {
500
+
501
+ // ... 其他代码 ...
502
+
503
+ // 退出直播
504
+ private func leaveLive() {
505
+ LiveListStore.shared.leaveLive { [weak self] result in
506
+ guard let self = self else { return }
507
+ switch result {
508
+ case .success:
509
+ debugPrint("leaveLive success")
510
+ case .failure(let error):
511
+ debugPrint("leaveLive error \(error.message)")
512
+ }
513
+ }
514
+ }
515
+ }
516
+ ```
517
+
518
+ ### 步骤3:监听直播事件
519
+
520
+ 在观众加入直播间后,您还需要处理一些房间内的“被动”事件。例如,主播主动结束了直播,或者观众因为违规等原因被踢出房间。如果不监听这些事件,观众端 UI 可能会停留在黑屏页面,影响用户体验。
521
+
522
+ 您可以通过订阅 `LiveListStore` 提供的 `liveListEventPublisher` 来实现事件监听。
523
+ ``` swift
524
+ import AtomicXCore
525
+ import Combine // 1. 导入 Combine 框架
526
+
527
+ // YourAudienceViewController 代表您的观众观看视图控制器
528
+ class YourAudienceViewController: UIViewController {
529
+
530
+ // ... 其他代码 (coreView, liveId, init, deinit, joinLive, leaveLive等) ...
531
+
532
+ // 2. 定义 cancellableSet 来管理订阅生命周期
533
+ private var cancellableSet: Set<AnyCancellable> = []
534
+
535
+ public override func viewDidLoad() {
536
+ super.viewDidLoad()
537
+ view.addSubview(coreView)
538
+ // 3. 监听直播事件
539
+ setupLiveEventListener()
540
+ // 4. 进入直播间
541
+ joinLive()
542
+ }
543
+
544
+ // 5. 新增一个方法来设置事件监听
545
+ private func setupLiveEventListener() {
546
+ LiveListStore.shared.liveListEventPublisher
547
+ .receive(on: RunLoop.main) // 确保在主线程处理 UI 更新
548
+ .sink { [weak self] event in
549
+ guard let self = self else { return }
550
+ switch event {
551
+ case .onLiveEnded(let liveID, let reason, let message):
552
+ // 监听到直播结束
553
+ debugPrint("Live ended. liveID: \(liveID), reason: \(reason.rawValue), message: \(message)")
554
+ // 在此处处理退出直播间的逻辑,例如关闭当前页面
555
+ // self.dismiss(animated: true)
556
+ case .onKickedOutOfLive(let liveID, let reason, let message):
557
+ // 监听到被踢出直播
558
+ debugPrint("Kicked out of live. liveID: \(liveID), reason: \(reason.rawValue), message: \(message)")
559
+ // 在此处处理退出直播间的逻辑
560
+ // self.dismiss(animated: true)
561
+ }
562
+ }
563
+ .store(in: &cancellableSet) // 管理订阅
564
+ }
565
+
566
+ // ... joinLive() 和 leaveLive() 方法 ...
567
+ }
568
+ ```
569
+
570
+ ### 运行效果
571
+
572
+ 集成 **LiveCoreView** 后,您将得到一个纯净的视频渲染视图,它已具备完整的直播业务能力,但没有任何交互 UI。您可以参考下一章节 [丰富直播场景](https://write.woa.com/#82dbc44c-8a8e-40e2-89b9-66070f4beb72) 来完善直播场景。
573
+ <table>
574
+ <tr>
575
+ <td rowspan="1" colSpan="1" ></td>
576
+
577
+ <td rowspan="1" colSpan="1" >**动态宫格布局**</td>
578
+
579
+ <td rowspan="1" colSpan="1" >**浮动小窗布局**</td>
580
+
581
+ <td rowspan="1" colSpan="1" >**固定宫格布局**</td>
582
+
583
+ <td rowspan="1" colSpan="1" >**固定小窗布局**</td>
584
+ </tr>
585
+
586
+ <tr>
587
+ <td rowspan="1" colSpan="1" >**模板 ID**</td>
588
+
589
+ <td rowspan="1" colSpan="1" >600</td>
590
+
591
+ <td rowspan="1" colSpan="1" >601</td>
592
+
593
+ <td rowspan="1" colSpan="1" >800</td>
594
+
595
+ <td rowspan="1" colSpan="1" >801</td>
596
+ </tr>
597
+
598
+ <tr>
599
+ <td rowspan="1" colSpan="1" >**描述**</td>
600
+
601
+ <td rowspan="1" colSpan="1" >默认布局,可根据连麦人数动态调整宫格大小。</td>
602
+
603
+ <td rowspan="1" colSpan="1" >连麦嘉宾以浮动小窗形式显示。</td>
604
+
605
+ <td rowspan="1" colSpan="1" >连麦人数固定,每个嘉宾占据一个固定宫格。</td>
606
+
607
+ <td rowspan="1" colSpan="1" >连麦人数固定,嘉宾以固定小窗形式显示。</td>
608
+ </tr>
609
+
610
+ <tr>
611
+ <td rowspan="1" colSpan="1" >**运行效果**</td>
612
+
613
+ <td rowspan="1" colSpan="1" >![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/394f3851a5b511f09936525400e889b2.png)</td>
614
+
615
+ <td rowspan="1" colSpan="1" >![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/395e0e3da5b511f0930a5254007c27c5.png)</td>
616
+
617
+ <td rowspan="1" colSpan="1" >![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/39427c02a5b511f0b1565254001c06ec.png)</td>
618
+
619
+ <td rowspan="1" colSpan="1" >![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/3942f453a5b511f091df5254005ef0f7.png)</td>
620
+ </tr>
621
+ </table>
622
+
623
+
624
+ ## 丰富直播场景
625
+
626
+ 当您完成了基础的直播功能后,您可以参考以下功能指南来为直播添加丰富的互动玩法。
627
+ <table>
628
+ <tr>
629
+ <td rowspan="1" colSpan="1" >**直播功能**</td>
630
+
631
+ <td rowspan="1" colSpan="1" >**功能介绍**</td>
632
+
633
+ <td rowspan="1" colSpan="1" >**功能 Stores**</td>
634
+
635
+ <td rowspan="1" colSpan="1" >**实现指南**</td>
636
+ </tr>
637
+
638
+ <tr>
639
+ <td rowspan="1" colSpan="1" >**实现观众音视频连线**</td>
640
+
641
+ <td rowspan="1" colSpan="1" >观众申请上麦,与主播进行实时视频互动。</td>
642
+
643
+ <td rowspan="1" colSpan="1" >[CoGuestStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/cogueststore)</td>
644
+
645
+ <td rowspan="1" colSpan="1" >[实现观众连线](https://write.woa.com/document/191126698271952896)</td>
646
+ </tr>
647
+
648
+ <tr>
649
+ <td rowspan="1" colSpan="1" >**实现主播跨房连线 PK**</td>
650
+
651
+ <td rowspan="1" colSpan="1" >两个不同房间的主播进行连线,实现互动或 PK。</td>
652
+
653
+ <td rowspan="1" colSpan="1" >[CoHostStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/cohoststore)<br>[BattleStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/battlestore)</td>
654
+
655
+ <td rowspan="1" colSpan="1" >[实现主播连线 PK](https://write.woa.com/document/191126550284738560)</td>
656
+ </tr>
657
+
658
+ <tr>
659
+ <td rowspan="1" colSpan="1" >**添加弹幕聊天功能**</td>
660
+
661
+ <td rowspan="1" colSpan="1" >观众可以在直播间发送和接收实时文字消息。</td>
662
+
663
+ <td rowspan="1" colSpan="1" >[BarrageStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/barragestore)</td>
664
+
665
+ <td rowspan="1" colSpan="1" >[实现弹幕功能](https://write.woa.com/document/191126786270978048)</td>
666
+ </tr>
667
+
668
+ <tr>
669
+ <td rowspan="1" colSpan="1" >**构建礼物赠送系统**</td>
670
+
671
+ <td rowspan="1" colSpan="1" >观众可以向主播赠送虚拟礼物,增加互动和趣味性。</td>
672
+
673
+ <td rowspan="1" colSpan="1" >[GiftStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/giftstore)</td>
674
+
675
+ <td rowspan="1" colSpan="1" >[实现礼物功能](https://write.woa.com/document/191127003187093504)</td>
676
+ </tr>
677
+ </table>
678
+
679
+
680
+ ## API 文档
681
+ <table>
682
+ <tr>
683
+ <td rowspan="1" colSpan="1" >**Store/Component**</td>
684
+
685
+ <td rowspan="1" colSpan="1" >**功能描述**</td>
686
+
687
+ <td rowspan="1" colSpan="1" >**API 文档**</td>
688
+ </tr>
689
+
690
+ <tr>
691
+ <td rowspan="1" colSpan="1" >**LiveCoreView**</td>
692
+
693
+ <td rowspan="1" colSpan="1" >直播视频流展示与交互的核心视图组件:负责视频流渲染和视图挂件处理,支持主播直播、观众连麦、主播连线等场景。</td>
694
+
695
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/livecoreview)</td>
696
+ </tr>
697
+
698
+ <tr>
699
+ <td rowspan="1" colSpan="1" >**LiveListStore**</td>
700
+
701
+ <td rowspan="1" colSpan="1" >直播间全生命周期管理:创建 / 加入 / 离开 / 销毁房间,查询房间列表,修改直播信息(名称、公告等),监听直播状态(如被踢出、结束)。</td>
702
+
703
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/liveliststore)</td>
704
+ </tr>
705
+
706
+ <tr>
707
+ <td rowspan="1" colSpan="1" >**DeviceStore**</td>
708
+
709
+ <td rowspan="1" colSpan="1" >音视频设备控制:麦克风(开关 / 音量)、摄像头(开关 / 切换 / 画质)、屏幕共享,设备状态实时监听。</td>
710
+
711
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/devicestore)</td>
712
+ </tr>
713
+
714
+ <tr>
715
+ <td rowspan="1" colSpan="1" >**CoGuestStore**</td>
716
+
717
+ <td rowspan="1" colSpan="1" >观众连麦管理:连麦申请 / 邀请 / 同意 / 拒绝,连麦成员权限控制(麦克风 / 摄像头),状态同步。</td>
718
+
719
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/cogueststore)</td>
720
+ </tr>
721
+
722
+ <tr>
723
+ <td rowspan="1" colSpan="1" >**CoHostStore**</td>
724
+
725
+ <td rowspan="1" colSpan="1" >主播跨房连线:支持多布局模板(动态网格等),发起 / 接受 / 拒绝连线,连麦主播互动管理。</td>
726
+
727
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/cohoststore)</td>
728
+ </tr>
729
+
730
+ <tr>
731
+ <td rowspan="1" colSpan="1" >**BattleStore**</td>
732
+
733
+ <td rowspan="1" colSpan="1" >主播 PK 对战:发起 PK(配置时长 / 对手),管理 PK 状态(开始 / 结束),同步分数,监听对战结果。</td>
734
+
735
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/battlestore)</td>
736
+ </tr>
737
+
738
+ <tr>
739
+ <td rowspan="1" colSpan="1" >**GiftStore**</td>
740
+
741
+ <td rowspan="1" colSpan="1" >礼物互动:获取礼物列表,发送 / 接收礼物,监听礼物事件(含发送者、礼物详情)。</td>
742
+
743
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/giftstore)</td>
744
+ </tr>
745
+
746
+ <tr>
747
+ <td rowspan="1" colSpan="1" >**BarrageStore**</td>
748
+
749
+ <td rowspan="1" colSpan="1" >弹幕功能:发送文本 / 自定义弹幕,维护弹幕列表,实时监听弹幕状态。</td>
750
+
751
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/barragestore)</td>
752
+ </tr>
753
+
754
+ <tr>
755
+ <td rowspan="1" colSpan="1" >**LikeStore**</td>
756
+
757
+ <td rowspan="1" colSpan="1" >点赞互动:发送点赞,监听点赞事件,同步总点赞数。</td>
758
+
759
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/likestore)</td>
760
+ </tr>
761
+
762
+ <tr>
763
+ <td rowspan="1" colSpan="1" >**LiveAudienceStore**</td>
764
+
765
+ <td rowspan="1" colSpan="1" >观众管理:获取实时观众列表(ID / 名称 / 头像),统计观众数量,监听观众进出事件。</td>
766
+
767
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/liveaudiencestore)</td>
768
+ </tr>
769
+
770
+ <tr>
771
+ <td rowspan="1" colSpan="1" >**AudioEffectStore**</td>
772
+
773
+ <td rowspan="1" colSpan="1" >音频特效:变声(童声 / 男声)、混响(KTV 等)、耳返调节,实时切换特效。</td>
774
+
775
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/audioeffectstore)</td>
776
+ </tr>
777
+
778
+ <tr>
779
+ <td rowspan="1" colSpan="1" >**BaseBeautyStore**</td>
780
+
781
+ <td rowspan="1" colSpan="1" >基础美颜:调节磨皮 / 美白 / 红润(0-100 级),重置美颜状态,同步效果参数。</td>
782
+
783
+ <td rowspan="1" colSpan="1" >[API 文档](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/basebeautystore)</td>
784
+ </tr>
785
+ </table>
786
+
787
+
788
+ ## 常见问题
789
+
790
+ ### 主播调用 createLive 或 观众调用 joinLive 后为什么画面是黑的,没有视频画面?
791
+ - **检查 setLiveID**:请确保在调用开播或观看接口前,已经为 LiveCoreView 实例设置了正确的 liveID。
792
+
793
+ - **检查设备权限**:请确保 App 已获得摄像头和麦克风的系统使用权限。
794
+
795
+ - **检查主播端**:主播端是否正常调用 `DeviceStore.shared.openLocalCamera(isFront: true)` 打开了摄像头。
796
+
797
+ - **检查网络**:请检查设备网络连接是否正常。
798
+
799
+
800
+ ### 主播端打开摄像头后,开播后可以看到本地视频预览画面,开播前视频预览是黑屏?
801
+ - **检查主播端**:请检查主播推流视图`LiveCoreView` 的 `viewType`是否配置为`.pushView`。
802
+
803
+ - **检查观众端**:请检查观众拉流视图`LiveCoreView` 的 `viewType`是否配置为 `.playView`。
804
+
805
+
806
+ ### rsync 因权限不足导致依赖三方库资源拷贝失败
807
+
808
+ 例如在使用 Xcode 集成 SnapKit 框架进行开发时,可能会遇到如下编译报错:
809
+ ``` plaintext
810
+ rsync(xxxx):1:1: SnapKit.framework/SnapKit_Privacy.bundle/: mkpathat: Operation not permitted
811
+ ```
812
+
813
+ #### 问题原因
814
+
815
+ Xcode 的用户**脚本沙盒机制**限制了构建过程中 `rsync` 脚本对 `SnapKit.framework` 资源文件的写入权限,导致框架内的 `SnapKit_Privacy.bundle` 无法正常拷贝。
816
+
817
+ #### 解决步骤
818
+ 1. 关闭用户脚本沙盒后,打开 Xcode 项目,进入项目的 **Build Settings**,搜索 `User Script Sandboxing`(或标识 `ENABLE_USER_SCRIPT_SANDBOXING`),将其值从 `YES` 修改为 `NO`。
819
+
820
+ 2. 清理并重新构建项目执行 **Product → Clean Build Folder** 清理项目缓存,然后重新编译运行即可。
821
+
822
+