@tencentcloud/tuiroom-engine-electron 1.0.2 → 1.2.1

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import TIM from "tim-js-sdk";
2
2
  import TRTCCloud, { TRTCDeviceInfo, TRTCScreenCaptureSourceInfo } from 'trtc-electron-sdk';
3
- import { TUIRoomInfo, TUIVideoStreamType, TUIVideoProfile, TUIAudioProfile, TUIRole, TUIRoomEvents, TUIRoomType, TUISeatInfo, TUIRequestCallback } from './types';
3
+ import { TUIRoomInfo, TUIVideoStreamType, TUIVideoQuality, TUIAudioQuality, TUIRole, TUIRoomEvents, TUIRoomType, TUISeatInfo, TUIRequestCallback, TUISpeechMode, TUIMediaDevice, TUISeatLockParams, TUILoginUserInfo, TUIUserInfo, TUIRequest } from './types';
4
4
  export * from './types';
5
5
  export { TRTCDeviceType, TRTCDeviceState, TRTCDeviceInfo, TRTCVideoMirrorType, TRTCVideoRotation, TRTCVideoFillMode, TRTCVideoStreamType, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureSourceType, Rect, TRTCVideoEncParam, TRTCVideoResolution, TRTCVideoResolutionMode, TRTCScreenCaptureProperty } from 'trtc-electron-sdk';
6
6
  /**
@@ -17,6 +17,8 @@ declare class TUIRoomEngine {
17
17
  private static Module;
18
18
  private logger;
19
19
  private roomId;
20
+ private localVideoQuality;
21
+ private localAudioQuality;
20
22
  static setModule(Module: any): void;
21
23
  static once(event: string, func: Function): void;
22
24
  constructor();
@@ -32,6 +34,7 @@ declare class TUIRoomEngine {
32
34
  * @param args
33
35
  */
34
36
  private JSCallNativeFunctionPromise;
37
+ private JSCallNativeRequestFunctionPromise;
35
38
  /**
36
39
  * 登录 TUIRoomEngine
37
40
  *
@@ -77,6 +80,14 @@ declare class TUIRoomEngine {
77
80
  userName: string;
78
81
  avatarUrl: string;
79
82
  }): Promise<void>;
83
+ /** 获取当前用户信息接口
84
+ * @returns {Promise<TUILoginUserInfo>} loginUserInfo
85
+ * 该接口返回用户信息
86
+ *
87
+ * @example
88
+ * await TUIRoomEngine.getSelfInfo();
89
+ */
90
+ static getSelfInfo(): Promise<TUILoginUserInfo>;
80
91
  /**
81
92
  * 登出 TUIRoomEngine, 登出 TUIRoomEngine 时将销毁所有 roomEngine 实例
82
93
  *
@@ -85,45 +96,58 @@ declare class TUIRoomEngine {
85
96
  */
86
97
  static logout(): Promise<void>;
87
98
  /**
88
- * 主持人创建房间,调用 createRoom 的用户为房间的所有者。创建房间时可设置房间 Id, 房间名称,以及房间是否允许加入用户开启音视频,发送消息等功能。
99
+ * 主持人创建房间,调用 createRoom 的用户为房间的所有者。创建房间时可设置房间 Id,房间名称,房间类型,发言模式以及房间是否允许加入用户开启音视频,发送消息等功能。
89
100
  *
90
101
  * @param {object} options
91
102
  * @param {string} options.roomId 房间 Id,必填, roomId 限制长度为64字节,且仅支持以下范围的字符集:<br>
92
103
  * - 大小写英文字母(a-zA-Z)
93
104
  * - 数字(0-9)
94
105
  * - 空格 ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
95
- * @param {string} [options.name] 房间名称,必填,且不能为空字符串
96
- * @param {TUIRoomType} [options.roomType] 房间类型, 必填 <br>
97
- * 教育及会议场景设置房间类型为 TUIRoomType.kGroup,直播场景设置房间类型为 TUIRoomType.kOpen;
98
- * @param {number=} options.maxSeatCount 最大麦位数量 <br>
99
- * roomType TUIRoomType.kGroup (教育及会议场景) 时,maxSeatCount 值不做限制;
100
- * roomType 为 TUIRoomType.kOpen (直播场景) 时,maxSeatCount 最大限制为 16;
101
- * @param {boolean=} [options.enableAudio=true] 是否允许加入用户打开音频
102
- * @param {boolean=} [options.enableVideo=true] 是否允许加入用户打开视频
103
- * @param {boolean=} [options.enableMessage=true] 是否允许加入用户发送消息
104
- * @param {boolean=} [options.enableSeatControl=false] 是否开启麦位控制
106
+ * @param {string=} [options.roomName=roomId] 房间名称,默认值为 roomId,传入的值不能为空字符串
107
+ * @param {TUIRoomType=} [options.roomType=TUIRoomType.kConference] 房间类型, 默认值为 TUIRoomType.kConference <br>
108
+ * 办公协同、医疗问诊、远程会议、教育场景,roomType 设置为 TUIRoomType.kConference
109
+ * 电商直播、语聊房场景,roomType 设置为 TUIRoomType.kLivingRoom
110
+ * @param {TUISpeechMode=} [options.speechMode=TUISpeechMode.kFreeToSpeak] 房间内发言模式,默认值为 TUISpeechMode.kFreeToSpeak
111
+ * 1. roomType 为 TUIRoomType.kConference (教育及会议场景) 时:
112
+ * a. speechMode 设置为 TUISpeechMode.kFreeToSpeak,用户进房默认可以打开摄像头和麦克风
113
+ * b. speechMode 设置为 TUISpeechMode.kApplyToSpeak,用户进房默认不打开摄像头和麦克风,需要向主持人申请打开摄像头或麦克风
114
+ * TUIRoomType.kConference 场景下,TUISpeechMode.kFreeToSpeak 及 TUISpeechMode.kApplyToSpeak 模式可互相切换
115
+ * c. speechMode 设置为 TUISpeechMode.kSpeakAfterTakingSeat,用户进房后需要调用 takeSeat 上麦接口获取打开摄像头和麦克风的权限
116
+ *
117
+ * 2. roomType 为 TUIRoomType.kLivingRoom (直播场景) 时:
118
+ * a. speechMode 设置为 TUISpeechMode.kFreeToSpeak,上麦不需要主持人同意
119
+ * b. speechMode 设置为 TUISpeechMode.kSpeakAfterTakingSeat,上麦需要主持人同意
120
+ * TUIRoomType.kLivingRoom 场景下,TUISpeechMode.kFreeToSpeak 及 TUISpeechMode.kSpeakAfterTakingSeat 模式可互相切换
121
+ * @param {boolean=} [options.isMicrophoneDisableForAllUser=false] 是否开启全员禁麦,默认不开启全员禁麦(创建房间可选参数)
122
+ * @param {boolean=} [options.isCameraDisableForAllUser=false] 是否开启全员禁画,默认不开启全员禁画(创建房间可选参数)
123
+ * @param {boolean=} [options.isMessageDisableForAllUser=false] 是否允许成员发送消息,默认不禁止(创建房间可选参数)
124
+ * @param {number=} options.maxSeatCount 最大麦位数量 (创建房间可选参数)<br>
125
+ * roomType 为 TUIRoomType.kConference (教育及会议场景) 时,maxSeatCount 值不做限制;
126
+ * roomType 为 TUIRoomType.kLivingRoom (直播场景) 时,maxSeatCount 最大限制为 16;
127
+ * @param {boolean=} [options.enableCDNStreaming=false] 是否开启 CDN 直播流,默认值为 false
128
+ * @param {string=} [options.cdnStreamDomain=''] 直播推流域名,默认值为空
105
129
  * @returns {Promise<void>}
106
130
  *
107
131
  * @example
108
132
  * const roomEngine = new TUIRoomEngine();
109
133
  * await roomEngine.createRoom({
110
134
  * roomId: '12345', // 填入您的房间 Id, 注意房间 Id 要求为字符串类型
111
- * name: 'Test Room', // 填入您的房间名称, 房间名称默认为 roomId,最长 30 字节
112
- * roomType: TUIRoomType.kGroup, // 设置房间类型为 TUIRoomType.kGroup 类型
113
- * enableAudio: true, // 设置是否允许加入用户打开音频
114
- * enableVideo: true, // 设置是否允许加入用户打开视频
115
- * enableMessage: true, // 设置是否允许加入用户发送消息
135
+ * roomName: 'Test Room', // 填入您的房间名称, 房间名称默认为 roomId,最长 30 字节
136
+ * roomType: TUIRoomType.kConference, // 设置房间类型为 TUIRoomType.kConference 类型
137
+ * speechMode: TUISpeechMode.kFreeToSpeak, // 设置会议模式为自由发言模式
116
138
  * });
117
139
  */
