@tencentcloud/tuiroom-engine-js 3.2.1 → 3.2.2

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.
@@ -0,0 +1,163 @@
1
+ import { TUIConferenceInvitationManagerEvents, TUIInvitationRejectedReason, TUIInvitation } from '../types';
2
+ import Logger from '../utils/logger';
3
+ /**
4
+ * 会中呼叫
5
+ * @class conferenceInvitationManager
6
+ */
7
+ declare class TUIConferenceInvitationManager {
8
+ private conferenceInvitationManagerWASM;
9
+ private logger;
10
+ private static conferenceInvitationManager;
11
+ constructor(options: {
12
+ Module: any;
13
+ logger: Logger;
14
+ roomEngineWASM: any;
15
+ });
16
+ /**
17
+ * @private
18
+ * 调用 TUIRoomEngineWASM 的异步方法
19
+ * @param funcName
20
+ * @param args
21
+ */
22
+ private JSCallNativeFunctionPromise;
23
+ /**
24
+ * 会中呼叫
25
+ * @param {object} options
26
+ * @param {string} options.roomId 房间 Id,必填, roomId 限制长度为64字节,且仅支持以下范围的字符集:<br>
27
+ * - 大小写英文字母(a-zA-Z)
28
+ * - 数字(0-9)
29
+ * - 空格 ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
30
+ * @param {string} options.userIdList 成员 userId 列表。
31
+ * @param {number} options.timeout 超时时间。若 timeout 设置为 0s ,则无超时时间
32
+ * @param {string} options.extensionInfo 自定义扩展信息
33
+ * @returns {Promise<void>}
34
+ *
35
+ * @example
36
+ * const roomEngine = new TUIRoomEngine();
37
+ * const conferenceInvitationManager = roomEngine.getConferenceInvitationManager();
38
+ * await conferenceInvitationManager.inviteUsers({
39
+ * roomId: '12345', // 填入您的房间 Id, 注意房间 Id 要求为字符串类型
40
+ * userIdList: ['123'], // 填入您要呼叫的成员 Id 数组。
41
+ * timeout: 0,
42
+ * })
43
+ */
44
+ inviteUsers(options: {
45
+ roomId: string;
46
+ userIdList: string[];
47
+ timeout: number;
48
+ extensionInfo?: string;
49
+ }): Promise<void>;
50
+ /**
51
+ * 取消呼叫
52
+ *
53
+ * @param {object} options
54
+ * @param {string} options.roomId 会议的房间Id。
55
+ * @param {string} options.userIdList 成员 userId 列表。
56
+ * @returns {Promise<void>}
57
+ *
58
+ * @example
59
+ * const roomEngine = new TUIRoomEngine();
60
+ * const conferenceInvitationManager = roomEngine.getConferenceInvitationManager();
61
+ * await conferenceInvitationManager.cancelInvitation({
62
+ * roomId: '12345', // 填入您的房间 Id, 注意房间 Id 要求为字符串类型
63
+ * userIdList: ['123'], // 填入您要取消呼叫的成员 Id 数组。
64
+ * })
65
+ */
66
+ cancelInvitation(options: {
67
+ roomId: string;
68
+ userIdList: string[];
69
+ }): Promise<void>;
70
+ /**
71
+ * 接受呼叫
72
+ *
73
+ * @param {object} options
74
+ * @param {string} options.roomId 会议的房间Id。
75
+ * @returns {Promise<void>}
76
+ *
77
+ * @example
78
+ * const roomEngine = new TUIRoomEngine();
79
+ * const conferenceInvitationManager = roomEngine.getConferenceInvitationManager();
80
+ * await conferenceInvitationManager.accept({
81
+ * roomId: '12345', // 填入您的房间 Id, 注意房间 Id 要求为字符串类型
82
+ * })
83
+ */
84
+ accept(options: {
85
+ roomId: string;
86
+ }): Promise<void>;
87
+ /**
88
+ * 拒绝呼叫
89
+ *
90
+ * @param {object} options
91
+ * @param {string} options.roomId 会议的房间Id。
92
+ * @param {TUIInvitationRejectedReason}options.reason 拒绝邀请的原因
93
+ * @returns {Promise<void>}
94
+ *
95
+ * @example
96
+ * const roomEngine = new TUIRoomEngine();
97
+ * const conferenceInvitationManager = roomEngine.getConferenceInvitationManager();
98
+ * await conferenceInvitationManager.reject({
99
+ * roomId: '12345', // 填入您的房间 Id, 注意房间 Id 要求为字符串类型
100
+ * reason: TUIInvitationRejectedReason.kRejectToEnter, // 主动拒绝进入会议
101
+ * })
102
+ */
103
+ reject(options: {
104
+ roomId: string;
105
+ reason: TUIInvitationRejectedReason;
106
+ }): Promise<void>;
107
+ /**
108
+ * 获取呼叫列表
109
+ *
110
+ * @param {object} options
111
+ * @param {string} options.roomId 会议的房间Id。
112
+ * @param {string} options.cursor 分页获取索引,第一次拉取填 "",回调成功 如果 callback 返回的数据中 cursor 不为"",表示需要分页,请以返回的 cursor 作为参数再次调用接口拉取,直至返回的 cursor 为"",表示数据已经全部拉取。
113
+ * @param {string} options.count 本次拉取数量。
114
+ * @returns {Promise<Array<TUIInvitation>>}
115
+ *
116
+ * @example
117
+ * const roomEngine = new TUIRoomEngine();
118
+ * const conferenceInvitationManager = roomEngine.getConferenceInvitationManager();
119
+ * const invitationList = [];
120
+ * let result;
121
+ * let cursor = '';
122
+ * let totalCount = 0;
123
+ * let roomId = '12345';
124
+ * let count = 20;
125
+ * do {
126
+ * result = await conferenceInvitationManager.getInvitationList({ roomId, cursor, count });
127
+ * attendeeList.push(...result.attendeeList);
128
+ * cursor = result.cursor;
129
+ * totalCount = result.totalCount;
130
+ * } while (cursor !== '')
131
+ */
132
+ getInvitationList(options: {
133
+ roomId: string;
134
+ cursor: string;
135
+ count: number;
136
+ }): Promise<Array<TUIInvitation>>;
137
+ /**
138
+ * 监听 conferenceInvitationManager 的事件
139
+ * @param event TUIConferenceListManagerEvents
140
+ * @param func function
141
+ * @returns {void}
142
+ *
143
+ * @example
144
+ * const roomEngine = new TUIRoomEngine();
145
+ * const conferenceInvitationManager = roomEngine.getConferenceInvitationManager();
146
+ * conferenceInvitationManager.on(event, func);
147
+ */
148
+ on(event: TUIConferenceInvitationManagerEvents, func: (...args: any[]) => void): void;
149
+ private observerFunction;
150
+ /**
151
+ * 取消监听 ConferenceInvitationManager 的事件
152
+ * @param event TUIConferenceListManagerEvents
153
+ * @param func function
154
+ * @returns {void}
155
+ *
156
+ * @example
157
+ * const roomEngine = new TUIRoomEngine();
158
+ * const conferenceInvitationManager = roomEngine.getConferenceInvitationManager();
159
+ * conferenceInvitationManager.off(event, func);
160
+ */
161
+ off(event: string, func: (...args: any[]) => void): void;
162
+ }
163
+ export default TUIConferenceInvitationManager;
@@ -0,0 +1,244 @@
1
+ import { TUIRoomType, TUISeatMode, TUIConferenceListManagerEvents, TUIConferenceInfo, TUIUserInfo, TUIConferenceStatus } from '../types';
2
+ import Logger from '../utils/logger';
3
+ /**
4
+ * 会议列表
5
+ * @class conferenceListManager
6
+ */
7
+ declare class TUIConferenceListManager {
8
+ private static readonly ROOM_NAME;
9
+ private static readonly SCHEDULED_START_TIME;
10
+ private static readonly SCHEDULED_END_TIME;
11
+ private conferenceListManagerWASM;
12
+ private logger;
13
+ private static conferenceListManager;
14
+ constructor(options: {
15
+ Module: any;
16
+ logger: Logger;
17
+ roomEngineWASM: any;
18
+ });
19
+ /**
20
+ * @private
21
+ * 调用 TUIRoomEngineWASM 的异步方法
22
+ * @param funcName
23
+ * @param args
24
+ */
25
+ private JSCallNativeFunctionPromise;
26
+ /**
27
+ * 预定会议
28
+ * @param {object} options
29
+ * @param {string} options.roomId 房间 Id,必填, roomId 限制长度为64字节,且仅支持以下范围的字符集:<br>
30
+ * - 大小写英文字母(a-zA-Z)
31
+ * - 数字(0-9)
32
+ * - 空格 ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
33
+ * @param {number} [options.scheduleStartTime] 预定会议开始时间(计数单位为秒的时间戳)
34
+ * @param {number} [options.scheduleEndTime] 预定会议结束时间(计数单位为秒的时间戳)
35
+ * @param {array=} [options.scheduleAttendees=[]] 预定会议邀请成员 userId 列表
36
+ * @param {number=} [options.reminderSecondsBeforeStart=0] 会议开始前提醒时间,单位秒
37
+ * @param {string=} [options.roomName=roomId] 房间名称,默认值为 roomId,传入的值不能为空字符串
38
+ * @param {TUIRoomType=} [options.roomType=TUIRoomType.kConference] 房间类型, 默认值为 TUIRoomType.kConference <br>
39
+ * 办公协同、医疗问诊、远程会议、教育场景,roomType 设置为 TUIRoomType.kConference
40
+ * 电商直播、语聊房场景,roomType 设置为 TUIRoomType.kLive
41
+ * @param {boolean=} [options.isSeatEnabled=false] 是否开启麦位控制,默认值为 false
42
+ * @param {TUISeatMode=} [options.seatMode=TUISeatMode.kFreeToTake] 上麦模式(开启麦位控制后生效),默认值为 TUISeatMode.kFreeToTake <br>
43
+ * 自由上麦模式,台下观众可以自由上麦,无需申请,seatMode 设置为 TUISeatMode.kFreeToTake
44
+ * 申请上麦模式,台下观众上麦需要房主或者管理员同意后才能上麦,seatMode 设置为 TUISeatMode.kApplyToTake
45
+ * @param {boolean=} [options.isMicrophoneDisableForAllUser=false] 是否开启全员禁麦,默认不开启全员禁麦(创建房间可选参数)
46
+ * @param {boolean=} [options.isScreenShareDisableForAllUser=false] 是否开启禁止屏幕分享,默认不开启禁止屏幕分享权限(该属性自 v2.2.0 版本 以后支持,创建房间可选参数)
47
+ * @param {boolean=} [options.isCameraDisableForAllUser=false] 是否开启全员禁画,默认不开启全员禁画(创建房间可选参数)
48
+ * @param {boolean=} [options.isMessageDisableForAllUser=false] 是否允许成员发送消息,默认不禁止(创建房间可选参数)
49
+ * @param {number=} options.maxSeatCount 最大麦位数量 (创建房间可选参数)
50
+ * @param {string=} [options.password=''] 房间密码,(该属性自 v2.5.0 版本支持)
51
+ * @returns {Promise<void>}
52
+ *
53
+ * @example
54
+ * const roomEngine = new TUIRoomEngine();
55
+ * const conferenceListManager = roomEngine.getConferenceListManager();
56
+ * await conferenceListManager.scheduleConference({
57
+ * roomId: '12345', // 填入您的房间 Id, 注意房间 Id 要求为字符串类型
58
+ * scheduleStartTime: 1720004257, // 填入您的会议预定开始时间的时间戳,单位秒。
59
+ * scheduleEndTime: 1720001317, // 填入您的会议预定结束时间的时间戳,单位秒。
60
+ * });
61
+ */
62
+ scheduleConference(options: {
63
+ scheduleStartTime: number;
64
+ scheduleEndTime: number;
65
+ scheduleAttendees?: string[];
66
+ reminderSecondsBeforeStart?: number;
67
+ roomId: string;
68
+ roomName?: string;
69
+ roomType?: TUIRoomType;
70
+ isSeatEnabled?: boolean;
71
+ seatMode?: TUISeatMode;
72
+ isMicrophoneDisableForAllUser?: boolean;
73
+ isScreenShareDisableForAllUser?: boolean;
74
+ isCameraDisableForAllUser?: boolean;
75
+ isMessageDisableForAllUser?: boolean;
76
+ maxSeatCount?: number;
77
+ password?: string;
78
+ }): Promise<void>;
79
+ /**
80
+ * 取消预定会议
81
+ *
82
+ * @param {object} options
83
+ * @param {string} options.roomId 要取消会议Id,即房间roomId。
84
+ * @returns {Promise<void>}
85
+ *
86
+ * @example
87
+ * const roomEngine = new TUIRoomEngine();
88
+ * const conferenceListManager = roomEngine.getConferenceListManager();
89
+ * await conferenceListManager.cancelConference({
90
+ * roomId: '12345', // 填入您要取消的会议 Id ,即房间 roomId 。
91
+ * });
92
+ */
93
+ cancelConference(options: {
94
+ roomId: string;
95
+ }): Promise<void>;
96
+ /**
97
+ * 更新预定会议信息
98
+ *
99
+ * @param {object} options
100
+ * @param {string} options.roomId 会议的房间Id。
101
+ * @param {string} options.roomName 会议的名称。
102
+ * @param {number} options.scheduleStartTime 预定会议的开始时间(计数单位为秒的时间戳)。
103
+ * @param {number} options.scheduleEndTime 预定会议的结束时间(计数单位为秒的时间戳)。
104
+ * @returns {Promise<void>}
105
+ *
106
+ * @example
107
+ * const roomEngine = new TUIRoomEngine();
108
+ * const conferenceListManager = roomEngine.getConferenceListManager();
109
+ * await conferenceListManager.updateConferenceInfo({
110
+ * roomId: '12345', // 填入您要更新的会议房间 roomId 。
111
+ * roomName: 'myRoomName', // 填入您更新后的会议名称。
112
+ * scheduleStartTime: 1720004257, // 填入您更新后的会议预定开始时间的时间戳,单位秒。
113
+ * scheduleEndTime: 1720001317, // 填入您更新后的会议预定结束时间的时间戳,单位秒。
114
+ * });
115
+ */
116
+ updateConferenceInfo(options: {
117
+ roomId: string;
118
+ roomName?: string;
119
+ scheduleStartTime?: number;
120
+ scheduleEndTime?: number;
121
+ }): Promise<void>;
122
+ /**
123
+ * 获取预定会议列表
124
+ *
125
+ * @param {object} options
126
+ * @param {Array<TUIConferenceStatus>} options.statusArray 会议状态数组,默认值为拉取全部状态会议。
127
+ * @param {string} options.cursor 分页获取索引,第一次拉取填 '',回调成功 如果callback返回的数据中 cursor 不为 '',表示需要分页,请以返回的 cursor 作为参数再次调用接口拉取,直至返回的cursor为 '',表示数据已经全部拉取。
128
+ * @param {number} options.count 本次拉取数量。
129
+ *
130
+ * @example
131
+ * const roomEngine = new TUIRoomEngine();
132
+ * const conferenceListManager = roomEngine.getConferenceListManager();
133
+ * const conferenceList = [];
134
+ * let result;
135
+ * let cursor = '';
136
+ * let count = 20;
137
+ * do {
138
+ * result = await conferenceListManager.fetchScheduledConferenceList({ cursor, count });
139
+ * conferenceList.push(...result.conferenceList);
140
+ * cursor = result.cursor;
141
+ * } while (cursor !== '')
142
+ */
143
+ fetchScheduledConferenceList(options: {
144
+ statusArray?: TUIConferenceStatus[];
145
+ cursor: string;
146
+ count: number;
147
+ }): Promise<Array<TUIConferenceInfo>>;
148
+ /**
149
+ * 获取预定会议邀请成员列表
150
+ *
151
+ * @param {object} options
152
+ * @param {string} options.roomId 会议 Id ,即房间 roomId 。
153
+ * @param {string} options.cursor 分页获取索引,第一次拉取填 "",回调成功 如果 callback 返回的数据中 cursor 不为"",表示需要分页,请以返回的 cursor 作为参数再次调用接口拉取,直至返回的 cursor 为"",表示数据已经全部拉取。
154
+ * @param {number} options.count 本次拉取数量。
155
+ *
156
+ * @example
157
+ * const roomEngine = new TUIRoomEngine();
158
+ * const conferenceListManager = roomEngine.getConferenceListManager();
159
+ * const attendeeList = [];
160
+ * let result;
161
+ * let cursor = '';
162
+ * let totalCount = 0;
163
+ * let roomId = '12345';
164
+ * let count = 20;
165
+ * do {
166
+ * result = await conferenceListManager.fetchAttendeeList({ roomId, cursor, count });
167
+ * attendeeList.push(...result.attendeeList);
168
+ * cursor = result.cursor;
169
+ * totalCount = result.totalCount;
170
+ * } while (cursor !== '')
171
+ */
172
+ fetchAttendeeList(options: {
173
+ roomId: string;
174
+ cursor: string;
175
+ count: number;
176
+ }): Promise<Array<TUIUserInfo>>;
177
+ /**
178
+ * 添加成员至邀请列表
179
+ *
180
+ * @param {object} options
181
+ * @param {string} options.roomId 会议 Id ,即房间 roomId 。
182
+ * @param {Array<string>} options.userIdList 成员 userId 列表。
183
+ * @returns {Promise<void>}
184
+ *
185
+ * @example
186
+ * const roomEngine = new TUIRoomEngine();
187
+ * const conferenceListManager = roomEngine.getConferenceListManager();
188
+ * await conferenceListManager.addAttendeesByAdmin({
189
+ * roomId: '12345', // 填入您要添加成员的会议 Id ,即房间 roomId 。
190
+ * userIdList: ['123'], // 填入您要邀请的成员 Id 数组。
191
+ * });
192
+ */
193
+ addAttendeesByAdmin(options: {
194
+ roomId: string;
195
+ userIdList: string[];
196
+ }): Promise<void>;
197
+ /**
198
+ * 从邀请列表移除成员
199
+ *
200
+ * @param {object} options
201
+ * @param {string} options.roomId 会议 Id ,即房间 roomId 。
202
+ * @param {Array<string>} options.userIdList 成员 userId 列表。
203
+ * @returns {Promise<void>}
204
+ *
205
+ * @example
206
+ * const roomEngine = new TUIRoomEngine();
207
+ * const conferenceListManager = roomEngine.getConferenceListManager();
208
+ * await conferenceListManager.removeAttendeesByAdmin({
209
+ * roomId: '12345', // 填入您要移除成员的会议 Id ,即房间 roomId 。
210
+ * userIdList: ['123'], // 填入您要移除的成员 Id 数组。
211
+ * });
212
+ */
213
+ removeAttendeesByAdmin(options: {
214
+ roomId: string;
215
+ userIdList: string[];
216
+ }): Promise<void>;
217
+ /**
218
+ * 监听 conferenceListManager 的事件
219
+ * @param event TUIConferenceListManagerEvents
220
+ * @param func function
221
+ * @returns {void}
222
+ *
223
+ * @example
224
+ * const roomEngine = new TUIRoomEngine();
225
+ * const conferenceListManager = roomEngine.getConferenceListManager();
226
+ * conferenceListManager.on(event, func);
227
+ */
228
+ on(event: TUIConferenceListManagerEvents, func: (...args: any[]) => void): void;
229
+ private observerFunction;
230
+ private handleConferenceChangedEvent;
231
+ /**
232
+ * 取消监听 ConferenceListManager 的事件
233
+ * @param event TUIConferenceListManagerEvents
234
+ * @param func function
235
+ * @returns {void}
236
+ *
237
+ * @example
238
+ * const roomEngine = new TUIRoomEngine();
239
+ * const conferenceListManager = roomEngine.getConferenceListManager();
240
+ * conferenceListManager.off(event, func);
241
+ */
242
+ off(event: string, func: (...args: any[]) => void): void;
243
+ }
244
+ export default TUIConferenceListManager;
@@ -0,0 +1,162 @@
1
+ import TRTCCloud from 'trtc-cloud-js-sdk';
2
+ import { TUIMediaDeviceType, TUIAudioRoute, TUIDeviceInfo, TUIRoomDeviceMangerEvents } from '../types';
3
+ import Logger from '../utils/logger';
4
+ /**
5
+ * 设备管理
6
+ * @class DeviceManager
7
+ */
8
+ declare class TUIRoomDeviceManager {
9
+ private deviceManagerWASM;
10
+ private logger;
11
+ private static deviceManager;
12
+ private trtcCloud;
13
+ constructor(options: {
14
+ Module: any;
15
+ logger: Logger;
16
+ trtcCloud: TRTCCloud;
17
+ deviceManagerWASM: any;
18
+ });
19
+ /**
20
+ * @private
21
+ * 调用 TUIRoomEngineWASM 的异步方法
22
+ * @param funcName
23
+ * @param args
24
+ */
25
+ private JSCallNativeFunctionPromise;
26
+ /**
27
+ * 获取设备列表
28
+ * @param {TRTCDeviceType} type 设备类型
29
+ * @example
30
+ * // 获取设备管理 Manager
31
+ * const roomEngine = new TUIRoomEngine();
32
+ * const deviceManager = roomEngine.getDeviceManager();
33
+ *
34
+ * // 获取摄像头设备列表
35
+ * const cameraList = await deviceManager.getDeviceList({ type: TUIMediaDeviceType.kMediaDeviceVideoCamera });
36
+ * // 获取麦克风设备列表
37
+ * const micList = await deviceManager.getDeviceList({ type: TUIMediaDeviceType.kMediaDeviceTypeAudioInput });
38
+ * // 获取扬声器设备列表
39
+ * const speakerList = await deviceManager.getDeviceList({ type: TUIMediaDeviceType.kMediaDeviceTypeAudioOutput });
40
+ * @returns {Promise} Array<TUIDeviceInfo>
41
+ */
42
+ getDevicesList(options: {
43
+ type: TUIMediaDeviceType;
44
+ }): Promise<TUIDeviceInfo[]>;
45
+ /**
46
+ * 设置当前使用设备
47
+ * @param {TRTCDeviceType} type 设备类型
48
+ * @param {string} deviceId 设备 Id
49
+ * @example
50
+ * // 获取设备管理 Manager
51
+ * const roomEngine = new TUIRoomEngine();
52
+ * const deviceManager = roomEngine.getDeviceManager();
53
+ *
54
+ * // 设置当前麦克风设备
55
+ * deviceManager.setCurrentDevice({
56
+ * type: TUIMediaDeviceType.kMediaDeviceTypeAudioInput,
57
+ * deviceId: 'default',
58
+ * });
59
+ * // 设置当前扬声器设备
60
+ * deviceManager.setCurrentDevice({
61
+ * type: TUIMediaDeviceType.kMediaDeviceTypeAudioOutput,
62
+ * deviceId: 'default',
63
+ * });
64
+ * // 设置当前摄像头设备
65
+ * deviceManager.setCurrentDevice({
66
+ * type: TUIMediaDeviceType.kMediaDeviceVideoCamera,
67
+ * deviceId: '',
68
+ * });
69
+ * @returns {void}
70
+ */
71
+ setCurrentDevice(options: {
72
+ type: TUIMediaDeviceType;
73
+ deviceId: string;
74
+ }): Promise<void>;
75
+ /**
76
+ * 获取当前使用的设备信息
77
+ * @param {object} options 获取当前设备信息的参数
78
+ * @param {TUIMediaDeviceType} options.type 设备类型
79
+ * @example
80
+ * // 获取设备管理 Manager
81
+ * const roomEngine = new TUIRoomEngine();
82
+ * const deviceManager = roomEngine.getDeviceManager();
83
+ * @returns {TUIDeviceInfo}
84
+ */
85
+ getCurrentDevice(options: {
86
+ type: TUIMediaDeviceType;
87
+ }): TUIDeviceInfo;
88
+ /**
89
+ * 开始进行摄像头测试
90
+ * @param {object} options 摄像头测试参数
91
+ * @param {string} options.view 显示摄像头测试的视频区域, 传入的 view 为承载预览画面 div 元素的 id
92
+ * @returns {Promise<void>}
93
+ *
94
+ * @example
95
+ * const roomEngine = new TUIRoomEngine();
96
+ * await roomEngine.startCameraDeviceTest({ view: 'test-preview' });
97
+ */
98
+ startCameraDeviceTest(options: {
99
+ view: string;
100
+ }): Promise<void>;
101
+ /**
102
+ * 停止摄像头测试
103
+ * @returns {Promise<void>}
104
+ * @example
105
+ * const roomEngine = new TUIRoomEngine();
106
+ * await roomEngine.stopCameraDeviceTest();
107
+ */
108
+ stopCameraDeviceTest(): Promise<void>;
109
+ /**
110
+ * 开始进行麦克风测试
111
+ * @param options
112
+ * @param {number} options.interval 麦克风音量的回调时间
113
+ */
114
+ startMicDeviceTest(options: {
115
+ interval: number;
116
+ }): Promise<void>;
117
+ /**
118
+ * 停止进行麦克风测试
119
+ */
120
+ stopMicDeviceTest(): Promise<void>;
121
+ startSpeakerDeviceTest(options: {
122
+ filePath: string;
123
+ }): Promise<void>;
124
+ stopSpeakerDeviceTest(): Promise<void>;
125
+ isFrontCamera(): boolean;
126
+ /**
127
+ * 切换前后置摄像头,该接口只适用于移动端浏览器
128
+ * @param {Object} options
129
+ * @param {boolean} options.isFrontCamera 是否切换为前置摄像头
130
+ *
131
+ * const deviceManager = roomEngine.instance?.getDeviceManager();
132
+ * // 移动端切换为前置摄像头
133
+ * await deviceManager?.switchCamera({ isFrontCamera: true });
134
+ * // 移动端切换为后置摄像头
135
+ * await deviceManager?.switchCamera({ isFrontCamera: false });
136
+ */
137
+ switchCamera(options: {
138
+ isFrontCamera: boolean;
139
+ }): Promise<void>;
140
+ isAutoFocusEnabled(): boolean;
141
+ enableCameraTorch(options: {
142
+ enabled: boolean;
143
+ }): void;
144
+ setAudioRoute(options: {
145
+ route: TUIAudioRoute;
146
+ }): void;
147
+ /**
148
+ * 监听 roomEngine 的事件
149
+ * @param event TUIRoomEvents
150
+ * @param func function
151
+ * @returns {void}
152
+ *
153
+ * @example
154
+ * const roomEngine = new TUIRoomEngine();
155
+ * const deviceManager = roomEngine.getDeviceManager();
156
+ * deviceManager.on(event, func);
157
+ */
158
+ on(event: TUIRoomDeviceMangerEvents, func: (...args: any[]) => void): void;
159
+ private handleTrtcCloudBindEvent;
160
+ off(event: string, func: (...args: any[]) => void): void;
161
+ }
162
+ export default TUIRoomDeviceManager;
@@ -0,0 +1,109 @@
1
+ import { TUILiveConnectionManagerEvents } from '../types';
2
+ import Logger from '../utils/logger';
3
+ /**
4
+ * 直播连线
5
+ * @class TUILiveConnectionManager
6
+ */
7
+ declare class TUILiveConnectionManager {
8
+ private liveConnectionManagerWASM;
9
+ private logger;
10
+ private static liveConnectionManager;
11
+ constructor(options: {
12
+ Module: any;
13
+ logger: Logger;
14
+ roomEngineWASM: any;
15
+ });
16
+ /**
17
+ * 监听 TUILiveConnectionManager 事件
18
+ * @param {TUILiveConnectionManagerEvents} event 事件名
19
+ * @param func 事件回调函数
20
+ *
21
+ * @example
22
+ * const roomEngine = new TUIRoomEngine();
23
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
24
+ * const callback = (inviter) => {
25
+ * console.log('liveConnectionManager.onConnectionRequestReceived', inviter);
26
+ * };
27
+ * liveConnectionManager.on(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
28
+ */
29
+ on(event: TUILiveConnectionManagerEvents, func: (...args: any[]) => void): void;
30
+ /**
31
+ * 取消监听 TUILiveConnectionManager 事件
32
+ * @param {TUILiveConnectionManagerEvents} event 事件名
33
+ * @param func 事件回调函数
34
+ *
35
+ * @example
36
+ * const roomEngine = new TUIRoomEngine();
37
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
38
+ * const callback = (inviter) => {
39
+ * console.log('liveConnectionManager.onConnectionRequestReceived', inviter);
40
+ * };
41
+ * liveConnectionManager.off(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
42
+ */
43
+ off(event: TUILiveConnectionManagerEvents, func: (...args: any[]) => void): void;
44
+ /**
45
+ * 请求跨房连线
46
+ *
47
+ * @param {Array<string>} roomIdList 待邀请的连线房间ID列表
48
+ * @param {string} timeOut 请求超时时间, 单位 s
49
+ * @param {string} extensionInfo 扩展信息, 可选, 默认为: ''
50
+ * @returns {Promise<void>}
51
+ *
52
+ * @example
53
+ * const roomEngine = new TUIRoomEngine();
54
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
55
+ * liveConnectionManager.requestConnection(['roomId1','roomId2'], 10);
56
+ */
57
+ requestConnection(roomIdList: Array<string>, timeOut: number, extensionInfo?: string): Promise<void>;
58
+ /**
59
+ * 取消跨房连线请求
60
+ *
61
+ * @param {Array<string>} roomIdList 被取消连线请求的房间Id列表
62
+ * @returns {Promise<void>}
63
+ *
64
+ * @example
65
+ * const roomEngine = new TUIRoomEngine();
66
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
67
+ * liveConnectionManager.cancelConnectionRequest(['roomId1', 'roomId2']);
68
+ */
69
+ cancelConnectionRequest(roomIdList: Array<string>): Promise<void>;
70
+ /**
71
+ * 同意连线请求
72
+ *
73
+ * @param {string} roomId 直播房间 ID
74
+ * @returns {Promise<void>}
75
+ *
76
+ * @example
77
+ * const roomEngine = new TUIRoomEngine();
78
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
79
+ * liveConnectionManager.acceptConnection('roomId');
80
+ */
81
+ acceptConnection(roomId: string): Promise<void>;
82
+ /**
83
+ * 拒绝连线请求
84
+ *
85
+ * @param {string} roomId 直播房间 ID
86
+ * @returns {Promise<void>}
87
+ *
88
+ * @example
89
+ * const roomEngine = new TUIRoomEngine();
90
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
91
+ * liveConnectionManager.rejectConnection('roomId');
92
+ */
93
+ rejectConnection(roomId: string): Promise<void>;
94
+ /**
95
+ * 断开直播连线
96
+ *
97
+ * @returns {Promise<void>}
98
+ *
99
+ * @example
100
+ * const roomEngine = new TUIRoomEngine();
101
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
102
+ * liveConnectionManager.disconnect();
103
+ */
104
+ disconnect(): Promise<void>;
105
+ private JSCallNativeFunctionPromise;
106
+ private observerFunction;
107
+ private handleLiveConnectionEvent;
108
+ }
109
+ export default TUILiveConnectionManager;