@tencentcloud/tuiroom-engine-electron 3.2.1 → 3.3.0

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
@@ -8,6 +8,7 @@ declare enum TUIErrorCode {
8
8
  ERR_FAILED = -1,
9
9
  ERR_FREQ_LIMIT = -2,
10
10
  ERR_REPEAT_OPERATION = -3,
11
+ ERR_ROOM_MISMATCH = -4,
11
12
  ERR_SDKAPPID_NOT_FOUND = -1000,
12
13
  ERR_INVALID_PARAMETER = -1001,
13
14
  ERR_SDK_NOT_INITIALIZED = -1002,
@@ -53,9 +54,14 @@ declare enum TUIErrorCode {
53
54
  ERR_OPEN_SCREEN_SHARE_NEED_PERMISSION_FROM_ADMIN = -2373,
54
55
  ERR_SEND_MESSAGE_DISABLED_FOR_ALL = -2380,
55
56
  ERR_SEND_MESSAGE_DISABLED_FOR_CURRENT = -2381,
57
+ ERR_ROOM_NOT_SUPPORT_PRELOADING = -4001,
58
+ ERR_CALL_IN_PROGRESS = -6001,
59
+ ERR_SERVER_SYSTEM_ERROR = 100001,
60
+ ERR_SERVER_INVALID_PARAMETER = 100002,
56
61
  ERR_ROOM_ID_OCCUPIED = 100003,
57
62
  ERR_ROOM_ID_NOT_EXIST = 100004,
58
63
  ERR_USER_NOT_ENTERED = 100005,
64
+ ERR_NO_PERMISSION = 100006,
59
65
  ERR_NEED_PASSWORD = 100018,
60
66
  ERR_WRONG_PASSWORD = 100019,
61
67
  ERR_ROOM_USER_FULL = 100008,
@@ -73,7 +79,13 @@ declare enum TUIErrorCode {
73
79
  ERR_BATTLE_ID_NOT_EXIST = 100411,
74
80
  ERR_ROOM_BATTLEID_IN_OTHER = 100415,
75
81
  ERR_ROOM_METADATA_EXCEED_KEY_COUNT_LIMIT = 100500,
76
- ERR_ROOM_METADATA_EXCEED_VALUE_SIZE_LIMIT = 100501
82
+ ERR_ROOM_METADATA_EXCEED_VALUE_SIZE_LIMIT = 100501,
83
+ ERR_GIFT_ABILITY_NOT_ENABLED = 102001,
84
+ ERR_GIFT_NOT_EXIST = 102002,
85
+ ERR_GIFT_SERVER_PRE_VERIFICATION_FAILED = 102004,
86
+ ERR_MIX_STREAM_UPDATE_TOO_FREQ = 100427,
87
+ ERR_PUBLISH_STREAM_INFO_NOT_EXISTED = 100430,
88
+ ERR_PUBLISH_STREAM_NO_NEED_RECOVERY = 100431
77
89
  }
78
90
  type TUIRoomInfo = {
79
91
  roomId: string;
@@ -487,19 +499,6 @@ declare enum TUIRoomEvents {
487
499
  * });
488
500
  */
489
501
  onAllUserCameraDisableChanged = "onAllUserCameraDisableChanged",
490
- /**
491
- * @description 所有成员麦克风使用权限改变事件
492
- * @default 'onAllUserMicrophoneDisableChanged'
493
- * @event TUIRoomEvents#onAllUserMicrophoneDisableChanged
494
- * @param {object} options
495
- * @param {boolean} options.isDisable 是否允许使用麦克风
496
- * @example
497
- * const roomEngine = new TUIRoomEngine();
498
- * roomEngine.on(TUIRoomEvents.onAllUserMicrophoneDisableChanged, ({ isDisable }) =>{
499
- * console.log('roomEngine.onAllUserMicrophoneDisableChanged', isDisable);
500
- * });
501
- */
502
- onAllUserMicrophoneDisableChanged = "onAllUserMicrophoneDisableChanged",
503
502
  /**
504
503
  * @since v2.2.0
505
504
  * @description 房间内所有用户屏幕分享被禁用事件
@@ -514,6 +513,19 @@ declare enum TUIRoomEvents {
514
513
  * });
515
514
  */
516
515
  onScreenShareForAllUserDisableChanged = "onScreenShareForAllUserDisableChanged",
516
+ /**
517
+ * @description 所有成员麦克风使用权限改变事件
518
+ * @default 'onAllUserMicrophoneDisableChanged'
519
+ * @event TUIRoomEvents#onAllUserMicrophoneDisableChanged
520
+ * @param {object} options
521
+ * @param {boolean} options.isDisable 是否允许使用麦克风
522
+ * @example
523
+ * const roomEngine = new TUIRoomEngine();
524
+ * roomEngine.on(TUIRoomEvents.onAllUserMicrophoneDisableChanged, ({ isDisable }) =>{
525
+ * console.log('roomEngine.onAllUserMicrophoneDisableChanged', isDisable);
526
+ * });
527
+ */
528
+ onAllUserMicrophoneDisableChanged = "onAllUserMicrophoneDisableChanged",
517
529
  /**
518
530
  * @description 所有成员发送消息权限改变事件
519
531
  * @default 'onSendMessageForAllUserDisableChanged'
@@ -1160,15 +1172,43 @@ declare enum TUIConferenceInvitationManagerEvents {
1160
1172
  onInvitationStatusChanged = "onInvitationStatusChanged"
1161
1173
  }
1162
1174
  type TUILiveInfo = {
1163
- basicRoomInfo: TUIRoomInfo;
1175
+ roomId: string;
1176
+ roomType: TUIRoomType;
1177
+ name: string;
1178
+ notice: string;
1179
+ isMessageDisableForAllUser: boolean;
1164
1180
  isGiftEnabled: boolean;
1165
1181
  isLikeEnabled: boolean;
1166
1182
  isPublicVisible: boolean;
1167
- activityStatus: number;
1168
- viewCount: number;
1183
+ isSeatEnabled: boolean;
1184
+ keepOwnerOnSeat: boolean;
1185
+ seatLayoutTemplateId: number;
1186
+ maxSeatCount: number;
1187
+ seatMode: TUISeatMode;
1169
1188
  coverUrl: string;
1170
1189
  backgroundUrl: string;
1171
1190
  categoryList: Array<number>;
1191
+ activityStatus: number;
1192
+ readonly roomOwner?: string;
1193
+ readonly ownerName?: string;
1194
+ readonly ownerAvatarUrl?: string;
1195
+ readonly createTime?: number;
1196
+ readonly totalViewers?: number;
1197
+ readonly isUnlimitedRoomEnabled?: boolean;
1198
+ readonly cdnStreamUrl?: string;
1199
+ readonly lebSecretKey?: string;
1200
+ readonly lebEncrypted?: string;
1201
+ readonly lebSignature?: string;
1202
+ };
1203
+ /**
1204
+ * 直播连线用户信息
1205
+ */
1206
+ type TUILiveConnectionUser = {
1207
+ roomId: string;
1208
+ userId: string;
1209
+ userName: string;
1210
+ avatarUrl: string;
1211
+ joinConnectionTime: number;
1172
1212
  };
1173
1213
  type TUILiveModifyInfo = {
1174
1214
  roomId: string;
@@ -1177,16 +1217,22 @@ type TUILiveModifyInfo = {
1177
1217
  coverUrl?: string;
1178
1218
  backgroundUrl?: string;
1179
1219
  categoryList?: Array<number>;
1220
+ seatLayoutTemplateId?: number;
1180
1221
  };
1181
1222
  declare enum TUILiveModifyFlag {
1182
1223
  kNone = 0,
1183
- kActivityStatus = 256,
1184
- kCoverUrl = 512,
1185
- kCategory = 1024,
1186
- kEnableGift = 2048,
1187
- kEnableLike = 4096,
1188
- kPublic = 8192,
1189
- kBackgroundUrl = 262144
1224
+ kName = 1,
1225
+ kNotice = 2,
1226
+ kDisableMessage = 4,
1227
+ kEnableGift = 8,
1228
+ kEnableLike = 16,
1229
+ kPublic = 32,
1230
+ kTakeSeatMode = 64,
1231
+ kCoverUrl = 128,
1232
+ kBackgroundUrl = 256,
1233
+ kCategory = 512,
1234
+ kActivityStatus = 1024,
1235
+ kSeatLayoutTemplateId = 2048
1190
1236
  }
1191
1237
  type TUILiveListResult = {
1192
1238
  cursor: string;
@@ -1219,23 +1265,103 @@ declare enum TUILiveLayoutManagerEvents {
1219
1265
  * const roomEngine = new TUIRoomEngine();
1220
1266
  * const liveLayoutManager = roomEngine.getLiveLayoutManager();
1221
1267
  * const callback = (roomId, layoutInfo) => {
1222
- * console.log('liveLayoutManager.onLiveVideoLayoutListChanged', roomId, layoutInfo);
1268
+ * console.log('liveLayoutManager.onLiveVideoLayoutChanged', roomId, layoutInfo);
1223
1269
  * };
1224
- * liveLayoutManager.on(TUILiveLayoutManagerEvents.onLiveVideoLayoutListChanged, callback);
1270
+ * liveLayoutManager.on(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
1225
1271
  */
1226
- onLiveVideoLayoutListChanged = "onLiveVideoLayoutListChanged"
1227
- }
1228
- declare enum TUILiveLayoutManagerEvents {
1272
+ onLiveVideoLayoutChanged = "onLiveVideoLayoutChanged",
1229
1273
  /**
1274
+ * @description 麦位排版信息发生变化事件回调
1275
+ * @since v3.3.0
1276
+ * @default 'onSeatLayoutChanged'
1277
+ * @event TUILiveLayoutManagerEvents#onSeatLayoutChanged
1278
+ * @param {object} option
1279
+ * @param {string} option.roomId 房间 ID
1280
+ * @param {TUISeatLayout} option.seatLayout 麦位排版信息
1281
+ *
1282
+ * @example
1230
1283
  * const roomEngine = new TUIRoomEngine();
1231
1284
  * const liveLayoutManager = roomEngine.getLiveLayoutManager();
1232
- * const callback = (roomId, layoutInfo) => {
1233
- * console.log('liveLayoutManager.onLiveVideoLayoutChanged', roomId, layoutInfo);
1234
- * };
1235
- * liveLayoutManager.on(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
1285
+ * const callback = ({ roomId, seatLayout }) => {
1286
+ * console.log('liveLayoutManager.onSeatLayoutChanged', roomId, seatLayout);
1287
+ * });
1288
+ * liveLayoutManager.on(TUILiveLayoutManagerEvents.onSeatLayoutChanged, callback);
1236
1289
  */
1237
- onLiveVideoLayoutChanged = "onLiveVideoLayoutChanged"
1290
+ onSeatLayoutChanged = "onSeatLayoutChanged"
1291
+ }
1292
+ /** 麦上用户的媒体状态信息
1293
+ * @typedef {object} TUIDeviceStatus
1294
+ * @property {number} TUIDeviceStatusOpened 当前设备处于打开状态
1295
+ * @property {number} TUIDeviceStatusClosedBySelf 当前设备处于关闭状态,且是用户主动关闭
1296
+ * @property {number} TUIDeviceStatusClosedByAdmin 当前设备处于关闭状态,且是被房主/管理员强制关闭
1297
+ */
1298
+ declare enum TUIDeviceStatus {
1299
+ TUIDeviceStatusOpened = 0,
1300
+ TUIDeviceStatusClosedBySelf = 1,
1301
+ TUIDeviceStatusClosedByAdmin = 2
1238
1302
  }
1303
+ /**
1304
+ * 麦位排版信息
1305
+ * @typedef {object} TUISeatRegion
1306
+ * @property {string} roomId 直播间 ID
1307
+ * @property {number} seatIndex 麦位序号
1308
+ * @property {boolean} isSeatLocked 是否被锁定
1309
+ * @property {string} userId 用户 ID
1310
+ * @property {string} userName 用户名称
1311
+ * @property {string} userAvatar 用户头像
1312
+ * @property {TUIDeviceStatus} userMicrophoneStatus 用户麦克风状态
1313
+ * @property {TUIDeviceStatus} userCameraStatus 用户摄像头状态
1314
+ * @property {number} x 麦位 X 坐标
1315
+ * @property {number} y 麦位 Y 坐标
1316
+ * @property {number} width 麦位宽度
1317
+ * @property {number} height 麦位高度
1318
+ * @property {number} zorder 麦位 Z 轴顺序
1319
+ */
1320
+ type TUISeatRegion = {
1321
+ roomId: string;
1322
+ seatIndex: number;
1323
+ isSeatLocked: boolean;
1324
+ userId: string;
1325
+ userName: string;
1326
+ userAvatar: string;
1327
+ userMicrophoneStatus: TUIDeviceStatus;
1328
+ userCameraStatus: TUIDeviceStatus;
1329
+ x: number;
1330
+ y: number;
1331
+ width: number;
1332
+ height: number;
1333
+ zorder: number;
1334
+ };
1335
+ /**
1336
+ * 直播间麦位排版
1337
+ * @typedef {object} TUISeatLayout
1338
+ * @property {number} templateId 麦位排版模板 ID
1339
+ * @property {number} canvasWidth 麦位排版画布宽度
1340
+ * @property {number} canvasHeight 麦位排版画布高度
1341
+ * @property {Array<TUISeatRegion>} regions 麦位排版区域列表
1342
+ */
1343
+ type TUISeatLayout = {
1344
+ templateId: number;
1345
+ canvasWidth: number;
1346
+ canvasHeight: number;
1347
+ regions: Array<TUISeatRegion>;
1348
+ };
1349
+ /**
1350
+ * 直播间统计信息
1351
+ * @typedef {object} TUILiveStatisticsData
1352
+ * @property {number} totalViewers 观众人数
1353
+ * @property {number} totalGiftsSent 礼物发送总数
1354
+ * @property {number} totalGiftCoins 礼物总价值
1355
+ * @property {number} totalUniqueGiftSenders 礼物发送者总数
1356
+ * @property {number} totalLikesReceived 点赞总数
1357
+ */
1358
+ type TUILiveStatisticsData = {
1359
+ totalViewers: number;
1360
+ totalGiftsSent: number;
1361
+ totalGiftCoins: number;
1362
+ totalUniqueGiftSenders: number;
1363
+ totalLikesReceived: number;
1364
+ };
1239
1365
  /**
1240
1366
  * @since v3.0.5
1241
1367
  * **TUILiveConnectionManager** 事件列表<br>
@@ -1245,18 +1371,16 @@ declare enum TUILiveConnectionManagerEvents {
1245
1371
  * @description 接收到连线请求的监听事件
1246
1372
  * @default 'onConnectionRequestReceived'
1247
1373
  * @event TUILiveConnectionManagerEvents#onConnectionRequestReceived
1248
- * @param {inviter} options 连线请求发起者
1249
- * @param {avatarUrl} options.avatarUrl 头像
1250
- * @param {joinConnectionTime} options.joinConnectionTime 加入连线时间
1251
- * @param {roomId} options.roomId 房间号
1252
- * @param {userId} options.userId ID
1253
- * @param {userName} options.userName 用户名
1374
+ * @param {object} options
1375
+ * @param {TUILiveConnectionUser} options.inviter 连线邀请者
1376
+ * @param {Array<TUILiveConnectionUser>} options.inviteeList 连线被邀请者列表
1377
+ * @param {string} options.extensionInfo 扩展信息
1254
1378
  *
1255
1379
  * @example
1256
1380
  * const roomEngine = new TUIRoomEngine();
1257
1381
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1258
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestReceived, ({ avatarUrl, joinConnectionTime, roomId, userId, userName }) => {
1259
- * console.log('liveConnectionManager.onConnectionRequestReceived', avatarUrl, joinConnectionTime, roomId, userId, userName);
1382
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestReceived, ({ inviter, inviteeList, extensionInfo }) => {
1383
+ * console.log('liveConnectionManager.onConnectionRequestReceived', inviter, inviteeList, extensionInfo);
1260
1384
  * });
1261
1385
  */
1262
1386
  onConnectionRequestReceived = "onConnectionRequestReceived",
@@ -1265,9 +1389,9 @@ declare enum TUILiveConnectionManagerEvents {
1265
1389
  * @default 'onConnectionUserListChanged'
1266
1390
  * @event TUILiveConnectionManagerEvents#onConnectionUserListChanged
1267
1391
  * @param {object} options
1268
- * @param {connectedList} options.connectedList 包含连线房间所有主播列表
1269
- * @param {joinedList} options.joinedList 本次事件变更加入连线房间的主播列表
1270
- * @param {leavedList} options.leavedList 本次事件变更离开连线房间的主播列表
1392
+ * @param {Array<TUILiveConnectionUser>} options.connectedList 包含连线房间所有主播列表
1393
+ * @param {Array<TUILiveConnectionUser>} options.joinedList 本次事件变更加入连线房间的主播列表
1394
+ * @param {Array<TUILiveConnectionUser>} options.leavedList 本次事件变更离开连线房间的主播列表
1271
1395
  *
1272
1396
  * @example
1273
1397
  * const roomEngine = new TUIRoomEngine();
@@ -1281,18 +1405,14 @@ declare enum TUILiveConnectionManagerEvents {
1281
1405
  * @description 连线请求被取消的监听事件
1282
1406
  * @default 'onConnectionRequestCancelled'
1283
1407
  * @event TUILiveConnectionManagerEvents#onConnectionRequestCancelled
1284
- * @param {invitee} options 连线请求被邀请者
1285
- * @param {avatarUrl} options.avatarUrl 头像
1286
- * @param {joinConnectionTime} options.joinConnectionTime 加入连线时间
1287
- * @param {roomId} options.roomId 房间号
1288
- * @param {userId} options.userId ID
1289
- * @param {userName} options.userName 用户名
1408
+ * @param {object} options
1409
+ * @param {TUILiveConnectionUser} options.inviter 连线邀请者
1290
1410
  *
1291
1411
  * @example
1292
1412
  * const roomEngine = new TUIRoomEngine();
1293
1413
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1294
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestCancelled, ({ avatarUrl, joinConnectionTime, roomId, userId, userName }) => {
1295
- * console.log('liveConnectionManager.onConnectionRequestCancelled', avatarUrl, joinConnectionTime, roomId, userId, userName);
1414
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestCancelled, ({ inviter }) => {
1415
+ * console.log('liveConnectionManager.onConnectionRequestCancelled', inviter);
1296
1416
  * });
1297
1417
  */
1298
1418
  onConnectionRequestCancelled = "onConnectionRequestCancelled",
@@ -1300,18 +1420,14 @@ declare enum TUILiveConnectionManagerEvents {
1300
1420
  * @description 连线请求被同意的监听事件
1301
1421
  * @default 'onConnectionRequestAccept'
1302
1422
  * @event TUILiveConnectionManagerEvents#onConnectionRequestAccept
1303
- * @param {invitee} options 连线请求被邀请者
1304
- * @param {avatarUrl} options.avatarUrl 头像
1305
- * @param {joinConnectionTime} options.joinConnectionTime 加入连线时间
1306
- * @param {roomId} options.roomId 房间号
1307
- * @param {userId} options.userId ID
1308
- * @param {userName} options.userName 用户名
1423
+ * @param {object} options
1424
+ * @param {TUILiveConnectionUser} options.invitee 连线被邀请者
1309
1425
  *
1310
1426
  * @example
1311
1427
  * const roomEngine = new TUIRoomEngine();
1312
1428
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1313
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestAccept, ({ avatarUrl, joinConnectionTime, roomId, userId, userName }) => {
1314
- * console.log('liveConnectionManager.onConnectionRequestAccept', avatarUrl, joinConnectionTime, roomId, userId, userName);
1429
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestAccept, ({ invitee }) => {
1430
+ * console.log('liveConnectionManager.onConnectionRequestAccept', invitee);
1315
1431
  * });
1316
1432
  */
1317
1433
  onConnectionRequestAccept = "onConnectionRequestAccept",
@@ -1319,18 +1435,14 @@ declare enum TUILiveConnectionManagerEvents {
1319
1435
  * @description 连线请求被拒绝的监听事件
1320
1436
  * @default 'onConnectionRequestReject'
1321
1437
  * @event TUILiveConnectionManagerEvents#onConnectionRequestReject
1322
- * @param {invitee} options 连线请求被邀请者
1323
- * @param {avatarUrl} options.avatarUrl 头像
1324
- * @param {joinConnectionTime} options.joinConnectionTime 加入连线时间
1325
- * @param {roomId} options.roomId 房间号
1326
- * @param {userId} options.userId ID
1327
- * @param {userName} options.userName 用户名
1438
+ * @param {object} options
1439
+ * @param {TUILiveConnectionUser} options.invitee 连线被邀请者
1328
1440
  *
1329
1441
  * @example
1330
1442
  * const roomEngine = new TUIRoomEngine();
1331
1443
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1332
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestReject, ({ avatarUrl, joinConnectionTime, roomId, userId, userName }) => {
1333
- * console.log('liveConnectionManager.onConnectionRequestReject', avatarUrl, joinConnectionTime, roomId, userId, userName);
1444
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestReject, ({ invitee }) => {
1445
+ * console.log('liveConnectionManager.onConnectionRequestReject', invitee);
1334
1446
  * });
1335
1447
  */
1336
1448
  onConnectionRequestReject = "onConnectionRequestReject",
@@ -1338,27 +1450,232 @@ declare enum TUILiveConnectionManagerEvents {
1338
1450
  * @description 邀请超时的监听事件
1339
1451
  * @default 'onConnectionRequestTimeout'
1340
1452
  * @event TUILiveConnectionManagerEvents#onConnectionRequestTimeout
1341
- * @param {invitee} invitee 连线请求被邀请者
1342
- * @param {avatarUrl} invitee.avatarUrl 头像
1343
- * @param {joinConnectionTime} invitee.joinConnectionTime 加入连线时间
1344
- * @param {roomId} invitee.roomId 房间号
1345
- * @param {userId} invitee.userId ID
1346
- * @param {userName} invitee.userName 用户名
1347
- * @param {inviter} inviter 连线请求邀请者
1348
- * @param {avatarUrl} inviter.avatarUrl 头像
1349
- * @param {joinConnectionTime} inviter.joinConnectionTime 加入连线时间
1350
- * @param {roomId} inviter.roomId 房间号
1351
- * @param {userId} inviter.userId ID
1352
- * @param {userName} inviter.userName 用户名
1453
+ * @param {object} option
1454
+ * @param {TUILiveConnectionUser} option.inviter 连线邀请者
1455
+ * @param {TUILiveConnectionUser} option.invitee 连线被邀请者
1353
1456
  *
1354
1457
  * @example
1355
1458
  * const roomEngine = new TUIRoomEngine();
1356
1459
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1357
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestTimeout, (invitee, inviter) => {
1460
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestTimeout, ({ invitee, inviter }) => {
1358
1461
  * console.log('liveConnectionManager.onConnectionRequestTimeout', invitee, inviter);
1359
1462
  * });
1360
1463
  */
1361
1464
  onConnectionRequestTimeout = "onConnectionRequestTimeout"
1465
+ }
1466
+ /**
1467
+ * 直播连线配置信息
1468
+ */
1469
+ type TUIBattleConfig = {
1470
+ duration: number;
1471
+ needResponse?: boolean;
1472
+ extensionInfo?: string;
1473
+ };
1474
+ /**
1475
+ * 直播PK用户信息
1476
+ */
1477
+ type TUIBattleUser = {
1478
+ roomId: string;
1479
+ userId: string;
1480
+ userName: string;
1481
+ avatarUrl: string;
1482
+ score: number;
1483
+ };
1484
+ /**
1485
+ * 直播PK信息
1486
+ */
1487
+ type TUIBattleInfo = {
1488
+ fromUser: TUIBattleUser;
1489
+ toUserList: Array<TUIBattleUser>;
1490
+ extensionInfo: string;
1491
+ battleId: string;
1492
+ needResponse: boolean;
1493
+ duration: number;
1494
+ startTime: number;
1495
+ endTime: number;
1496
+ };
1497
+ declare enum TUIBattleStoppedReason {
1498
+ kStoppedByTimeOver = 0,
1499
+ kStoppedByOtherExit = 1
1500
+ }
1501
+ declare enum TUIBattleCode {
1502
+ kUnknown = -1,
1503
+ kSuccess = 0,
1504
+ kRoomNotExist = 1,
1505
+ kBattling = 2,
1506
+ kBattlingOtherRoom = 3,
1507
+ kRoomExit = 4,
1508
+ kRetry = 5
1509
+ }
1510
+ /**
1511
+ * @since v3.3.0
1512
+ * **TUILiveBattleManager** 事件列表<br>
1513
+ */
1514
+ declare enum TUILiveBattleManagerEvents {
1515
+ /**
1516
+ * @description 接收到PK开始的监听事件
1517
+ * @default 'onBattleStarted'
1518
+ * @event TUILiveBattleManagerEvents#onBattleStarted
1519
+ * @param {object} options
1520
+ * @param {TUIBattleInfo} battleInfo PK信息
1521
+ *
1522
+ * @example
1523
+ * const roomEngine = new TUIRoomEngine();
1524
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1525
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleStarted, ({ battleInfo }) => {
1526
+ * console.log('liveBattleManager.onBattleStarted', battleInfo);
1527
+ * });
1528
+ */
1529
+ onBattleStarted = "onBattleStarted",
1530
+ /**
1531
+ * @description 接收到PK结束的监听事件
1532
+ * @default 'onBattleEnded'
1533
+ * @event TUILiveBattleManagerEvents#onBattleEnded
1534
+ * @param {object} options
1535
+ * @param {TUIBattleInfo} battleInfo PK信息
1536
+ * @param {TUIBattleStoppedReason} reason PK结束原因
1537
+ *
1538
+ * @example
1539
+ * const roomEngine = new TUIRoomEngine();
1540
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1541
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleEnded, ({ battleInfo, reason }) => {
1542
+ * console.log('liveBattleManager.onBattleEnded', battleInfo, reason);
1543
+ * });
1544
+ */
1545
+ onBattleEnded = "onBattleEnded",
1546
+ /**
1547
+ * @description 接收到用户加入PK的监听事件
1548
+ * @default 'onUserJoinBattle'
1549
+ * @event TUILiveBattleManagerEvents#onUserJoinBattle
1550
+ * @param {object} options
1551
+ * @param {String} battleId PK的Id
1552
+ * @param {TUIBattleUser} user PK用户信息
1553
+ *
1554
+ * @example
1555
+ * const roomEngine = new TUIRoomEngine();
1556
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1557
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onUserJoinBattle, ({ battleId, user }) => {
1558
+ * console.log('liveBattleManager.onUserJoinBattle', battleId, user);
1559
+ * });
1560
+ */
1561
+ onUserJoinBattle = "onUserJoinBattle",
1562
+ /**
1563
+ * @description 接收到用户退出PK的监听事件
1564
+ * @default 'onUserExitBattle'
1565
+ * @event TUILiveBattleManagerEvents#onUserExitBattle
1566
+ * @param {object} options
1567
+ * @param {String} battleId PK的Id
1568
+ * @param {TUIBattleUser} user PK用户信息
1569
+ *
1570
+ * @example
1571
+ * const roomEngine = new TUIRoomEngine();
1572
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1573
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onUserExitBattle, ({ battleId, user }) => {
1574
+ * console.log('liveBattleManager.onUserExitBattle', battleId, user);
1575
+ * });
1576
+ */
1577
+ onUserExitBattle = "onUserExitBattle",
1578
+ /**
1579
+ * @description 接收到PK分数变化的监听事件
1580
+ * @default 'onBattleScoreChanged'
1581
+ * @event TUILiveBattleManagerEvents#onBattleScoreChanged
1582
+ * @param {object} options
1583
+ * @param {String} battleId PK的Id
1584
+ * @param {Array<TUIBattleUser>} battleUserList PK用户信息列表
1585
+ *
1586
+ * @example
1587
+ * const roomEngine = new TUIRoomEngine();
1588
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1589
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleScoreChanged, ({ battleId, battleUserList }) => {
1590
+ * console.log('liveBattleManager.onBattleScoreChanged', battleId, battleUserList);
1591
+ * });
1592
+ */
1593
+ onBattleScoreChanged = "onBattleScoreChanged",
1594
+ /**
1595
+ * @description 接收PK请求的监听事件
1596
+ * @default 'onBattleRequestReceived'
1597
+ * @event TUILiveBattleManagerEvents#onBattleRequestReceived
1598
+ * @param {object} options
1599
+ * @param {TUIBattleInfo} battleInfo PK信息
1600
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1601
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1602
+ *
1603
+ * @example
1604
+ * const roomEngine = new TUIRoomEngine();
1605
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1606
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestReceived, ({ battleInfo, inviter, invitee }) => {
1607
+ * console.log('liveBattleManager.onBattleRequestReceived', battleInfo, inviter, invitee);
1608
+ * });
1609
+ */
1610
+ onBattleRequestReceived = "onBattleRequestReceived",
1611
+ /**
1612
+ * @description 接收PK请求取消的监听事件
1613
+ * @default 'onBattleRequestCancelled'
1614
+ * @event TUILiveBattleManagerEvents#onBattleRequestCancelled
1615
+ * @param {object} options
1616
+ * @param {TUIBattleInfo} battleInfo PK信息
1617
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1618
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1619
+ *
1620
+ * @example
1621
+ * const roomEngine = new TUIRoomEngine();
1622
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1623
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestCancelled, ({ battleInfo, inviter, invitee }) => {
1624
+ * console.log('liveBattleManager.onBattleRequestCancelled', battleInfo, inviter, invitee);
1625
+ * });
1626
+ */
1627
+ onBattleRequestCancelled = "onBattleRequestCancelled",
1628
+ /**
1629
+ * @description 接收PK请求超时的监听事件
1630
+ * @default 'onBattleRequestTimeout'
1631
+ * @event TUILiveBattleManagerEvents#onBattleRequestTimeout
1632
+ * @param {object} options
1633
+ * @param {TUIBattleInfo} battleInfo PK信息
1634
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1635
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1636
+ *
1637
+ * @example
1638
+ * const roomEngine = new TUIRoomEngine();
1639
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1640
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestTimeout, ({ battleInfo, inviter, invitee }) => {
1641
+ * console.log('liveBattleManager.onBattleRequestTimeout', battleInfo, inviter, invitee);
1642
+ * });
1643
+ */
1644
+ onBattleRequestTimeout = "onBattleRequestTimeout",
1645
+ /**
1646
+ * @description 接收PK请求接受的监听事件
1647
+ * @default 'onBattleRequestAccept'
1648
+ * @event TUILiveBattleManagerEvents#onBattleRequestAccept
1649
+ * @param {object} options
1650
+ * @param {TUIBattleInfo} battleInfo PK信息
1651
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1652
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1653
+ *
1654
+ * @example
1655
+ * const roomEngine = new TUIRoomEngine();
1656
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1657
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestAccept, ({ battleInfo, inviter, invitee }) => {
1658
+ * console.log('liveBattleManager.onBattleRequestAccept', battleInfo, inviter, invitee);
1659
+ * });
1660
+ */
1661
+ onBattleRequestAccept = "onBattleRequestAccept",
1662
+ /**
1663
+ * @description 接收PK请求被拒绝的监听事件
1664
+ * @default 'onBattleRequestReject'
1665
+ * @event TUILiveBattleManagerEvents#onBattleRequestReject
1666
+ * @param {object} options
1667
+ * @param {TUIBattleInfo} battleInfo PK信息
1668
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1669
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1670
+ *
1671
+ * @example
1672
+ * const roomEngine = new TUIRoomEngine();
1673
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1674
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestReject, ({ battleInfo, inviter, invitee }) => {
1675
+ * console.log('liveBattleManager.onBattleRequestReject', battleInfo, inviter, invitee);
1676
+ * });
1677
+ */
1678
+ onBattleRequestReject = "onBattleRequestReject"
1362
1679
  }
1363
1680
 
1364
1681
  declare class Logger {
@@ -1949,6 +2266,7 @@ declare class TUIConferenceInvitationManager {
1949
2266
  * @class TUILiveListManager
1950
2267
  */
1951
2268
  declare class TUILiveListManager {
2269
+ private roomEngineWASM;
1952
2270
  private liveListManagerWASM;
1953
2271
  private logger;
1954
2272
  private static liveListManager;
@@ -1957,6 +2275,124 @@ declare class TUILiveListManager {
1957
2275
  logger: Logger;
1958
2276
  roomEngineWASM: any;
1959
2277
  });
2278
+ /**
2279
+ * 开始直播
2280
+ *
2281
+ * @description 创建并开始一个新的直播间,房主调用此接口来启动直播
2282
+ * @since 3.3.0
2283
+ * @param {TUILiveInfo} liveInfo 直播间信息,包含房间ID、名称、公告等配置
2284
+ * @returns {Promise<TUILiveInfo>} 返回创建成功后的直播间完整信息,包含CDN流地址等
2285
+ * @throws {TUIError} 可能抛出的错误:
2286
+ * - ERR_ALREADY_ROOM_OWNER: 用户已经是房间所有者
2287
+ * - ERR_INVALID_PARAMETER: 传入的参数不合法
2288
+ * - ERR_LIVE_SERVER_PROCESS_FAILED: 服务器处理请求失败
2289
+ * @example
2290
+ * ```typescript
2291
+ * const liveInfo = {
2292
+ * roomId: '123',
2293
+ * roomType: TUIRoomType.kLivingRoom,
2294
+ * name: 'ABC',
2295
+ * notice: 'this is a description',
2296
+ * isSeatEnabled: true,
2297
+ * seatMode: TUISeatMode.kApplyToTake,
2298
+ * seatLayoutTemplateId: 200,
2299
+ * coverUrl: '',
2300
+ * backgroundUrl: '',
2301
+ * categoryList: [],
2302
+ * activityStatus: 1,
2303
+ * isMessageDisableForAllUser: false,
2304
+ * isGiftEnabled: false,
2305
+ * isLikeEnabled: false,
2306
+ * isPublicVisible: false,
2307
+ * keepOwnerOnSeat: false,
2308
+ * };
2309
+ * const roomEngine = new TUIRoomEngine();
2310
+ * const liveListManager = roomEngine.getLiveListManager();
2311
+ * const resultLiveInfo = await liveListManager.startLive(liveInfo);
2312
+ * console.log('直播开始成功,CDN流地址:', resultLiveInfo.cdnStreamUrl);
2313
+ * ```
2314
+ */
2315
+ startLive(liveInfo: TUILiveInfo): Promise<TUILiveInfo>;
2316
+ /**
2317
+ * 停止直播
2318
+ *
2319
+ * @description 结束当前正在进行的直播,只有房主可以调用此接口停止直播
2320
+ * @since 3.3.0
2321
+ * @returns {Promise<TUILiveStatisticsData>} 返回直播统计数据,包含观众人数、礼物数量、点赞数等信息
2322
+ * @throws {TUIError} 可能抛出的错误:
2323
+ * - ERR_DESTROY_ROOM_NO_PERMISSION: 没有权限停止直播(仅房主可操作)
2324
+ * - ERR_OPERATION_INVALID_BEFORE_ENTER_ROOM: 需要进房后才可使用此功能
2325
+ * - ERR_LIVE_SERVER_PROCESS_FAILED: 服务器处理请求失败
2326
+ * @example
2327
+ * ```typescript
2328
+ * try {
2329
+ * const roomEngine = new TUIRoomEngine();
2330
+ * const liveListManager = roomEngine.getLiveListManager();
2331
+ * const statistics = await liveListManager.stopLive();
2332
+ * console.log('直播结束,统计数据:', {
2333
+ * 观众人数: statistics.totalViewers,
2334
+ * 礼物总数: statistics.totalGiftsSent,
2335
+ * 点赞总数: statistics.totalLikesReceived
2336
+ * });
2337
+ * } catch (error) {
2338
+ * console.error('停止直播失败:', error);
2339
+ * }
2340
+ * ```
2341
+ */
2342
+ stopLive(): Promise<TUILiveStatisticsData>;
2343
+ /**
2344
+ * 加入直播
2345
+ *
2346
+ * @description 观众加入指定的直播间,开始观看直播内容
2347
+ * @since 3.3.0
2348
+ * @param {string} roomId 要加入的直播间ID
2349
+ * @returns {Promise<TUILiveInfo>} 返回加入成功后的直播间信息,包含直播间名称、公告等详细信息
2350
+ * @throws {TUIError} 可能抛出的错误:
2351
+ * - ERR_ALREADY_ROOM_ENTER: 用户已经进入房间,重复进入房间操作
2352
+ * - ERR_INVALID_PARAMETER: 房间ID参数不合法
2353
+ * - ERR_LIVE_REQUEST_SERVER_TIMEOUT: 请求服务器超时
2354
+ * - ERR_LIVE_DISCONNECTED: 直播连接断开
2355
+ * @example
2356
+ * ```typescript
2357
+ * try {
2358
+ * const roomEngine = new TUIRoomEngine();
2359
+ * const liveListManager = roomEngine.getLiveListManager();
2360
+ * const liveInfo = await liveListManager.joinLive('live_room_123');
2361
+ * console.log('成功加入直播间:', {
2362
+ * 房间名称: liveInfo.name,
2363
+ * 房间公告: liveInfo.notice,
2364
+ * CDN流地址: liveInfo.cdnStreamUrl
2365
+ * });
2366
+ * } catch (error) {
2367
+ * console.error('加入直播间失败:', error);
2368
+ * }
2369
+ * ```
2370
+ */
2371
+ joinLive(roomId: string): Promise<TUILiveInfo>;
2372
+ /**
2373
+ * 离开直播
2374
+ *
2375
+ * @description 观众退出当前正在观看的直播间,结束观看直播
2376
+ * @since 3.3.0
2377
+ * @returns {Promise<void>} 无返回值,成功离开直播间后Promise将resolve
2378
+ * @throws {TUIError} 可能抛出的错误:
2379
+ * - ERR_OPERATION_INVALID_BEFORE_ENTER_ROOM: 需要进房后才可使用此功能
2380
+ * - ERR_EXIT_NOT_SUPPORTED_FOR_ROOM_OWNER: 房主不支持退房操作(房主只能停止直播)
2381
+ * - ERR_LIVE_SERVER_PROCESS_FAILED: 服务器处理请求失败
2382
+ * @note 如果是房主想要结束直播,应该使用 stopLive() 接口而不是 leaveLive()
2383
+ * @example
2384
+ * ```typescript
2385
+ * try {
2386
+ * const roomEngine = new TUIRoomEngine();
2387
+ * const liveListManager = roomEngine.getLiveListManager();
2388
+ * await liveListManager.leaveLive();
2389
+ * console.log('成功离开直播间');
2390
+ * } catch (error) {
2391
+ * console.error('离开直播间失败:', error);
2392
+ * }
2393
+ * ```
2394
+ */
2395
+ leaveLive(): Promise<void>;
1960
2396
  /**
1961
2397
  * 修改直播间信息
1962
2398
  *
@@ -1988,6 +2424,7 @@ declare class TUILiveListManager {
1988
2424
  coverUrl?: string;
1989
2425
  isPublicVisible?: boolean;
1990
2426
  backgroundUrl?: string;
2427
+ seatLayoutTemplateId?: number;
1991
2428
  }): Promise<void>;
1992
2429
  /**
1993
2430
  * 获取直播间信息
@@ -2029,6 +2466,35 @@ declare class TUILiveListManager {
2029
2466
  cursor: string;
2030
2467
  count: number;
2031
2468
  }): Promise<TUILiveListResult>;
2469
+ /**
2470
+ * 进房前预览视频流
2471
+ * @since 3.3.0
2472
+ * @param options
2473
+ * @param options.roomId 房间 Id
2474
+ * @param options.isMuteAudio 是否静音预览
2475
+ * @param options.view 播放视频流区域
2476
+ */
2477
+ startPreloadVideoStream(options: {
2478
+ roomId: string;
2479
+ isMuteAudio: boolean;
2480
+ view: string;
2481
+ }): Promise<void>;
2482
+ /**
2483
+ * 停止预览视频流
2484
+ * @since 3.3.0
2485
+ * @param options
2486
+ * @param options.roomId 房间 Id
2487
+ */
2488
+ stopPreloadVideoStream(options: {
2489
+ roomId: string;
2490
+ }): Promise<void>;
2491
+ /**
2492
+ * @private
2493
+ * 调用 TUIRoomEngineWASM 的 CallAPI 方法
2494
+ * @param funcName
2495
+ * @param jsonString
2496
+ */
2497
+ private JSCallNativeCallAPIPromise;
2032
2498
  private JSCallNativeFunctionPromise;
2033
2499
  /**
2034
2500
  * 监听 TUILiveListManager 事件
@@ -2129,8 +2595,8 @@ declare class TUILiveLayoutManager {
2129
2595
  * {
2130
2596
  * "LocationX": 0, // 以画面左上角为原点的 x 坐标
2131
2597
  * "LocationY": 0, // 以画面左上角为原点的 y 坐标
2132
- * "ImageWidth": 1920, // 调整后的画面宽度
2133
- * "ImageHeight": 1080, // 调整后的画面高度
2598
+ * "ImageWidth": 1080, // 调整后的画面宽度
2599
+ * "ImageHeight": 960, // 调整后的画面高度
2134
2600
  * "ZOrder": 0, // 画面层级
2135
2601
  * "StreamType": 0, // 0 摄像头, 1 屏幕共享, 2 白板, 3 自定义
2136
2602
  * "Member_Account": "admin001", // 该路流的用户ID
@@ -2171,6 +2637,92 @@ declare class TUILiveConnectionManager {
2171
2637
  logger: Logger;
2172
2638
  roomEngineWASM: any;
2173
2639
  });
2640
+ /**
2641
+ * 请求跨房连线
2642
+ *
2643
+ * @param {object} options
2644
+ * @param {Array<string>} options.roomIdList 待邀请的连线房间ID列表
2645
+ * @param {number} options.timeout 请求超时时间, 单位 s
2646
+ * @param {string} options.extensionInfo 扩展信息, 可选, 默认为: ''
2647
+ * @returns {Promise<void>}
2648
+ *
2649
+ * @example
2650
+ * const roomEngine = new TUIRoomEngine();
2651
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2652
+ * liveConnectionManager.requestConnection({
2653
+ * roomIdList: ['roomId1','roomId2'],
2654
+ * timeout: 10,
2655
+ * extensionInfo: 'extension info'
2656
+ * });
2657
+ */
2658
+ requestConnection(options: {
2659
+ roomIdList: Array<string>;
2660
+ timeout: number;
2661
+ extensionInfo?: string;
2662
+ }): Promise<void>;
2663
+ /**
2664
+ * 取消跨房连线请求
2665
+ *
2666
+ * @param {object} options
2667
+ * @param {Array<string>} options.roomIdList 被取消连线请求的房间Id列表
2668
+ * @returns {Promise<void>}
2669
+ *
2670
+ * @example
2671
+ * const roomEngine = new TUIRoomEngine();
2672
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2673
+ * liveConnectionManager.cancelConnectionRequest({
2674
+ * roomIdList: ['roomId1', 'roomId2']
2675
+ * });
2676
+ */
2677
+ cancelConnectionRequest(options: {
2678
+ roomIdList: Array<string>;
2679
+ }): Promise<void>;
2680
+ /**
2681
+ * 同意连线请求
2682
+ *
2683
+ * @param {object} options
2684
+ * @param {string} options.roomId 直播房间 ID
2685
+ * @returns {Promise<void>}
2686
+ *
2687
+ * @example
2688
+ * const roomEngine = new TUIRoomEngine();
2689
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2690
+ * liveConnectionManager.acceptConnection({
2691
+ * roomId: 'roomId'
2692
+ * });
2693
+ */
2694
+ acceptConnection(options: {
2695
+ roomId: string;
2696
+ }): Promise<void>;
2697
+ /**
2698
+ * 拒绝连线请求
2699
+ *
2700
+ * @param {object} options
2701
+ * @param {string} options.roomId 直播房间 ID
2702
+ * @returns {Promise<void>}
2703
+ *
2704
+ * @example
2705
+ * const roomEngine = new TUIRoomEngine();
2706
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2707
+ * liveConnectionManager.rejectConnection({
2708
+ * roomId: 'roomId'
2709
+ * });
2710
+ */
2711
+ rejectConnection(options: {
2712
+ roomId: string;
2713
+ }): Promise<void>;
2714
+ /**
2715
+ * 断开直播连线
2716
+ *
2717
+ * @returns {Promise<void>}
2718
+ *
2719
+ * @example
2720
+ * const roomEngine = new TUIRoomEngine();
2721
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2722
+ * liveConnectionManager.disconnect();
2723
+ */
2724
+ disconnect(): Promise<void>;
2725
+ private JSCallNativeFunctionPromise;
2174
2726
  /**
2175
2727
  * 监听 TUILiveConnectionManager 事件
2176
2728
  * @param {TUILiveConnectionManagerEvents} event 事件名
@@ -2182,7 +2734,7 @@ declare class TUILiveConnectionManager {
2182
2734
  * const callback = (inviter) => {
2183
2735
  * console.log('liveConnectionManager.onConnectionRequestReceived', inviter);
2184
2736
  * };
2185
- * liveConnectionManager.on(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
2737
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onLiveVideoLayoutChanged, callback);
2186
2738
  */
2187
2739
  on(event: TUILiveConnectionManagerEvents, func: (...args: any[]) => void): void;
2188
2740
  /**
@@ -2196,73 +2748,149 @@ declare class TUILiveConnectionManager {
2196
2748
  * const callback = (inviter) => {
2197
2749
  * console.log('liveConnectionManager.onConnectionRequestReceived', inviter);
2198
2750
  * };
2199
- * liveConnectionManager.off(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
2751
+ * liveConnectionManager.off(TUILiveConnectionManagerEvents.onLiveVideoLayoutChanged, callback);
2200
2752
  */
2201
2753
  off(event: TUILiveConnectionManagerEvents, func: (...args: any[]) => void): void;
2754
+ private observerFunction;
2755
+ }
2756
+
2757
+ /**
2758
+ * 直播PK
2759
+ * @class TUILiveBattleManager
2760
+ */
2761
+ declare class TUILiveBattleManager {
2762
+ private liveBattleManagerWASM;
2763
+ private logger;
2764
+ private static liveBattleManager;
2765
+ constructor(options: {
2766
+ Module: any;
2767
+ logger: Logger;
2768
+ roomEngineWASM: any;
2769
+ });
2202
2770
  /**
2203
- * 请求跨房连线
2771
+ * 请求PK
2204
2772
  *
2205
- * @param {Array<string>} roomIdList 待邀请的连线房间ID列表
2206
- * @param {string} timeOut 请求超时时间, 单位 s
2207
- * @param {string} extensionInfo 扩展信息, 可选, 默认为: ''
2773
+ * @param {object} options
2774
+ * @param {TUIBattleConfig} options.config
2775
+ * @param {Array<string>} options.userIdList
2776
+ * @param {number} options.timeOut
2208
2777
  * @returns {Promise<void>}
2209
2778
  *
2210
2779
  * @example
2211
2780
  * const roomEngine = new TUIRoomEngine();
2212
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2213
- * liveConnectionManager.requestConnection(['roomId1','roomId2'], 10);
2781
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2782
+ * liveBattleManager.requestBattle({
2783
+ * config: {duration: 100, needResponse: true},
2784
+ * userIdList: ['userId1'],
2785
+ * timeout: 10
2786
+ * });
2214
2787
  */
2215
- requestConnection(roomIdList: Array<string>, timeOut: number, extensionInfo?: string): Promise<void>;
2788
+ requestBattle(options: {
2789
+ config: TUIBattleConfig;
2790
+ userIdList: Array<string>;
2791
+ timeout: number;
2792
+ }): Promise<any>;
2216
2793
  /**
2217
- * 取消跨房连线请求
2794
+ * 取消PK请求
2218
2795
  *
2219
- * @param {Array<string>} roomIdList 被取消连线请求的房间Id列表
2796
+ * @param {object} options
2797
+ * @param {string} options.battleId
2798
+ * @param {Array<string>} options.userIdList
2220
2799
  * @returns {Promise<void>}
2221
2800
  *
2222
2801
  * @example
2223
2802
  * const roomEngine = new TUIRoomEngine();
2224
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2225
- * liveConnectionManager.cancelConnectionRequest(['roomId1', 'roomId2']);
2803
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2804
+ * liveBattleManager.cancelBattleRequest({
2805
+ * battleId: 'battleId',
2806
+ * userIdList: ['userId1'],
2807
+ * });
2226
2808
  */
2227
- cancelConnectionRequest(roomIdList: Array<string>): Promise<void>;
2809
+ cancelBattleRequest(options: {
2810
+ battleId: string;
2811
+ userIdList: Array<string>;
2812
+ }): Promise<void>;
2228
2813
  /**
2229
- * 同意连线请求
2814
+ * 接受PK请求
2230
2815
  *
2231
- * @param {string} roomId 直播房间 ID
2816
+ * @param {object} options
2817
+ * @param {string} options.battleId
2232
2818
  * @returns {Promise<void>}
2233
2819
  *
2234
2820
  * @example
2235
2821
  * const roomEngine = new TUIRoomEngine();
2236
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2237
- * liveConnectionManager.acceptConnection('roomId');
2822
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2823
+ * liveBattleManager.acceptBattle({
2824
+ * battleId: 'battleId',
2825
+ * });
2238
2826
  */
2239
- acceptConnection(roomId: string): Promise<void>;
2827
+ acceptBattle(options: {
2828
+ battleId: string;
2829
+ }): Promise<void>;
2240
2830
  /**
2241
- * 拒绝连线请求
2831
+ * 拒绝PK请求
2242
2832
  *
2243
- * @param {string} roomId 直播房间 ID
2833
+ * @param {object} options
2834
+ * @param {string} options.battleId
2244
2835
  * @returns {Promise<void>}
2245
2836
  *
2246
2837
  * @example
2247
2838
  * const roomEngine = new TUIRoomEngine();
2248
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2249
- * liveConnectionManager.rejectConnection('roomId');
2839
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2840
+ * liveBattleManager.rejectBattle({
2841
+ * battleId: 'battleId',
2842
+ * });
2250
2843
  */
2251
- rejectConnection(roomId: string): Promise<void>;
2844
+ rejectBattle(options: {
2845
+ battleId: string;
2846
+ }): Promise<void>;
2252
2847
  /**
2253
- * 断开直播连线
2848
+ * 退出PK
2254
2849
  *
2850
+ * @param {object} options
2851
+ * @param {string} options.battleId
2255
2852
  * @returns {Promise<void>}
2256
2853
  *
2257
2854
  * @example
2258
2855
  * const roomEngine = new TUIRoomEngine();
2259
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2260
- * liveConnectionManager.disconnect();
2856
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2857
+ * liveBattleManager.exitBattle({
2858
+ * battleId: 'battleId',
2859
+ * });
2261
2860
  */
2262
- disconnect(): Promise<void>;
2861
+ exitBattle(options: {
2862
+ battleId: string;
2863
+ }): Promise<void>;
2864
+ /**
2865
+ * 监听 TUILiveBattleManager 事件
2866
+ * @param {TUILiveBattleManagerEvents} event 事件名
2867
+ * @param func 事件回调函数
2868
+ *
2869
+ * @example
2870
+ * const roomEngine = new TUIRoomEngine();
2871
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2872
+ * const callback = (battleInfo) => {
2873
+ * console.log('liveBattleManager.onBattleStarted', battleInfo);
2874
+ * };
2875
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleStarted, callback);
2876
+ */
2877
+ on(event: TUILiveBattleManagerEvents, func: (...args: any[]) => void): void;
2878
+ /**
2879
+ * 取消监听 TUILiveBattleManager 事件
2880
+ * @param {TUILiveBattleManagerEvents} event 事件名
2881
+ * @param func 事件回调函数
2882
+ *
2883
+ * @example
2884
+ * const roomEngine = new TUIRoomEngine();
2885
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2886
+ * const callback = (battleInfo) => {
2887
+ * console.log('liveBattleManager.onBattleStarted', battleInfo);
2888
+ * };
2889
+ * liveBattleManager.off(TUILiveBattleManagerEvents.onBattleStarted, callback);
2890
+ */
2891
+ off(event: TUILiveBattleManagerEvents, func: (...args: any[]) => void): void;
2263
2892
  private JSCallNativeFunctionPromise;
2264
2893
  private observerFunction;
2265
- private handleLiveConnectionEvent;
2266
2894
  }
2267
2895
 
2268
2896
  /**
@@ -2281,6 +2909,7 @@ declare class TUIRoomEngine {
2281
2909
  private liveListManager;
2282
2910
  private liveLayoutManager;
2283
2911
  private liveConnectionManager;
2912
+ private liveBattleManager;
2284
2913
  private static userId;
2285
2914
  private static sdkAppId;
2286
2915
  private static Module;
@@ -3653,6 +4282,17 @@ declare class TUIRoomEngine {
3653
4282
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
3654
4283
  */
3655
4284
  getLiveConnectionManager(): TUILiveConnectionManager;
4285
+ /**
4286
+ * v3.3.0 版本起支持 getLiveBattleManager 获取 TUILiveBattleManager 模块
4287
+ *
4288
+ * @since v3.3.0
4289
+ * @returns {TUILiveBattleManager}
4290
+ *
4291
+ * @example
4292
+ * const roomEngine = new TUIRoomEngine();
4293
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
4294
+ */
4295
+ getLiveBattleManager(): TUILiveBattleManager;
3656
4296
  /**
3657
4297
  * v2.6.0 版本起支持使用 getConferenceInvitationManager 获取 conferenceInvitation 模块
3658
4298
  * @since v2.6.0
@@ -3695,4 +4335,4 @@ declare class TUIRoomEngine {
3695
4335
  private static handleSetFramework;
3696
4336
  }
3697
4337
 
3698
- export { TRTCRole, TUIAudioQuality, TUIAudioRoute, TUICaptureSourceType, TUIChangeReason, TUIConferenceCancelReason, type TUIConferenceInfo, TUIConferenceInvitationManager, TUIConferenceInvitationManagerEvents, TUIConferenceListManager, TUIConferenceListManagerEvents, type TUIConferenceModifyInfo, TUIConferenceStatus, type TUIDeviceInfo, type TUIEnterRoomOptions, TUIErrorCode, type TUIInvitation, TUIInvitationCode, TUIInvitationRejectedReason, TUIInvitationStatus, TUIKickedOutOfRoomReason, TUILiveConnectionManagerEvents, type TUILiveInfo, TUILiveLayoutManager, TUILiveLayoutManagerEvents, TUILiveListManager, TUILiveListManagerEvents, type TUILiveListResult, TUILiveModifyFlag, type TUILiveModifyInfo, type TUILoginUserInfo, TUIMediaDevice, TUIMediaDeviceState, TUIMediaDeviceType, type TUIMessage, type TUINetwork, TUINetworkQuality, type TUIRequest, TUIRequestAction, type TUIRequestCallback, TUIRequestCallbackType, TUIResolutionMode, TUIRole, TUIRoomDeviceManager, TUIRoomDeviceMangerEvents, TUIRoomDismissedReason, TUIRoomEvents, type TUIRoomInfo, TUIRoomType, type TUISeatInfo, type TUISeatLockParams, TUISeatMode, type TUIUserInfo, type TUIVideoEncoderParams, TUIVideoQuality, TUIVideoStreamType, TUIRoomEngine as default };
4338
+ export { TRTCRole, TUIAudioQuality, TUIAudioRoute, TUIBattleCode, type TUIBattleConfig, type TUIBattleInfo, TUIBattleStoppedReason, type TUIBattleUser, TUICaptureSourceType, TUIChangeReason, TUIConferenceCancelReason, type TUIConferenceInfo, TUIConferenceInvitationManager, TUIConferenceInvitationManagerEvents, TUIConferenceListManager, TUIConferenceListManagerEvents, type TUIConferenceModifyInfo, TUIConferenceStatus, type TUIDeviceInfo, TUIDeviceStatus, type TUIEnterRoomOptions, TUIErrorCode, type TUIInvitation, TUIInvitationCode, TUIInvitationRejectedReason, TUIInvitationStatus, TUIKickedOutOfRoomReason, TUILiveBattleManagerEvents, TUILiveConnectionManagerEvents, type TUILiveConnectionUser, type TUILiveInfo, TUILiveLayoutManager, TUILiveLayoutManagerEvents, TUILiveListManager, TUILiveListManagerEvents, type TUILiveListResult, TUILiveModifyFlag, type TUILiveModifyInfo, type TUILiveStatisticsData, type TUILoginUserInfo, TUIMediaDevice, TUIMediaDeviceState, TUIMediaDeviceType, type TUIMessage, type TUINetwork, TUINetworkQuality, type TUIRequest, TUIRequestAction, type TUIRequestCallback, TUIRequestCallbackType, TUIResolutionMode, TUIRole, TUIRoomDeviceManager, TUIRoomDeviceMangerEvents, TUIRoomDismissedReason, TUIRoomEvents, type TUIRoomInfo, TUIRoomType, type TUISeatInfo, type TUISeatLayout, type TUISeatLockParams, TUISeatMode, type TUISeatRegion, type TUIUserInfo, type TUIVideoEncoderParams, TUIVideoQuality, TUIVideoStreamType, TUIRoomEngine as default };