118
140
  createRoom(options: {
119
141
  roomId: string;
120
- name: string;
121
- roomType: TUIRoomType;
142
+ roomName?: string;
143
+ roomType?: TUIRoomType;
144
+ speechMode?: TUISpeechMode;
145
+ isMicrophoneDisableForAllUser?: boolean;
146
+ isCameraDisableForAllUser?: boolean;
147
+ isMessageDisableForAllUser?: boolean;
122
148
  maxSeatCount?: number;
123
- enableAudio?: boolean;
124
- enableVideo?: boolean;
125
- enableMessage?: boolean;
126
- enableSeatControl?: boolean;
149
+ enableCDNStreaming?: boolean;
150
+ cdnStreamDomain?: string;
127
151
  }): Promise<void>;
128
152
  /**
129
153
  * 进入房间接口
@@ -134,7 +158,7 @@ declare class TUIRoomEngine {
134
158
  *
135
159
  * @example
136
160
  * const roomEngine = new TUIRoomEngine();
137
- * const roomInfo = await roomEngine.enterRoom({
161
+ * const roomDetailInfo = await roomEngine.enterRoom({
138
162
  * roomId: '12345',
139
163
  * });
140
164
  */
@@ -142,7 +166,7 @@ declare class TUIRoomEngine {
142
166
  roomId: string;
143
167
  }): Promise<TUIRoomInfo>;
144
168
  /**
145
- * 销毁房间接口,销毁房间必须由房间所有者发起,销毁房间之后房间不可进入
169
+ * 解散房间接口,解散房间必须由房间所有者发起,解散房间之后房间不可进入
146
170
  * @returns {Promise<void>}
147
171
  *
148
172
  * @example
@@ -162,42 +186,40 @@ declare class TUIRoomEngine {
162
186
  /**
163
187
  * 获取房间信息
164
188
  * @returns {Promise<TUIRoomInfo>} roomInfo
165
- * 该接口返回房间信息
189
+ * 获取房间信息
166
190
  *
167
191
  * @example
168
192
  * const roomEngine = new TUIRoomEngine();
169
- * const roomInfo = roomEngine.getRoomInfo();
193
+ * const roomInfo = await roomEngine.fetchRoomInfo();
170
194
  */
171
- getRoomInfo(): Promise<TUIRoomInfo>;
195
+ fetchRoomInfo(): Promise<TUIRoomInfo>;
172
196
  /**
173
- * 更新房间信息, 只有房间所有者有权限更新房间信息
197
+ * 更新房间的名字(仅群主或者管理员可以调用)
198
+ * @param {object} options
199
+ * @param {string} options.roomName 更新当前房间的名字
200
+ * @returns {Promise<void>}
201
+ * @example
202
+ * const roomEngine = new TUIRoomEngine();
203
+ * await roomEngine.createRoom({ roomId: '12345' });
204
+ * await roomEngine.updateRoomNameByAdmin({ roomName: '新的名字' });
174
205
  */
206
+ updateRoomNameByAdmin(options: {
207
+ roomName: string;
208
+ }): Promise<void>;
175
209
  /**
176
- * 主持人更新房间信息,注意仅房间所有者有权限更新房间信息
177
- * @param {object} roomInfo 主持人更新房间的信息
178
- * @param {string} roomInfo.name 更新房间的名字
179
- * @param {true} roomInfo.enableVideo 更新房间是否允许其他用户开启摄像头
180
- * @param {true} roomInfo.enableAudio 更新房间是否允许其他用户开启麦克风
181
- * @param {true} roomInfo.enableMessage 更新房间是否允许其他用户发送消息
182
- * @param {true} roomInfo.enableSeatControl 更新房间是否进行麦位控制<br/>
183
- * 注意:enableSeatControl 设置为 true 时为举手发言模式,enableSeatControl 设置为 false 时为自由发言模式。
184
- * @param {true} roomInfo.maxSeatCount 更新房间麦位最大值<br/>
185
- * - roomType 为 TUIRoomType.kGroup (教育及会议场景) 时,maxSeatCount 值不做限制;
186
- * - roomType 为 TUIRoomType.kOpen (直播场景) 时,maxSeatCount 最大限制为 16;
210
+ * 更新房间的发言模式(仅群主或者管理员可以调用)
211
+ * @param {object} options
212
+ * @param {TUISpeechMode} options.speechMode 发言类型
187
213
  * @returns {Promise<void>}
188
214
  *
189
215
  * @example
190
216
  * const roomEngine = new TUIRoomEngine();
191
- * await roomEngine.createRoom({ roomId: '12345' });
192
- * await roomEngine.updateRoomInfo({ name: '新的名字', enableVideo: true });
193
- */
194
- updateRoomInfo(options: {
195
- name?: string;
196
- enableVideo?: boolean;
197
- enableAudio?: boolean;
198
- enableMessage?: boolean;
199
- enableSeatControl?: boolean;
200
- maxSeatCount?: number;
217
+ * await roomEngine.updateRoomSpeechModeByAdmin({
218
+ * speechMode: TUISpeechMode.kSpeakAfterTakingSeat, // 更新为上麦后发言模式
219
+ * });
220
+ */
221
+ updateRoomSpeechModeByAdmin(options: {
222
+ speechMode: TUISpeechMode;
201
223
  }): Promise<void>;
202
224
  /**
203
225
  * 获取当前房间用户列表,注意该接口一次拉取的用户列表量最大为 100 个
@@ -210,19 +232,18 @@ declare class TUIRoomEngine {
210
232
  *
211
233
  * @example
212
234
  * const roomEngine = new TUIRoomEngine();
213
- * let result;
214
235
  * const userList = [];
236
+ * let result;
215
237
  * do {
216
238
  * result = await roomEngine.getUserList();
217
- * userList
239
+ * userList.push(...result.userInfoList);
218
240
  * } while (result.nextSequence !== 0)
219
241
  */
220
242
  getUserList(options?: {
221
243
  nextSequence?: Number;
222
- }): Promise<object>;
244
+ }): Promise<Array<TUIUserInfo>>;
223
245
  /**
224
246
  * 获取用户的详细信息
225
- *
226
247
  * @param {object} options 获取用户信息的参数
227
248
  * @param {string} options.userId 根据 userId 获取该用户的详细信息
228
249
  * @returns Promise<TUIUserInfo> userInfo
@@ -237,603 +258,651 @@ declare class TUIRoomEngine {
237
258
  getUserInfo(options: {
238
259
  userId: string;
239
260
  }): Promise<any>;
240
- private JSCallNativeRequestFunctionPromise;
241
261
  /**
242
- * 麦下用户可调用 takeSeat 成为麦上用户,仅麦上用户可发布本地音视频流。<br/>
243
- * roomInfo.enableSeatControl true 时,普通用户调用 takeSeat 方法需要等待主持人/管理员的同意后成为麦上用户。<br/>
244
- * roomInfo.enableSeatControl 为 false 时,普通用户调用 takeSeat 方法成功后即为麦上用户。<br/>
245
- * 主持人&管理员调用 takeSeat 成功后即为麦上用户。<br/>
246
- * 麦上用户的变更通过 TUIRoomEvents.onSeatListChanged 通知所有用户。<br/>
247
- * @param {object} options 获取麦位的参数
248
- * @param {number} options.seatIndex 麦位 index, 无麦位序号时设置为 -1
249
- * @param {number} options.timeout 超时时间。若 timeout 设置为 0,则无超时时间
250
- * @param {Function} options.requestCallback 请求回调,用来通知发起方请求被接受/拒绝/取消/超时/错误的回调
251
- * @returns {Promise<number>} <br/>
252
- * 当 roomIno.enableSeatControl 为 true,普通用户调用该接口时返回 requestId,普通用户可使用该 requestId 调用 cancelRequest 接口取消上麦请求。
262
+ * 设置本地流的渲染位置
263
+ * @param {object} options 设置本地流的渲染位置的参数
264
+ * @param {TUIVideoStreamType} options.streamType 本地流类型
265
+ * @param {string} options.view streamType 对应的流渲染的 div 元素的 id
266
+ * @returns {Promise<void>}
253
267
  *
254
268
  * @example
255
269
  * const roomEngine = new TUIRoomEngine();
256
270
  *
257
- * // 情景一:主持人/管理员上麦
258
- * // 情景二:当 roomInfo.enableSeatControl 为 false 时,普通用户上麦
259
- * await roomEngine.takeSeat({
260
- * seatIndex: -1,
261
- * timeout: 0,
271
+ * // 设置本地摄像头流的播放区域为 id 是 'preview-camera' 的 div 元素
272
+ * roomEngine.setLocalVideoView({
273
+ * streamType: TUIVideoStreamType.kCameraStream,
274
+ * view: 'preview-camera',
262
275
  * });
263
276
  *
264
- * // 情景三:当 roomInfo.enableSeatControl true 时,普通用户上麦
265
- * const requestId = await roomEngine.instance?.takeSeat({
266
- * seatIndex: -1,
267
- * timeout: 0,
268
- * requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {
269
- * switch (requestCallbackType) {
270
- * case TUIRequestCallbackType.kRequestAccepted:
271
- * // 请求被接受
272
- * break;
273
- * case TUIRequestCallbackType.kRequestRejected:
274
- * // 请求被拒绝
275
- * break;
276
- * case TUIRequestCallbackType.kRequestCancelled:
277
- * // 请求已取消
278
- * break;
279
- * case TUIRequestCallbackType.kRequestTimeout:
280
- * // 请求超时
281
- * break;
282
- * case TUIRequestCallbackType.kRequestError:
283
- * // 请求错误
284
- * break;
285
- * default:
286
- * break;
287
- * }
288
- * },
277
+ * // 设置本地屏幕分享流的播放区域为 id 'preview-screen' 的 div 元素
278
+ * roomEngine.setLocalVideoView({
279
+ * streamType: TUIVideoStreamType.kScreenStream,
280
+ * view: 'preview-screen',
289
281
  * });
290
282
  */
291
- takeSeat(options: {
292
- seatIndex: number;
293
- timeout: number;
294
- requestCallback?: (callbackInfo: TUIRequestCallback) => void;
295
- }): Promise<string>;
283
+ setLocalVideoView(options: {
284
+ streamType: TUIVideoStreamType;
285
+ view: string;
286
+ }): void;
296
287
  /**
297
- * 离开麦位
288
+ * 打开本地摄像头,开始视频流采集
289
+ * @param {object} options 设置本地流的参数
298
290
  * @returns {Promise<void>}
299
- *
300
291
  * @example
301
292
  * const roomEngine = new TUIRoomEngine();
302
- * await roomEngine.leaveSeat();
293
+ * await roomEngine.openLocalCamera();
303
294
  */
304
- leaveSeat(): Promise<void>;
295
+ openLocalCamera(): Promise<void>;
305
296
  /**
306
- * 获取麦位列表
307
- * @returns {Promise<TUISeatInfo[]>}
297
+ * 关闭本地摄像头
298
+ * @returns {Promise<void>}
308
299
  *
309
300
  * @example
310
301
  * const roomEngine = new TUIRoomEngine();
311
- * const seatList = await roomEngine.getSeatList();
312
- * ;
302
+ * await roomEngine.closeLocalCamera();
313
303
  */
314
- getSeatList(): Promise<TUISeatInfo[]>;
304
+ closeLocalCamera(): Promise<void>;
315
305
  /**
316
- * 请求远端用户打开摄像头
317
- * @param {object} options 请求远端用户打开摄像头的参数
318
- * @param {string} options.userId 用户 Id
319
- * @param {number} options.timeout 超时时间。若 timeout 设置为 0 ,则无超时时间
320
- * @param {Function} 请求回调,用来通知发起方请求被接受/拒绝/取消/超时/错误的回调
321
- * @return {Promise<number>} <br/>
322
- * 该接口返回 requestId,用户可使用该 requestId 调用 cancelRequest 接口取消请求
306
+ * 打开麦克风
307
+ * @returns {Promise<void>}
323
308
  *
324
309
  * @example
325
310
  * const roomEngine = new TUIRoomEngine();
326
- * const requestId = roomEngine.requestToOpenRemoteCamera({
327
- * userId: 'user_1234',
328
- * timeout: 0,
329
- * requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {
330
- * switch (requestCallbackType) {
331
- * case TUIRequestCallbackType.kRequestAccepted:
332
- * // 请求被接受
333
- * break;
334
- * case TUIRequestCallbackType.kRequestRejected:
335
- * // 请求被拒绝
336
- * break;
337
- * case TUIRequestCallbackType.kRequestCancelled:
338
- * // 请求已取消
339
- * break;
340
- * case TUIRequestCallbackType.kRequestTimeout:
341
- * // 请求超时
342
- * break;
343
- * case TUIRequestCallbackType.kRequestError:
344
- * // 请求错误
345
- * break;
346
- * default:
347
- * break;
348
- * }
349
- * },
350
- * });
311
+ * await roomEngine.openLocalMicrophone();
351
312
  */
352
- requestToOpenRemoteCamera(options: {
353
- userId: string;
354
- timeout: number;
355
- requestCallback?: (callbackInfo: TUIRequestCallback) => void;
356
- }): Promise<string>;
313
+ openLocalMicrophone(): Promise<void>;
357
314
  /**
358
- * 关闭远端用户摄像头
359
- *
360
- * @param {object} options 关闭远端用户摄像头的参数
361
- * @param {string} options.userId 用户 Id
315
+ * 关闭本地麦克风, 停止采集音频流
362
316
  * @returns {Promise<void>}
363
317
  *
364
318
  * @example
365
319
  * const roomEngine = new TUIRoomEngine();
366
- * await roomEngine.closeRemoteCamera({
367
- * userId: 'user_1234',
368
- * });
320
+ * await roomEngine.closeLocalMicrophone();
369
321
  */
370
- closeRemoteCamera(options: {
371
- userId: string;
372
- }): Promise<void>;
322
+ closeLocalMicrophone(): Promise<void>;
373
323
  /**
374
- * 请求远端用户打开麦克风
324
+ * 设置本地视频流的编码参数
325
+ * @param {object} options
326
+ * @param {TUIVideoQuality} options.quality
375
327
  *
376
- * @param {object} options 请求远端用户打开麦克风的参数
377
- * @param {string} options.userId 用户 Id
378
- * @param {number} options.timeout 超时时间,设置为 0 时,无超时时间
379
- * @param {Function} options.requestCallback 请求回调,用来通知发起方请求被接受/拒绝/取消/超时/错误的回调
380
- * @returns {Promise<number>} <br/>
381
- * 该接口返回 requestId,用户可使用该 requestId 调用 cancelRequest 接口取消请求
328
+ * - 360p TUIVideoQuality.kVideoQuality_360p <br/>
329
+ * - 540p TUIVideoQuality.kVideoQuality_540p <br/>
330
+ * - 720p TUIVideoQuality.kVideoQuality_720p <br/>
331
+ * - 1080p TUIVideoQuality.kVideoQuality_1080p <br/>
332
+ *
333
+ * @returns {Promise<void>}
382
334
  *
383
335
  * @example
384
336
  * const roomEngine = new TUIRoomEngine();
385
- * const requestId = await roomEngine.requestToOpenRemoteMicrophone({
386
- * userId: 'user_1234',
387
- * timeout: 0,
388
- * requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {
389
- * switch (requestCallbackType) {
390
- * case TUIRequestCallbackType.kRequestAccepted:
391
- * // 请求被接受
392
- * break;
393
- * case TUIRequestCallbackType.kRequestRejected:
394
- * // 请求被拒绝
395
- * break;
396
- * case TUIRequestCallbackType.kRequestCancelled:
397
- * // 请求已取消
398
- * break;
399
- * case TUIRequestCallbackType.kRequestTimeout:
400
- * // 请求超时
401
- * break;
402
- * case TUIRequestCallbackType.kRequestError:
403
- * // 请求错误
404
- * break;
405
- * default:
406
- * break;
407
- * }
408
- * },
337
+ * await roomEngine.updateVideoQuality({
338
+ * quality: TUIVideoQuality.kVideoQuality_360p,
409
339
  * });
410
340
  */
411
- requestToOpenRemoteMicrophone(options: {
412
- userId: string;
413
- timeout: number;
414
- requestCallback?: (callbackInfo: TUIRequestCallback) => void;
415
- }): Promise<string>;
341
+ updateVideoQuality(options: {
342
+ quality: TUIVideoQuality;
343
+ }): Promise<void>;
416
344
  /**
417
- * 关闭远端用户麦克风
345
+ * 设置本地音频的参数<br/>
346
+ * @param {object} options 设置本地音频的参数
347
+ * @param {TUIAudioQuality} options.quality
348
+ *
349
+ * - TUIAudioQuality.kAudioProfileSpeech:语言模式;采样率:16k<br/>
350
+ * - TUIAudioQuality.kAudioProfileDefault:标准模式(或者默认模式);采样率:48k<br/>
351
+ * - TUIAudioQuality.kAudioProfileMusic:音乐模式;采样率:48k
418
352
  *
419
- * @param {object} options 关闭远端用户麦克风, 仅房间主持人和管理员可调用此方法
420
- * @param {string} options.userId 用户 Id
421
353
  * @returns {Promise<void>}
422
354
  *
423
355
  * @example
424
356
  * const roomEngine = new TUIRoomEngine();
425
- * await roomEngine.closeRemoteMicrophone({
426
- * userId: 'user_1234',
357
+ * await roomEngine.updateAudioQuality({
358
+ * quality: TUIAudioQuality.kAudioProfileSpeech,
427
359
  * });
428
360
  */
429
- closeRemoteMicrophone(options: {
430
- userId: string;
361
+ updateAudioQuality(options: {
362
+ quality: TUIAudioQuality;
431
363
  }): Promise<void>;
432
364
  /**
433
- * 停止远端用户屏幕分享
434
- *
435
- * @param {object} options 停止远端用户屏幕分享, 仅房间主持人和管理员可调用此方法
436
- * @param {string} options.userId 用户 Id
365
+ * 开始向远端推本地视频流
437
366
  * @returns {Promise<void>}
438
367
  *
439
368
  * @example
440
369
  * const roomEngine = new TUIRoomEngine();
441
- * await roomEngine.stopRemoteScreenSharing({
442
- * userId: 'user_1234',
443
- * });
370
+ * await roomEngine.startPushLocalVideo();
444
371
  */
445
- stopRemoteScreenSharing(options: {
446
- userId: string;
447
- }): Promise<void>;
372
+ startPushLocalVideo(): Promise<void>;
448
373
  /**
449
- * 邀请其他人上麦
450
- * @param {object} options 邀请其他人上麦的参数
451
- * @param {number} options.seatIndex 麦位 index
452
- * @param {string} options.userId 用户 Id
453
- * @param {number} options.timeout 超时时间,设置为 0 时,无超时时间
454
- * @param {Function} options.requestCallback 请求回调,用来通知发起方请求被接受/拒绝/取消/超时/错误的回调
455
- * @returns {Promise<number>} <br/>
456
- * 该接口返回 requestId,用户可使用该 requestId 调用 cancelRequest 接口取消请求
374
+ * 停止向远端推本地视频流
375
+ * @returns {Promise<void>}
457
376
  *
458
377
  * @example
459
378
  * const roomEngine = new TUIRoomEngine();
460
- * const requestId = await roomEngine.requestRemoteUserOnSeat({
461
- * seatIndex: 0,
462
- * userId: 'user_1234',
463
- * timeout: 0,
464
- * requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {
465
- * switch (requestCallbackType) {
466
- * case TUIRequestCallbackType.kRequestAccepted:
467
- * // 请求被接受
468
- * break;
469
- * case TUIRequestCallbackType.kRequestRejected:
470
- * // 请求被拒绝
471
- * break;
472
- * case TUIRequestCallbackType.kRequestCancelled:
473
- * // 请求已取消
474
- * break;
475
- * case TUIRequestCallbackType.kRequestTimeout:
476
- * // 请求超时
477
- * break;
478
- * case TUIRequestCallbackType.kRequestError:
479
- * // 请求错误
480
- * break;
481
- * default:
482
- * break;
483
- * }
484
- * },
485
- * });
379
+ * await roomEngine.startPushLocalVideo();
486
380
  */
487
- requestRemoteUserOnSeat(options: {
488
- seatIndex: number;
489
- userId: string;
490
- timeout: number;
491
- requestCallback?: (callbackInfo: TUIRequestCallback) => void;
492
- }): Promise<string>;
381
+ stopPushLocalVideo(): Promise<void>;
493
382
  /**
494
- * 要求其他人下麦
495
- * @param {object} options 要求其他人下麦的参数
496
- * @param {number} options.seatIndex 麦位 index
497
- * @param {string} options.userId 用户 Id
383
+ * 开始向远端推本地音频流
498
384
  * @returns {Promise<void>}
499
385
  *
500
386
  * @example
501
387
  * const roomEngine = new TUIRoomEngine();
502
- * await roomEngine.kickRemoteUserOffSeat({
503
- * seatIndex: 0,
504
- * userId: 'user_1234',
505
- * });
388
+ * await roomEngine.startPushLocalAudio();
506
389
  */
507
- kickRemoteUserOffSeat(options: {
508
- seatIndex: number;
509
- userId: string;
510
- }): Promise<void>;
390
+ startPushLocalAudio(): Promise<void>;
511
391
  /**
512
- * 取消已经发出的请求
513
- * @param {object} options 取消已经发出请求的参数
514
- * @param {string} options.requestId 请求 Id
392
+ * 停止向远端推本地音频流
515
393
  * @returns {Promise<void>}
516
394
  *
517
395
  * @example
518
396
  * const roomEngine = new TUIRoomEngine();
519
- * await roomEngine.cancelRequest({
520
- * requestId: '', // 请使用实际 requestId
521
- * });
397
+ * await roomEngine.stopPushLocalAudio();
522
398
  */
523
- cancelRequest(options: {
524
- requestId: string;
525
- }): Promise<void>;
399
+ stopPushLocalAudio(): Promise<void>;
526
400
  /**
527
- * 回复远端用户的请求
528
- * @param {object} options 回复远端用户的请求的参数
529
- * @param {string} options.requestId 请求 Id
530
- * @param {boolean} options.agree 是否同意
401
+ * 设置远端流渲染的区域
402
+ *
403
+ * @param {object} options 设设置远端流渲染区域的参数
404
+ * @param {string} options.userId 用户 Id
405
+ * @param {TUIVideoStreamType} options.streamType 用户流类型
406
+ * @param {string} options.view 播放远端用户流的 div 元素的 id
531
407
  * @returns {Promise<void>}
532
408
  *
533
409
  * @example
534
410
  * const roomEngine = new TUIRoomEngine();
535
411
  *
536
- * // 同意远端的请求
537
- * await roomEngine.responseRemoteRequest({
538
- * requestId: '', // 请使用实际 requestId
539
- * agree: true,
412
+ * // 设置远端用户视频流在 id 为 'remote_preview_camera' 的区域播放
413
+ * roomEngine.setRemoteVideoView()({
414
+ * userId: 'user_1234',
415
+ * streamType: TUIVideoStreamType.kCameraStream,
416
+ * view: 'remote_preview_camera',
540
417
  * });
541
418
  *
542
- * // 拒绝远端的请求
543
- * await roomEngine.responseRemoteRequest({
544
- * requestId: '', // 请使用实际 requestId
545
- * agree: false,
419
+ * // 设置远端用户屏幕分享流在 id 为 'remote_preview_screen' 的区域播放
420
+ * roomEngine.setRemoteVideoView()({
421
+ * userId: 'user_1234',
422
+ * streamType: TUIVideoStreamType.kScreenStream,
423
+ * view: 'remote_preview_screen',
546
424
  * });
547
425
  */
548
- responseRemoteRequest(options: {
549
- requestId: string;
550
- agree: boolean;
551
- }): Promise<any>;
426
+ setRemoteVideoView(options: {
427
+ userId: string;
428
+ streamType: TUIVideoStreamType;
429
+ view: string;
430
+ }): Promise<void>;
552
431
  /**
553
- * 设置本地流的渲染位置
554
- * @param {object} options 设置本地流的渲染位置的参数
555
- * @param {TUIVideoStreamType} options.streamType 本地流类型
556
- * @param {string} options.view streamType 对应的流渲染的 div 元素的 id
432
+ * 开始播放远端用户视频流
433
+ *
434
+ * @param {object} options 开始播放远端用户视频流的参数
435
+ * @param {string} options.userId 用户 Id
436
+ * @param {TUIVideoStreamType} options.streamType 用户流类型
557
437
  * @returns {Promise<void>}
558
438
  *
559
439
  * @example
560
440
  * const roomEngine = new TUIRoomEngine();
561
- *
562
- * // 设置本地摄像头流的播放区域为 id 是 'preview-camera' 的 div 元素
563
- * await roomEngine.setLocalRenderView({
441
+ * await roomEngine.startPlayRemoteVideo({
442
+ * userId: 'user_1234',
564
443
  * streamType: TUIVideoStreamType.kCameraStream,
565
- * view: 'preview-camera',
566
- * });
567
- *
568
- * // 设置本地屏幕分享流的播放区域为 id 是 'preview-screen' 的 div 元素
569
- * await roomEngine.setLocalRenderView({
570
- * streamType: TUIVideoStreamType.kScreenStream,
571
- * view: 'preview-screen',
572
444
  * });
573
445
  */
574
- setLocalRenderView(options: {
446
+ startPlayRemoteVideo(options: {
447
+ userId: string;
575
448
  streamType: TUIVideoStreamType;
576
- view: string;
577
449
  }): Promise<void>;
578
450
  /**
579
- * 打开本地摄像头,开始视频流采集
451
+ * 停止播放远端用户视频流
452
+ *
453
+ * @param {object} options 停止播放远端用户视频流的参数
454
+ * @param {string} options.userId 用户 Id
455
+ * @param {TUIVideoStreamType} options.streamType 用户流类型<br/>
456
+ *
457
+ * - TUIVideoStreamType.kCameraStream 视频流<br/>
458
+ * - TUIVideoStreamType.kScreenStream 屏幕分享流<br/>
459
+ * - TUIVideoStreamType.kCameraStreamLow 低清视频流
460
+ *
580
461
  * @returns {Promise<void>}
581
462
  *
582
463
  * @example
583
464
  * const roomEngine = new TUIRoomEngine();
584
- * await roomEngine.setLocalRenderView({
585
- * streamType: TUIVideoStreamType.kScreenStream,
586
- * view: 'preview-screen',
465
+ * await roomEngine.stopPlayRemoteVideo({
466
+ * userId: 'user_1234',
467
+ * streamType: TUIVideoStreamType.kCameraStream,
587
468
  * });
588
- * await roomEngine.openLocalCamera();
589
469
  */
590
- openLocalCamera(): Promise<void>;
470
+ stopPlayRemoteVideo(options: {
471
+ userId: string;
472
+ streamType: TUIVideoStreamType;
473
+ }): Promise<void>;
591
474
  /**
592
- * 关闭本地摄像头
475
+ * 停止远端用户的音频流
476
+ * @param {object} options 停止远端用户音频流的参数
477
+ * @param {string} options.userId 停止远端用户的userId
478
+ * @param {boolean} options.isMute 是否停止远端用户的音频
593
479
  * @returns {Promise<void>}
594
480
  *
595
481
  * @example
596
482
  * const roomEngine = new TUIRoomEngine();
597
- * await roomEngine.closeLocalCamera();
483
+ * await roomEngine.muteRemoteAudioStream({
484
+ * userId: 'user_1234',
485
+ * isMute: true,
486
+ * });
598
487
  */
599
- closeLocalCamera(): Promise<void>;
488
+ muteRemoteAudioStream(options: {
489
+ userId: string;
490
+ isMute: boolean;
491
+ }): Promise<void>;
600
492
  /**
601
- * 打开本地麦克风, 开始采集音频流
602
- * @returns {Promise<void>}
493
+ * 请求远端用户打开媒体设备
494
+ * @param {object} options 请求远端用户打开摄像头的参数
495
+ * @param {string} options.userId 用户 Id
496
+ * @param {TUIMediaDevice} options.device 请求的设备
497
+ * @param {number} options.timeout 超时时间。若 timeout 设置为 0 ,则无超时时间
498
+ * @param {Function} 请求回调,用来通知发起方请求被接受/拒绝/取消/超时/错误的回调
499
+ * @return {Promise<number>} <br/>
500
+ * 该接口返回 requestId,用户可使用该 requestId 调用 cancelRequest 接口取消请求
603
501
  *
604
502
  * @example
605
503
  * const roomEngine = new TUIRoomEngine();
606
- * await roomEngine.openLocalMicrophone();
504
+ * const requestId = roomEngine.openRemoteDeviceByAdmin({
505
+ * userId: 'user_1234',
506
+ * device: TUIMediaDevice.kMicrophone //请求的设备为麦克风
507
+ * timeout: 0,
508
+ * requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {
509
+ * switch (requestCallbackType) {
510
+ * case TUIRequestCallbackType.kRequestAccepted:
511
+ * // 请求被接受
512
+ * break;
513
+ * case TUIRequestCallbackType.kRequestRejected:
514
+ * // 请求被拒绝
515
+ * break;
516
+ * case TUIRequestCallbackType.kRequestCancelled:
517
+ * // 请求已取消
518
+ * break;
519
+ * case TUIRequestCallbackType.kRequestTimeout:
520
+ * // 请求超时
521
+ * break;
522
+ * case TUIRequestCallbackType.kRequestError:
523
+ * // 请求错误
524
+ * break;
525
+ * default:
526
+ * break;
527
+ * }
528
+ * },
529
+ * });
607
530
  */
608
- openLocalMicrophone(): Promise<void>;
531
+ openRemoteDeviceByAdmin(options: {
532
+ userId: string;
533
+ device: TUIMediaDevice;
534
+ timeout: number;
535
+ requestCallback?: (callbackInfo: TUIRequestCallback) => void;
536
+ }): Promise<TUIRequest>;
609
537
  /**
610
- * 关闭本地麦克风, 停止采集音频流
611
- * @returns {Promise<void>}
538
+ * 参会者向主持人申请打开设备
539
+ *
540
+ * @param {object} options 请求远端用户打开摄像头的参数
541
+ * @param {TUIMediaDevice} options.device 请求的设备
542
+ * @param {number} options.timeout 超时时间。若 timeout 设置为 0 ,则无超时时间
543
+ * @param {Function} 请求回调,用来通知发起方请求被接受/拒绝/取消/超时/错误的回调
544
+ * @return {Promise<number>} <br/>
545
+ * 该接口返回 requestId,用户可使用该 requestId 调用 cancelRequest 接口取消请求
612
546
  *
613
547
  * @example
614
548
  * const roomEngine = new TUIRoomEngine();
615
- * await roomEngine.closeLocalMicrophone();
549
+ * const requestId = roomEngine.applyToAdminToOpenLocalDevice({
550
+ * device: TUIMediaDevice.kMicrophone, //请求打开麦克风
551
+ * timeout: 0,
552
+ * requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {
553
+ * switch (requestCallbackType) {
554
+ * case TUIRequestCallbackType.kRequestAccepted:
555
+ * // 请求被接受
556
+ * break;
557
+ * case TUIRequestCallbackType.kRequestRejected:
558
+ * // 请求被拒绝
559
+ * break;
560
+ * case TUIRequestCallbackType.kRequestCancelled:
561
+ * // 请求已取消
562
+ * break;
563
+ * case TUIRequestCallbackType.kRequestTimeout:
564
+ * // 请求超时
565
+ * break;
566
+ * case TUIRequestCallbackType.kRequestError:
567
+ * // 请求错误
568
+ * break;
569
+ * default:
570
+ * break;
571
+ * }
572
+ * },
573
+ * });
616
574
  */
617
- closeLocalMicrophone(): Promise<void>;
575
+ applyToAdminToOpenLocalDevice(options: {
576
+ device: TUIMediaDevice;
577
+ timeout: number;
578
+ requestCallback?: (callbackInfo: TUIRequestCallback) => void;
579
+ }): Promise<TUIRequest>;
618
580
  /**
619
- * 设置本地视频的参数
620
- * @param {object} options 设置本地视频的参数
621
- * @param {TUIVideoProfile} options.videoProfile
622
- *
623
- * - 清晰 TUIVideoProfile.kLowDefinition <br/>
624
- * - 标清 TUIVideoProfile.kStandardDefinition <br/>
625
- * - 高清 TUIVideoProfile.kHighDefinition <br/>
626
- * - 超清 TUIVideoProfile.kSuperDefinition <br/>
581
+ * 关闭远端用户媒体设备
627
582
  *
583
+ * @param {object} options 关闭远端用户摄像头的参数
584
+ * @param {string} options.userId 用户 Id
585
+ * @param {TUIMediaDevice} options.device 用户 Id
628
586
  * @returns {Promise<void>}
629
587
  *
630
588
  * @example
631
589
  * const roomEngine = new TUIRoomEngine();
632
- * await roomEngine.setLocalVideoProfile({
633
- * videoProfile: TUIVideoProfile.kHighDefinition,
590
+ * await roomEngine.closeRemoteDeviceByAdmin({
591
+ * userId: 'user_1234',
592
+ * device: TUIMediaDevice.kMicrophone, //关闭掉麦克风
634
593
  * });
635
594
  */
636
- setLocalVideoProfile(options: {
637
- videoProfile: TUIVideoProfile;
595
+ closeRemoteDeviceByAdmin(options: {
596
+ userId: string;
597
+ device: TUIMediaDevice;
638
598
  }): Promise<void>;
639
599
  /**
640
- * 设置本地音频的参数<br/>
641
- * 注意:该方法需要在 openLocalMicrophone 之前进行设置,否则不会生效。
642
- * @param {object} options 设置本地音频的参数
643
- * @param {TUIAudioProfile} options.audioProfile
644
- *
645
- * - TUIAudioProfile.kAudioProfileSpeech:语言模式;采样率:16k<br/>
646
- * - TUIAudioProfile.kAudioProfileDefault:标准模式(或者默认模式);采样率:48k<br/>
647
- * - TUIAudioProfile.kAudioProfileMusic:音乐模式;采样率:48k
648
- *
600
+ * 取消已经发出的请求
601
+ * @param {object} options 取消已经发出请求的参数
602
+ * @param {string} options.requestId 请求 Id
649
603
  * @returns {Promise<void>}
650
604
  *
651
605
  * @example
652
606
  * const roomEngine = new TUIRoomEngine();
653
- * await roomEngine.setLocalAudioProfile({
654
- * audioProfile: TUIAudioProfile.kAudioProfileSpeech,
607
+ * await roomEngine.cancelRequest({
608
+ * requestId: '', // 请使用实际 requestId
655
609
  * });
656
610
  */
657
- setLocalAudioProfile(options: {
658
- audioProfile: TUIAudioProfile;
611
+ cancelRequest(options: {
612
+ requestId: string;
659
613
  }): Promise<void>;
660
614
  /**
661
- * 开始向远端推本地视频流
615
+ * 回复远端用户的请求
616
+ * @param {object} options 回复远端用户的请求的参数
617
+ * @param {string} options.requestId 请求 Id
618
+ * @param {boolean} options.agree 是否同意
662
619
  * @returns {Promise<void>}
663
620
  *
664
621
  * @example
665
622
  * const roomEngine = new TUIRoomEngine();
666
- * await roomEngine.startPushLocalVideo();
623
+ *
624
+ * // 同意远端的请求
625
+ * await roomEngine.responseRemoteRequest({
626
+ * requestId: '', // 请使用实际 requestId
627
+ * agree: true,
628
+ * });
629
+ *
630
+ * // 拒绝远端的请求
631
+ * await roomEngine.responseRemoteRequest({
632
+ * requestId: '', // 请使用实际 requestId
633
+ * agree: false,
634
+ * });
667
635
  */
668
- startPushLocalVideo(): Promise<void>;
636
+ responseRemoteRequest(options: {
637
+ requestId: string;
638
+ agree: boolean;
639
+ }): Promise<any>;
669
640
  /**
670
- * 停止向远端推本地视频流
641
+ * 禁止/允许所有用户打开媒体设备(此接口对于房主和管理员无效)
642
+ * @param {object} options
643
+ * @param {TUIMediaDevice} options.device 操作的媒体设备
644
+ * @param {boolean} options.isDisable 是否被禁止
671
645
  * @returns {Promise<void>}
672
- *
673
646
  * @example
674
- * const roomEngine = new TUIRoomEngine();
675
- * await roomEngine.startPushLocalVideo();
647
+ * // Example 1: 禁止所有用户打开麦克风
648
+ * await roomEngine.disableDeviceForAllUserByAdmin({
649
+ * device: TUIMediaDevice.kMicrophone,
650
+ * isDisable: true,
651
+ * })
652
+ * // Example 2: 允许所有用户打开麦克风
653
+ * await roomEngine.disableDeviceForAllUserByAdmin({
654
+ * device: TUIMediaDevice.kMicrophone,
655
+ * isDisable: false,
656
+ * })
676
657
  */
677
- stopPushLocalVideo(): Promise<void>;
658
+ disableDeviceForAllUserByAdmin(options: {
659
+ device: TUIMediaDevice;
660
+ isDisable: boolean;
661
+ }): Promise<void>;
678
662
  /**
679
- * 开始向远端推本地音频流
663
+ * 禁止/允许所有用户发送消息
664
+ * @param {object} options
665
+ * @param {boolean} options.isDisable 是否被禁止
680
666
  * @returns {Promise<void>}
681
- *
682
667
  * @example
683
- * const roomEngine = new TUIRoomEngine();
684
- * await roomEngine.startPushLocalAudio();
668
+ * await roomEngine.disableSendingMessageForAllUser({
669
+ * isDisable: true,
670
+ * })
671
+
685
672
  */
686
- startPushLocalAudio(): Promise<void>;
673
+ disableSendingMessageForAllUser(options: {
674
+ isDisable: boolean;
675
+ }): Promise<void>;
687
676
  /**
688
- * 停止向远端推本地音频流
677
+ * 禁止/允许某个用户发送消息
678
+ * @param {object} options
679
+ * @param {string} options.userId 用户的 Id
680
+ * @param {boolean} options.isDisable 是否被禁止
689
681
  * @returns {Promise<void>}
690
- *
691
682
  * @example
692
- * const roomEngine = new TUIRoomEngine();
693
- * await roomEngine.stopPushLocalAudio();
683
+ * await roomEngine.disableSendingMessageByAdmin({
684
+ * userId: 'user_1234',
685
+ * isDisable: true,
686
+ * })
694
687
  */
695
- stopPushLocalAudio(): Promise<void>;
688
+ disableSendingMessageByAdmin(options: {
689
+ userId: string;
690
+ isDisable: boolean;
691
+ }): Promise<void>;
696
692
  /**
697
- * 设置远端流渲染的区域
698
- *
699
- * @param {object} options 设设置远端流渲染区域的参数
693
+ * 改变用户的角色,仅主持人可调用该接口
694
+ * @param {object} options 改变用户的角色,仅主持人可调用该接口的参数
700
695
  * @param {string} options.userId 用户 Id
701
- * @param {TUIVideoStreamType} options.streamType 用户流类型
702
- * @param {string} options.view 播放远端用户流的 div 元素的 id
696
+ * @param {TUIRole} options.userRole 用户角色
703
697
  * @returns {Promise<void>}
704
698
  *
705
699
  * @example
706
700
  * const roomEngine = new TUIRoomEngine();
707
- *
708
- * // 设置远端用户视频流在 id 为 'remote_preview_camera' 的区域播放
709
- * roomEngine.setRemoteRenderView({
701
+ * // 将房间移交给用户 user_1234
702
+ * await roomEngine.changeUserRole({
710
703
  * userId: 'user_1234',
711
- * streamType: TUIVideoStreamType.kCameraStream,
712
- * view: 'remote_preview_camera',
704
+ * userRole: TUIRole.kRoomOwner,
713
705
  * });
714
706
  *
715
- * // 设置远端用户屏幕分享流在 id 为 'remote_preview_screen' 的区域播放
716
- * roomEngine.setRemoteRenderView({
707
+ * // 将用户 user_1234 设置为房间管理员
708
+ * await roomEngine.changeUserRole({
717
709
  * userId: 'user_1234',
718
- * streamType: TUIVideoStreamType.kScreenStream,
719
- * view: 'remote_preview_screen',
710
+ * userRole: TUIRole.kAdministrator,
720
711
  * });
721
712
  */
722
- setRemoteRenderView(options: {
713
+ changeUserRole(options: {
723
714
  userId: string;
724
- streamType: TUIVideoStreamType;
725
- view: string;
715
+ userRole: TUIRole;
726
716
  }): Promise<void>;
727
717
  /**
728
- * 开始播放远端用户视频流
729
- *
730
- * @param {object} options 开始播放远端用户视频流的参数
718
+ * 将用户踢出房间,仅主持人和管理员可调用该接口
719
+ * @param {object} options
731
720
  * @param {string} options.userId 用户 Id
732
- * @param {TUIVideoStreamType} options.streamType 用户流类型
733
721
  * @returns {Promise<void>}
734
722
  *
735
723
  * @example
736
724
  * const roomEngine = new TUIRoomEngine();
737
- * await roomEngine.startPlayRemoteVideo({
725
+ * await roomEngine.kickRemoteUserOutOfRoom({
738
726
  * userId: 'user_1234',
739
- * streamType: TUIVideoStreamType.kCameraStream,
740
727
  * });
741
728
  */
742
- startPlayRemoteVideo(options: {
729
+ kickRemoteUserOutOfRoom(options: {
743
730
  userId: string;
744
- streamType: TUIVideoStreamType;
745
731
  }): Promise<void>;
746
732
  /**
747
- * 停止播放远端用户视频流
748
- *
749
- * @param {object} options 停止播放远端用户视频流的参数
750
- * @param {string} options.userId 用户 Id
751
- * @param {TUIVideoStreamType} options.streamType 用户流类型<br/>
752
- *
753
- * - TUIVideoStreamType.kCameraStream 视频流<br/>
754
- * - TUIVideoStreamType.kScreenStream 屏幕分享流<br/>
755
- * - TUIVideoStreamType.kCameraStreamLow 低清视频流
756
- *
733
+ * 设置房间麦位最大值
734
+ * @param {object} options
735
+ * @param {number} options.maxSeatCount 设置房间麦位最大值<br/>
736
+ * roomType TUIRoomType.kConference (教育及会议场景) 时,maxSeatCount 值不做限制;
737
+ * roomType TUIRoomType.kLivingRoom (直播场景) 时,maxSeatCount 最大限制为 16;
757
738
  * @returns {Promise<void>}
739
+ * const roomEngine = new TUIRoomEngine();
740
+ * await roomEngine.createRoom({ roomId: '12345' });
741
+ * await roomEngine.setMaxSeatCount({ maxSeatCount: 16 })
742
+ */
743
+ setMaxSeatCount(options: {
744
+ maxSeatCount: number;
745
+ }): Promise<void>;
746
+ /**
747
+ * 获取麦位列表
748
+ * @returns {Promise<TUISeatInfo[]>}
758
749
  *
759
750
  * @example
760
751
  * const roomEngine = new TUIRoomEngine();
761
- * await roomEngine.stopPlayRemoteVideo({
762
- * userId: 'user_1234',
763
- * streamType: TUIVideoStreamType.kCameraStream,
764
- * });
752
+ * const seatList = await roomEngine.getSeatList();
753
+ * ;
765
754
  */
766
- stopPlayRemoteVideo(options: {
767
- userId: string;
768
- streamType: TUIVideoStreamType;
769
- }): Promise<void>;
755
+ getSeatList(): Promise<TUISeatInfo[]>;
770
756
  /**
771
- * 改变用户的角色,仅主持人可调用该接口
772
- * @param {object} options 改变用户的角色,仅主持人可调用该接口的参数
773
- * @param {string} options.userId 用户 Id
774
- * @param {TUIRole} options.role 用户角色
775
- * @returns {Promise<void>}
757
+ * 麦下用户可调用 takeSeat 成为麦上用户,仅麦上用户可发布本地音视频流。<br/>
758
+ * 主持人&管理员调用 takeSeat 成功后即为麦上用户。<br/>
759
+ * roomInfo.SpeechMode TUISpeechMode.kFreeToSpeak 模式时,普通用户调用 takeSeat 方法成功后即为麦上用户。<br/>
760
+ * roomInfo.SpeechMode TUISpeechMode.kSpeakAfterTakingSeat 模式时,普通用户调用 takeSeat 方法需要等待主持人/管理员的同意后成为麦上用户。<br/>
761
+ * 麦上用户的变更通过 TUIRoomEvents.onSeatListChanged 通知所有用户。<br/>
762
+ * @param {object} options 获取麦位的参数
763
+ * @param {number} options.seatIndex 麦位 index, 无麦位序号时设置为 -1
764
+ * @param {number} options.timeout 超时时间。若 timeout 设置为 0,则无超时时间
765
+ * @param {Function} options.requestCallback 请求回调,用来通知发起方请求被接受/拒绝/取消/超时/错误的回调
766
+ * @returns {Promise<number>} <br/>
767
+ * 该接口返回 request 结构体,当 request.requestId 不为 '' 时,用户可调用 cancelRequest 接口取消上麦请求。
776
768
  *
777
769
  * @example
778
770
  * const roomEngine = new TUIRoomEngine();
779
- * // 将房间移交给用户 user_1234
780
- * await roomEngine.changeUserRole({
781
- * userId: 'user_1234',
782
- * role: TUIRole.kRoomOwner,
771
+ *
772
+ * // 情景一:主持人/管理员上麦
773
+ * // 情景二:roomInfo.SpeechMode 为 TUISpeechMode.kFreeToSpeak 模式时,普通用户上麦
774
+ * await roomEngine.takeSeat({
775
+ * seatIndex: -1,
776
+ * timeout: 0,
777
+ * });
778
+ *
779
+ * // 情景三:roomInfo.SpeechMode 为 TUISpeechMode.kSpeakAfterTakingSeat 模式时,普通用户上麦
780
+ * const request = await roomEngine.instance?.takeSeat({
781
+ * seatIndex: -1,
782
+ * timeout: 0,
783
+ * requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {
784
+ * switch (requestCallbackType) {
785
+ * case TUIRequestCallbackType.kRequestAccepted:
786
+ * // 请求被接受
787
+ * break;
788
+ * case TUIRequestCallbackType.kRequestRejected:
789
+ * // 请求被拒绝
790
+ * break;
791
+ * case TUIRequestCallbackType.kRequestCancelled:
792
+ * // 请求已取消
793
+ * break;
794
+ * case TUIRequestCallbackType.kRequestTimeout:
795
+ * // 请求超时
796
+ * break;
797
+ * case TUIRequestCallbackType.kRequestError:
798
+ * // 请求错误
799
+ * break;
800
+ * default:
801
+ * break;
802
+ * }
803
+ * },
783
804
  * });
784
805
  */
785
- changeUserRole(options: {
786
- userId: string;
787
- role: TUIRole;
788
- }): Promise<void>;
806
+ takeSeat(options: {
807
+ seatIndex: number;
808
+ timeout: number;
809
+ requestCallback?: (callbackInfo: TUIRequestCallback) => void;
810
+ }): Promise<TUIRequest>;
789
811
  /**
790
- * 禁止远端用户发送消息,仅主持人和管理员可调用该接口
791
- * @param {object} options
792
- * @param {string} options.userId 远端用户 userId
793
- * @param {number} options.duration 禁止时长,单位秒。如设为 1000,则表示从现在起禁言该用户 1000 秒
812
+ * 离开麦位
794
813
  * @returns {Promise<void>}
795
814
  *
796
815
  * @example
797
816
  * const roomEngine = new TUIRoomEngine();
798
- * await roomEngine.muteRemoteUser({
799
- * userId: 'user_1234',
800
- * duration: 1000,
817
+ * await roomEngine.leaveSeat();
818
+ */
819
+ leaveSeat(): Promise<void>;
820
+ /**
821
+ * 邀请其他人上麦(仅房间主持人和管理员可调用此方法)
822
+ * @param {object} options 邀请其他人上麦的参数
823
+ * @param {number} options.seatIndex 麦位 index, roomType 为 TUIRoomType.kConference 时无需关心,填 -1 即可
824
+ * @param {string} options.userId 用户 Id
825
+ * @param {number} options.timeout 超时时间,设置为 0 时,无超时时间
826
+ * @param {Function} options.requestCallback 请求回调,用来通知发起方请求被接受/拒绝/取消/超时/错误的回调
827
+ * @returns {Promise<number>} <br/>
828
+ * 该接口返回 requestId,用户可使用该 requestId 调用 cancelRequest 接口取消请求
829
+ *
830
+ * @example
831
+ * const roomEngine = new TUIRoomEngine();
832
+ * const requestId = await roomEngine.takeUserOnSeatByAdmin({
833
+ * seatIndex: 0,
834
+ * userId: 'user_1234',
835
+ * timeout: 0,
836
+ * requestCallback: ({ requestCallbackType, requestId, userId, code, message }) => {
837
+ * switch (requestCallbackType) {
838
+ * case TUIRequestCallbackType.kRequestAccepted:
839
+ * // 请求被接受
840
+ * break;
841
+ * case TUIRequestCallbackType.kRequestRejected:
842
+ * // 请求被拒绝
843
+ * break;
844
+ * case TUIRequestCallbackType.kRequestCancelled:
845
+ * // 请求已取消
846
+ * break;
847
+ * case TUIRequestCallbackType.kRequestTimeout:
848
+ * // 请求超时
849
+ * break;
850
+ * case TUIRequestCallbackType.kRequestError:
851
+ * // 请求错误
852
+ * break;
853
+ * default:
854
+ * break;
855
+ * }
856
+ * },
801
857
  * });
802
858
  */
803
- muteRemoteUser(options: {
859
+ takeUserOnSeatByAdmin(options: {
860
+ seatIndex: number;
804
861
  userId: string;
805
- duration: number;
806
- }): Promise<void>;
862
+ timeout: number;
863
+ requestCallback?: (callbackInfo: TUIRequestCallback) => void;
864
+ }): Promise<TUIRequest>;
807
865
  /**
808
- * 取消禁止远端用户发送消息,仅主持人和管理员可调用该接口
809
- * @param {object} options
810
- * @param {string} options.userId 远端用户 userId
866
+ * 将其他人踢下麦(仅房间主持人和管理员可调用此方法)
867
+ * @param {object} options 要求其他人下麦的参数
868
+ * @param {number} options.seatIndex 麦位 index
869
+ * @param {string} options.userId 用户 Id
811
870
  * @returns {Promise<void>}
812
871
  *
813
872
  * @example
814
873
  * const roomEngine = new TUIRoomEngine();
815
- * await roomEngine.unmuteRemoteUser({
816
- * userId: 'user_1234',
874
+ * await roomEngine.kickUserOffSeatByAdmin({
875
+ * seatIndex: 0,
876
+ * userId: 'user_1234',
817
877
  * });
818
878
  */
819
- unmuteRemoteUser(options: {
879
+ kickUserOffSeatByAdmin(options: {
880
+ seatIndex: number;
820
881
  userId: string;
821
882
  }): Promise<void>;
822
883
  /**
823
- * 将用户踢出房间,仅主持人和管理员可调用该接口
824
- * @param {object} options
825
- * @param {string} options.userId 用户 Id
884
+ * 锁定某个麦位状态(仅房间主持人和管理员可调用此方法)
885
+ *
886
+ * @param {object} options 锁定某个麦位需要的参数
887
+ * @param {number} options.seatIndex 麦位索引
888
+ * @param {TUISeatLockParams} options.lockParams 锁麦参数
826
889
  * @returns {Promise<void>}
827
890
  *
828
891
  * @example
829
892
  * const roomEngine = new TUIRoomEngine();
830
- * await roomEngine.kickOutRemoteUser({
831
- * userId: 'user_1234',
893
+ * await roomEngine.lockSeatByAdmin({
894
+ * seatIndex: -1,
895
+ * lockParams: {
896
+ * lockSeat: true,
897
+ * lockVideo: true,
898
+ * lockAudio: true,
899
+ * }
832
900
  * });
833
901
  */
834
- kickOutRemoteUser(options: {
835
- userId: string;
836
- }): Promise<void>;
902
+ lockSeatByAdmin(options: {
903
+ seatIndex: number;
904
+ lockParams: TUISeatLockParams;
905
+ }): Promise<any>;
837
906
  /**
838
907
  * 发送文本消息
839
908
  * @param {object} options
@@ -969,7 +1038,7 @@ declare class TUIRoomEngine {
969
1038
  * console.info("camera deviceName: " + camera.deviceName + " deviceId:" + camera.deviceId);
970
1039
  * }
971
1040
  */
972
- getCameraDevicesList(): Promise<any>;
1041
+ getCameraDevicesList(): Promise<TRTCDeviceInfo[]>;
973
1042
  /**
974
1043
  * 获取麦克风设备列表<br>
975
1044
  * @returns {Promise<TRTCDeviceInfo[]>} 麦克风列表