@tencentcloud/tuiroom-engine-js 3.2.1 → 3.3.0-beta.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.
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;
@@ -1170,15 +1182,43 @@ declare enum TUIConferenceInvitationManagerEvents {
1170
1182
  onInvitationStatusChanged = "onInvitationStatusChanged"
1171
1183
  }
1172
1184
  type TUILiveInfo = {
1173
- basicRoomInfo: TUIRoomInfo;
1185
+ roomId: string;
1186
+ roomType: TUIRoomType;
1187
+ name: string;
1188
+ notice: string;
1189
+ isMessageDisableForAllUser: boolean;
1174
1190
  isGiftEnabled: boolean;
1175
1191
  isLikeEnabled: boolean;
1176
1192
  isPublicVisible: boolean;
1177
- activityStatus: number;
1178
- viewCount: number;
1193
+ isSeatEnabled: boolean;
1194
+ keepOwnerOnSeat: boolean;
1195
+ seatLayoutTemplateId: number;
1196
+ maxSeatCount: number;
1197
+ seatMode: TUISeatMode;
1179
1198
  coverUrl: string;
1180
1199
  backgroundUrl: string;
1181
1200
  categoryList: Array<number>;
1201
+ activityStatus: number;
1202
+ readonly roomOwner?: string;
1203
+ readonly ownerName?: string;
1204
+ readonly ownerAvatarUrl?: string;
1205
+ readonly createTime?: number;
1206
+ readonly totalViewers?: number;
1207
+ readonly isUnlimitedRoomEnabled?: boolean;
1208
+ readonly cdnStreamUrl?: string;
1209
+ readonly lebSecretKey?: string;
1210
+ readonly lebEncrypted?: string;
1211
+ readonly lebSignature?: string;
1212
+ };
1213
+ /**
1214
+ * 直播连线用户信息
1215
+ */
1216
+ type TUILiveConnectionUser = {
1217
+ roomId: string;
1218
+ userId: string;
1219
+ userName: string;
1220
+ avatarUrl: string;
1221
+ joinConnectionTime: number;
1182
1222
  };
1183
1223
  type TUILiveModifyInfo = {
1184
1224
  roomId: string;
@@ -1187,16 +1227,22 @@ type TUILiveModifyInfo = {
1187
1227
  coverUrl?: string;
1188
1228
  backgroundUrl?: string;
1189
1229
  categoryList?: Array<number>;
1230
+ seatLayoutTemplateId?: number;
1190
1231
  };
1191
1232
  declare enum TUILiveModifyFlag {
1192
1233
  kNone = 0,
1193
- kActivityStatus = 256,
1194
- kCoverUrl = 512,
1195
- kCategory = 1024,
1196
- kEnableGift = 2048,
1197
- kEnableLike = 4096,
1198
- kPublic = 8192,
1199
- kBackgroundUrl = 262144
1234
+ kName = 1,
1235
+ kNotice = 2,
1236
+ kDisableMessage = 4,
1237
+ kEnableGift = 8,
1238
+ kEnableLike = 16,
1239
+ kPublic = 32,
1240
+ kTakeSeatMode = 64,
1241
+ kCoverUrl = 128,
1242
+ kBackgroundUrl = 256,
1243
+ kCategory = 512,
1244
+ kActivityStatus = 1024,
1245
+ kSeatLayoutTemplateId = 2048
1200
1246
  }
1201
1247
  type TUILiveListResult = {
1202
1248
  cursor: string;
@@ -1233,8 +1279,99 @@ declare enum TUILiveLayoutManagerEvents {
1233
1279
  * };
1234
1280
  * liveLayoutManager.on(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
1235
1281
  */
1236
- onLiveVideoLayoutChanged = "onLiveVideoLayoutChanged"
1282
+ onLiveVideoLayoutChanged = "onLiveVideoLayoutChanged",
1283
+ /**
1284
+ * @description 麦位排版信息发生变化事件回调
1285
+ * @since v3.3.0
1286
+ * @default 'onSeatLayoutChanged'
1287
+ * @event TUILiveLayoutManagerEvents#onSeatLayoutChanged
1288
+ * @param {object} option
1289
+ * @param {string} option.roomId 房间 ID
1290
+ * @param {TUISeatLayout} option.seatLayout 麦位排版信息
1291
+ *
1292
+ * @example
1293
+ * const roomEngine = new TUIRoomEngine();
1294
+ * const liveLayoutManager = roomEngine.getLiveLayoutManager();
1295
+ * const callback = ({ roomId, seatLayout }) => {
1296
+ * console.log('liveLayoutManager.onSeatLayoutChanged', roomId, seatLayout);
1297
+ * });
1298
+ * liveLayoutManager.on(TUILiveLayoutManagerEvents.onSeatLayoutChanged, callback);
1299
+ */
1300
+ onSeatLayoutChanged = "onSeatLayoutChanged"
1237
1301
  }
1302
+ /** 麦上用户的媒体状态信息
1303
+ * @typedef {object} TUIDeviceStatus
1304
+ * @property {number} TUIDeviceStatusOpened 当前设备处于打开状态
1305
+ * @property {number} TUIDeviceStatusClosedBySelf 当前设备处于关闭状态,且是用户主动关闭
1306
+ * @property {number} TUIDeviceStatusClosedByAdmin 当前设备处于关闭状态,且是被房主/管理员强制关闭
1307
+ */
1308
+ declare enum TUIDeviceStatus {
1309
+ TUIDeviceStatusOpened = 0,
1310
+ TUIDeviceStatusClosedBySelf = 1,
1311
+ TUIDeviceStatusClosedByAdmin = 2
1312
+ }
1313
+ /**
1314
+ * 麦位排版信息
1315
+ * @typedef {object} TUISeatRegion
1316
+ * @property {string} roomId 直播间 ID
1317
+ * @property {number} seatIndex 麦位序号
1318
+ * @property {boolean} isSeatLocked 是否被锁定
1319
+ * @property {string} userId 用户 ID
1320
+ * @property {string} userName 用户名称
1321
+ * @property {string} userAvatar 用户头像
1322
+ * @property {TUIDeviceStatus} userMicrophoneStatus 用户麦克风状态
1323
+ * @property {TUIDeviceStatus} userCameraStatus 用户摄像头状态
1324
+ * @property {number} x 麦位 X 坐标
1325
+ * @property {number} y 麦位 Y 坐标
1326
+ * @property {number} width 麦位宽度
1327
+ * @property {number} height 麦位高度
1328
+ * @property {number} zorder 麦位 Z 轴顺序
1329
+ */
1330
+ type TUISeatRegion = {
1331
+ roomId: string;
1332
+ seatIndex: number;
1333
+ isSeatLocked: boolean;
1334
+ userId: string;
1335
+ userName: string;
1336
+ userAvatar: string;
1337
+ userMicrophoneStatus: TUIDeviceStatus;
1338
+ userCameraStatus: TUIDeviceStatus;
1339
+ x: number;
1340
+ y: number;
1341
+ width: number;
1342
+ height: number;
1343
+ zorder: number;
1344
+ };
1345
+ /**
1346
+ * 直播间麦位排版
1347
+ * @typedef {object} TUISeatLayout
1348
+ * @property {number} templateId 麦位排版模板 ID
1349
+ * @property {number} canvasWidth 麦位排版画布宽度
1350
+ * @property {number} canvasHeight 麦位排版画布高度
1351
+ * @property {Array<TUISeatRegion>} regions 麦位排版区域列表
1352
+ */
1353
+ type TUISeatLayout = {
1354
+ templateId: number;
1355
+ canvasWidth: number;
1356
+ canvasHeight: number;
1357
+ regions: Array<TUISeatRegion>;
1358
+ };
1359
+ /**
1360
+ * 直播间统计信息
1361
+ * @typedef {object} TUILiveStatisticsData
1362
+ * @property {number} totalViewers 观众人数
1363
+ * @property {number} totalGiftsSent 礼物发送总数
1364
+ * @property {number} totalGiftCoins 礼物总价值
1365
+ * @property {number} totalUniqueGiftSenders 礼物发送者总数
1366
+ * @property {number} totalLikesReceived 点赞总数
1367
+ */
1368
+ type TUILiveStatisticsData = {
1369
+ totalViewers: number;
1370
+ totalGiftsSent: number;
1371
+ totalGiftCoins: number;
1372
+ totalUniqueGiftSenders: number;
1373
+ totalLikesReceived: number;
1374
+ };
1238
1375
  /**
1239
1376
  * @since v3.0.5
1240
1377
  * **TUILiveConnectionManager** 事件列表<br>
@@ -1244,18 +1381,16 @@ declare enum TUILiveConnectionManagerEvents {
1244
1381
  * @description 接收到连线请求的监听事件
1245
1382
  * @default 'onConnectionRequestReceived'
1246
1383
  * @event TUILiveConnectionManagerEvents#onConnectionRequestReceived
1247
- * @param {inviter} options 连线请求发起者
1248
- * @param {avatarUrl} options.avatarUrl 头像
1249
- * @param {joinConnectionTime} options.joinConnectionTime 加入连线时间
1250
- * @param {roomId} options.roomId 房间号
1251
- * @param {userId} options.userId ID
1252
- * @param {userName} options.userName 用户名
1384
+ * @param {object} options
1385
+ * @param {TUILiveConnectionUser} options.inviter 连线邀请者
1386
+ * @param {Array<TUILiveConnectionUser>} options.inviteeList 连线被邀请者列表
1387
+ * @param {string} options.extensionInfo 扩展信息
1253
1388
  *
1254
1389
  * @example
1255
1390
  * const roomEngine = new TUIRoomEngine();
1256
1391
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1257
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestReceived, ({ avatarUrl, joinConnectionTime, roomId, userId, userName }) => {
1258
- * console.log('liveConnectionManager.onConnectionRequestReceived', avatarUrl, joinConnectionTime, roomId, userId, userName);
1392
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestReceived, ({ inviter, inviteeList, extensionInfo }) => {
1393
+ * console.log('liveConnectionManager.onConnectionRequestReceived', inviter, inviteeList, extensionInfo);
1259
1394
  * });
1260
1395
  */
1261
1396
  onConnectionRequestReceived = "onConnectionRequestReceived",
@@ -1264,9 +1399,9 @@ declare enum TUILiveConnectionManagerEvents {
1264
1399
  * @default 'onConnectionUserListChanged'
1265
1400
  * @event TUILiveConnectionManagerEvents#onConnectionUserListChanged
1266
1401
  * @param {object} options
1267
- * @param {connectedList} options.connectedList 包含连线房间所有主播列表
1268
- * @param {joinedList} options.joinedList 本次事件变更加入连线房间的主播列表
1269
- * @param {leavedList} options.leavedList 本次事件变更离开连线房间的主播列表
1402
+ * @param {Array<TUILiveConnectionUser>} options.connectedList 包含连线房间所有主播列表
1403
+ * @param {Array<TUILiveConnectionUser>} options.joinedList 本次事件变更加入连线房间的主播列表
1404
+ * @param {Array<TUILiveConnectionUser>} options.leavedList 本次事件变更离开连线房间的主播列表
1270
1405
  *
1271
1406
  * @example
1272
1407
  * const roomEngine = new TUIRoomEngine();
@@ -1280,18 +1415,14 @@ declare enum TUILiveConnectionManagerEvents {
1280
1415
  * @description 连线请求被取消的监听事件
1281
1416
  * @default 'onConnectionRequestCancelled'
1282
1417
  * @event TUILiveConnectionManagerEvents#onConnectionRequestCancelled
1283
- * @param {invitee} options 连线请求被邀请者
1284
- * @param {avatarUrl} options.avatarUrl 头像
1285
- * @param {joinConnectionTime} options.joinConnectionTime 加入连线时间
1286
- * @param {roomId} options.roomId 房间号
1287
- * @param {userId} options.userId ID
1288
- * @param {userName} options.userName 用户名
1418
+ * @param {object} options
1419
+ * @param {TUILiveConnectionUser} options.inviter 连线邀请者
1289
1420
  *
1290
1421
  * @example
1291
1422
  * const roomEngine = new TUIRoomEngine();
1292
1423
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1293
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestCancelled, ({ avatarUrl, joinConnectionTime, roomId, userId, userName }) => {
1294
- * console.log('liveConnectionManager.onConnectionRequestCancelled', avatarUrl, joinConnectionTime, roomId, userId, userName);
1424
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestCancelled, ({ inviter }) => {
1425
+ * console.log('liveConnectionManager.onConnectionRequestCancelled', inviter);
1295
1426
  * });
1296
1427
  */
1297
1428
  onConnectionRequestCancelled = "onConnectionRequestCancelled",
@@ -1299,18 +1430,14 @@ declare enum TUILiveConnectionManagerEvents {
1299
1430
  * @description 连线请求被同意的监听事件
1300
1431
  * @default 'onConnectionRequestAccept'
1301
1432
  * @event TUILiveConnectionManagerEvents#onConnectionRequestAccept
1302
- * @param {invitee} options 连线请求被邀请者
1303
- * @param {avatarUrl} options.avatarUrl 头像
1304
- * @param {joinConnectionTime} options.joinConnectionTime 加入连线时间
1305
- * @param {roomId} options.roomId 房间号
1306
- * @param {userId} options.userId ID
1307
- * @param {userName} options.userName 用户名
1433
+ * @param {object} options
1434
+ * @param {TUILiveConnectionUser} options.invitee 连线被邀请者
1308
1435
  *
1309
1436
  * @example
1310
1437
  * const roomEngine = new TUIRoomEngine();
1311
1438
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1312
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestAccept, ({ avatarUrl, joinConnectionTime, roomId, userId, userName }) => {
1313
- * console.log('liveConnectionManager.onConnectionRequestAccept', avatarUrl, joinConnectionTime, roomId, userId, userName);
1439
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestAccept, ({ invitee }) => {
1440
+ * console.log('liveConnectionManager.onConnectionRequestAccept', invitee);
1314
1441
  * });
1315
1442
  */
1316
1443
  onConnectionRequestAccept = "onConnectionRequestAccept",
@@ -1318,46 +1445,247 @@ declare enum TUILiveConnectionManagerEvents {
1318
1445
  * @description 连线请求被拒绝的监听事件
1319
1446
  * @default 'onConnectionRequestReject'
1320
1447
  * @event TUILiveConnectionManagerEvents#onConnectionRequestReject
1321
- * @param {invitee} options 连线请求被邀请者
1322
- * @param {avatarUrl} options.avatarUrl 头像
1323
- * @param {joinConnectionTime} options.joinConnectionTime 加入连线时间
1324
- * @param {roomId} options.roomId 房间号
1325
- * @param {userId} options.userId ID
1326
- * @param {userName} options.userName 用户名
1448
+ * @param {object} options
1449
+ * @param {TUILiveConnectionUser} options.invitee 连线被邀请者
1327
1450
  *
1328
1451
  * @example
1329
1452
  * const roomEngine = new TUIRoomEngine();
1330
1453
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1331
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestReject, ({ avatarUrl, joinConnectionTime, roomId, userId, userName }) => {
1332
- * console.log('liveConnectionManager.onConnectionRequestReject', avatarUrl, joinConnectionTime, roomId, userId, userName);
1454
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestReject, ({ invitee }) => {
1455
+ * console.log('liveConnectionManager.onConnectionRequestReject', invitee);
1333
1456
  * });
1334
1457
  */
1335
1458
  onConnectionRequestReject = "onConnectionRequestReject",
1336
1459
  /**
1337
- * @description 邀请超时的监听事件
1338
- * @default 'onConnectionRequestTimeout'
1339
- * @event TUILiveConnectionManagerEvents#onConnectionRequestTimeout
1340
- * @param {invitee} invitee 连线请求被邀请者
1341
- * @param {avatarUrl} invitee.avatarUrl 头像
1342
- * @param {joinConnectionTime} invitee.joinConnectionTime 加入连线时间
1343
- * @param {roomId} invitee.roomId 房间号
1344
- * @param {userId} invitee.userId ID
1345
- * @param {userName} invitee.userName 用户名
1346
- * @param {inviter} inviter 连线请求邀请者
1347
- * @param {avatarUrl} inviter.avatarUrl 头像
1348
- * @param {joinConnectionTime} inviter.joinConnectionTime 加入连线时间
1349
- * @param {roomId} inviter.roomId 房间号
1350
- * @param {userId} inviter.userId ID
1351
- * @param {userName} inviter.userName 用户名
1352
- *
1353
- * @example
1354
- * const roomEngine = new TUIRoomEngine();
1355
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1356
- * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestTimeout, (invitee, inviter) => {
1357
- * console.log('liveConnectionManager.onConnectionRequestTimeout', invitee, inviter);
1358
- * });
1359
- */
1460
+ * @description 邀请超时的监听事件
1461
+ * @default 'onConnectionRequestTimeout'
1462
+ * @event TUILiveConnectionManagerEvents#onConnectionRequestTimeout
1463
+ * @param {object} option
1464
+ * @param {TUILiveConnectionUser} option.inviter 连线邀请者
1465
+ * @param {TUILiveConnectionUser} option.invitee 连线被邀请者
1466
+ *
1467
+ * @example
1468
+ * const roomEngine = new TUIRoomEngine();
1469
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
1470
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onConnectionRequestTimeout, ({ invitee, inviter }) => {
1471
+ * console.log('liveConnectionManager.onConnectionRequestTimeout', invitee, inviter);
1472
+ * });
1473
+ */
1360
1474
  onConnectionRequestTimeout = "onConnectionRequestTimeout"
1475
+ }
1476
+ /**
1477
+ * 直播连线配置信息
1478
+ */
1479
+ type TUIBattleConfig = {
1480
+ duration: number;
1481
+ needResponse?: boolean;
1482
+ extensionInfo?: string;
1483
+ };
1484
+ /**
1485
+ * 直播PK用户信息
1486
+ */
1487
+ type TUIBattleUser = {
1488
+ roomId: string;
1489
+ userId: string;
1490
+ userName: string;
1491
+ avatarUrl: string;
1492
+ score: number;
1493
+ };
1494
+ /**
1495
+ * 直播PK信息
1496
+ */
1497
+ type TUIBattleInfo = {
1498
+ fromUser: TUIBattleUser;
1499
+ toUserList: Array<TUIBattleUser>;
1500
+ extensionInfo: string;
1501
+ battleId: string;
1502
+ needResponse: boolean;
1503
+ duration: number;
1504
+ startTime: number;
1505
+ endTime: number;
1506
+ };
1507
+ declare enum TUIBattleStoppedReason {
1508
+ kStoppedByTimeOver = 0,
1509
+ kStoppedByOtherExit = 1
1510
+ }
1511
+ declare enum TUIBattleCode {
1512
+ kUnknown = -1,
1513
+ kSuccess = 0,
1514
+ kRoomNotExist = 1,
1515
+ kBattling = 2,
1516
+ kBattlingOtherRoom = 3,
1517
+ kRoomExit = 4,
1518
+ kRetry = 5
1519
+ }
1520
+ /**
1521
+ * @since v3.3.0
1522
+ * **TUILiveBattleManager** 事件列表<br>
1523
+ */
1524
+ declare enum TUILiveBattleManagerEvents {
1525
+ /**
1526
+ * @description 接收到PK开始的监听事件
1527
+ * @default 'onBattleStarted'
1528
+ * @event TUILiveBattleManagerEvents#onBattleStarted
1529
+ * @param {object} options
1530
+ * @param {TUIBattleInfo} battleInfo PK信息
1531
+ *
1532
+ * @example
1533
+ * const roomEngine = new TUIRoomEngine();
1534
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1535
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleStarted, ({ battleInfo }) => {
1536
+ * console.log('liveBattleManager.onBattleStarted', battleInfo);
1537
+ * });
1538
+ */
1539
+ onBattleStarted = "onBattleStarted",
1540
+ /**
1541
+ * @description 接收到PK结束的监听事件
1542
+ * @default 'onBattleEnded'
1543
+ * @event TUILiveBattleManagerEvents#onBattleEnded
1544
+ * @param {object} options
1545
+ * @param {TUIBattleInfo} battleInfo PK信息
1546
+ * @param {TUIBattleStoppedReason} reason PK结束原因
1547
+ *
1548
+ * @example
1549
+ * const roomEngine = new TUIRoomEngine();
1550
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1551
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleEnded, ({ battleInfo, reason }) => {
1552
+ * console.log('liveBattleManager.onBattleEnded', battleInfo, reason);
1553
+ * });
1554
+ */
1555
+ onBattleEnded = "onBattleEnded",
1556
+ /**
1557
+ * @description 接收到用户加入PK的监听事件
1558
+ * @default 'onUserJoinBattle'
1559
+ * @event TUILiveBattleManagerEvents#onUserJoinBattle
1560
+ * @param {object} options
1561
+ * @param {String} battleId PK的Id
1562
+ * @param {TUIBattleUser} user PK用户信息
1563
+ *
1564
+ * @example
1565
+ * const roomEngine = new TUIRoomEngine();
1566
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1567
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onUserJoinBattle, ({ battleId, user }) => {
1568
+ * console.log('liveBattleManager.onUserJoinBattle', battleId, user);
1569
+ * });
1570
+ */
1571
+ onUserJoinBattle = "onUserJoinBattle",
1572
+ /**
1573
+ * @description 接收到用户退出PK的监听事件
1574
+ * @default 'onUserExitBattle'
1575
+ * @event TUILiveBattleManagerEvents#onUserExitBattle
1576
+ * @param {object} options
1577
+ * @param {String} battleId PK的Id
1578
+ * @param {TUIBattleUser} user PK用户信息
1579
+ *
1580
+ * @example
1581
+ * const roomEngine = new TUIRoomEngine();
1582
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1583
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onUserExitBattle, ({ battleId, user }) => {
1584
+ * console.log('liveBattleManager.onUserExitBattle', battleId, user);
1585
+ * });
1586
+ */
1587
+ onUserExitBattle = "onUserExitBattle",
1588
+ /**
1589
+ * @description 接收到PK分数变化的监听事件
1590
+ * @default 'onBattleScoreChanged'
1591
+ * @event TUILiveBattleManagerEvents#onBattleScoreChanged
1592
+ * @param {object} options
1593
+ * @param {String} battleId PK的Id
1594
+ * @param {Array<TUIBattleUser>} battleUserList PK用户信息列表
1595
+ *
1596
+ * @example
1597
+ * const roomEngine = new TUIRoomEngine();
1598
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1599
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleScoreChanged, ({ battleId, battleUserList }) => {
1600
+ * console.log('liveBattleManager.onBattleScoreChanged', battleId, battleUserList);
1601
+ * });
1602
+ */
1603
+ onBattleScoreChanged = "onBattleScoreChanged",
1604
+ /**
1605
+ * @description 接收PK请求的监听事件
1606
+ * @default 'onBattleRequestReceived'
1607
+ * @event TUILiveBattleManagerEvents#onBattleRequestReceived
1608
+ * @param {object} options
1609
+ * @param {TUIBattleInfo} battleInfo PK信息
1610
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1611
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1612
+ *
1613
+ * @example
1614
+ * const roomEngine = new TUIRoomEngine();
1615
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1616
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestReceived, ({ battleInfo, inviter, invitee }) => {
1617
+ * console.log('liveBattleManager.onBattleRequestReceived', battleInfo, inviter, invitee);
1618
+ * });
1619
+ */
1620
+ onBattleRequestReceived = "onBattleRequestReceived",
1621
+ /**
1622
+ * @description 接收PK请求取消的监听事件
1623
+ * @default 'onBattleRequestCancelled'
1624
+ * @event TUILiveBattleManagerEvents#onBattleRequestCancelled
1625
+ * @param {object} options
1626
+ * @param {TUIBattleInfo} battleInfo PK信息
1627
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1628
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1629
+ *
1630
+ * @example
1631
+ * const roomEngine = new TUIRoomEngine();
1632
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1633
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestCancelled, ({ battleInfo, inviter, invitee }) => {
1634
+ * console.log('liveBattleManager.onBattleRequestCancelled', battleInfo, inviter, invitee);
1635
+ * });
1636
+ */
1637
+ onBattleRequestCancelled = "onBattleRequestCancelled",
1638
+ /**
1639
+ * @description 接收PK请求超时的监听事件
1640
+ * @default 'onBattleRequestTimeout'
1641
+ * @event TUILiveBattleManagerEvents#onBattleRequestTimeout
1642
+ * @param {object} options
1643
+ * @param {TUIBattleInfo} battleInfo PK信息
1644
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1645
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1646
+ *
1647
+ * @example
1648
+ * const roomEngine = new TUIRoomEngine();
1649
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1650
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestTimeout, ({ battleInfo, inviter, invitee }) => {
1651
+ * console.log('liveBattleManager.onBattleRequestTimeout', battleInfo, inviter, invitee);
1652
+ * });
1653
+ */
1654
+ onBattleRequestTimeout = "onBattleRequestTimeout",
1655
+ /**
1656
+ * @description 接收PK请求接受的监听事件
1657
+ * @default 'onBattleRequestAccept'
1658
+ * @event TUILiveBattleManagerEvents#onBattleRequestAccept
1659
+ * @param {object} options
1660
+ * @param {TUIBattleInfo} battleInfo PK信息
1661
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1662
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1663
+ *
1664
+ * @example
1665
+ * const roomEngine = new TUIRoomEngine();
1666
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1667
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestAccept, ({ battleInfo, inviter, invitee }) => {
1668
+ * console.log('liveBattleManager.onBattleRequestAccept', battleInfo, inviter, invitee);
1669
+ * });
1670
+ */
1671
+ onBattleRequestAccept = "onBattleRequestAccept",
1672
+ /**
1673
+ * @description 接收PK请求被拒绝的监听事件
1674
+ * @default 'onBattleRequestReject'
1675
+ * @event TUILiveBattleManagerEvents#onBattleRequestReject
1676
+ * @param {object} options
1677
+ * @param {TUIBattleInfo} battleInfo PK信息
1678
+ * @param {TUIBattleUser} inviter 发起PK请求的用户
1679
+ * @param {TUIBattleUser} invitee 接收PK请求的用户
1680
+ *
1681
+ * @example
1682
+ * const roomEngine = new TUIRoomEngine();
1683
+ * const liveBattleManager = roomEngine.TUILiveBattleManager();
1684
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleRequestReject, ({ battleInfo, inviter, invitee }) => {
1685
+ * console.log('liveBattleManager.onBattleRequestReject', battleInfo, inviter, invitee);
1686
+ * });
1687
+ */
1688
+ onBattleRequestReject = "onBattleRequestReject"
1361
1689
  }
1362
1690
 
1363
1691
  declare class Logger {
@@ -1948,6 +2276,7 @@ declare class TUIConferenceInvitationManager {
1948
2276
  * @class TUILiveListManager
1949
2277
  */
1950
2278
  declare class TUILiveListManager {
2279
+ private roomEngineWASM;
1951
2280
  private liveListManagerWASM;
1952
2281
  private logger;
1953
2282
  private static liveListManager;
@@ -1956,6 +2285,124 @@ declare class TUILiveListManager {
1956
2285
  logger: Logger;
1957
2286
  roomEngineWASM: any;
1958
2287
  });
2288
+ /**
2289
+ * 开始直播
2290
+ *
2291
+ * @description 创建并开始一个新的直播间,房主调用此接口来启动直播
2292
+ * @since 3.3.0
2293
+ * @param {TUILiveInfo} liveInfo 直播间信息,包含房间ID、名称、公告等配置
2294
+ * @returns {Promise<TUILiveInfo>} 返回创建成功后的直播间完整信息,包含CDN流地址等
2295
+ * @throws {TUIError} 可能抛出的错误:
2296
+ * - ERR_ALREADY_ROOM_OWNER: 用户已经是房间所有者
2297
+ * - ERR_INVALID_PARAMETER: 传入的参数不合法
2298
+ * - ERR_LIVE_SERVER_PROCESS_FAILED: 服务器处理请求失败
2299
+ * @example
2300
+ * ```typescript
2301
+ * const liveInfo = {
2302
+ * roomId: '123',
2303
+ * roomType: TUIRoomType.kLivingRoom,
2304
+ * name: 'ABC',
2305
+ * notice: 'this is a description',
2306
+ * isSeatEnabled: true,
2307
+ * seatMode: TUISeatMode.kApplyToTake,
2308
+ * seatLayoutTemplateId: 200,
2309
+ * coverUrl: '',
2310
+ * backgroundUrl: '',
2311
+ * categoryList: [],
2312
+ * activityStatus: 1,
2313
+ * isMessageDisableForAllUser: false,
2314
+ * isGiftEnabled: false,
2315
+ * isLikeEnabled: false,
2316
+ * isPublicVisible: false,
2317
+ * keepOwnerOnSeat: false,
2318
+ * };
2319
+ * const roomEngine = new TUIRoomEngine();
2320
+ * const liveListManager = roomEngine.getLiveListManager();
2321
+ * const resultLiveInfo = await liveListManager.startLive(liveInfo);
2322
+ * console.log('直播开始成功,CDN流地址:', resultLiveInfo.cdnStreamUrl);
2323
+ * ```
2324
+ */
2325
+ startLive(liveInfo: TUILiveInfo): Promise<TUILiveInfo>;
2326
+ /**
2327
+ * 停止直播
2328
+ *
2329
+ * @description 结束当前正在进行的直播,只有房主可以调用此接口停止直播
2330
+ * @since 3.3.0
2331
+ * @returns {Promise<TUILiveStatisticsData>} 返回直播统计数据,包含观众人数、礼物数量、点赞数等信息
2332
+ * @throws {TUIError} 可能抛出的错误:
2333
+ * - ERR_DESTROY_ROOM_NO_PERMISSION: 没有权限停止直播(仅房主可操作)
2334
+ * - ERR_OPERATION_INVALID_BEFORE_ENTER_ROOM: 需要进房后才可使用此功能
2335
+ * - ERR_LIVE_SERVER_PROCESS_FAILED: 服务器处理请求失败
2336
+ * @example
2337
+ * ```typescript
2338
+ * try {
2339
+ * const roomEngine = new TUIRoomEngine();
2340
+ * const liveListManager = roomEngine.getLiveListManager();
2341
+ * const statistics = await liveListManager.stopLive();
2342
+ * console.log('直播结束,统计数据:', {
2343
+ * 观众人数: statistics.totalViewers,
2344
+ * 礼物总数: statistics.totalGiftsSent,
2345
+ * 点赞总数: statistics.totalLikesReceived
2346
+ * });
2347
+ * } catch (error) {
2348
+ * console.error('停止直播失败:', error);
2349
+ * }
2350
+ * ```
2351
+ */
2352
+ stopLive(): Promise<TUILiveStatisticsData>;
2353
+ /**
2354
+ * 加入直播
2355
+ *
2356
+ * @description 观众加入指定的直播间,开始观看直播内容
2357
+ * @since 3.3.0
2358
+ * @param {string} roomId 要加入的直播间ID
2359
+ * @returns {Promise<TUILiveInfo>} 返回加入成功后的直播间信息,包含直播间名称、公告等详细信息
2360
+ * @throws {TUIError} 可能抛出的错误:
2361
+ * - ERR_ALREADY_ROOM_ENTER: 用户已经进入房间,重复进入房间操作
2362
+ * - ERR_INVALID_PARAMETER: 房间ID参数不合法
2363
+ * - ERR_LIVE_REQUEST_SERVER_TIMEOUT: 请求服务器超时
2364
+ * - ERR_LIVE_DISCONNECTED: 直播连接断开
2365
+ * @example
2366
+ * ```typescript
2367
+ * try {
2368
+ * const roomEngine = new TUIRoomEngine();
2369
+ * const liveListManager = roomEngine.getLiveListManager();
2370
+ * const liveInfo = await liveListManager.joinLive('live_room_123');
2371
+ * console.log('成功加入直播间:', {
2372
+ * 房间名称: liveInfo.name,
2373
+ * 房间公告: liveInfo.notice,
2374
+ * CDN流地址: liveInfo.cdnStreamUrl
2375
+ * });
2376
+ * } catch (error) {
2377
+ * console.error('加入直播间失败:', error);
2378
+ * }
2379
+ * ```
2380
+ */
2381
+ joinLive(roomId: string): Promise<TUILiveInfo>;
2382
+ /**
2383
+ * 离开直播
2384
+ *
2385
+ * @description 观众退出当前正在观看的直播间,结束观看直播
2386
+ * @since 3.3.0
2387
+ * @returns {Promise<void>} 无返回值,成功离开直播间后Promise将resolve
2388
+ * @throws {TUIError} 可能抛出的错误:
2389
+ * - ERR_OPERATION_INVALID_BEFORE_ENTER_ROOM: 需要进房后才可使用此功能
2390
+ * - ERR_EXIT_NOT_SUPPORTED_FOR_ROOM_OWNER: 房主不支持退房操作(房主只能停止直播)
2391
+ * - ERR_LIVE_SERVER_PROCESS_FAILED: 服务器处理请求失败
2392
+ * @note 如果是房主想要结束直播,应该使用 stopLive() 接口而不是 leaveLive()
2393
+ * @example
2394
+ * ```typescript
2395
+ * try {
2396
+ * const roomEngine = new TUIRoomEngine();
2397
+ * const liveListManager = roomEngine.getLiveListManager();
2398
+ * await liveListManager.leaveLive();
2399
+ * console.log('成功离开直播间');
2400
+ * } catch (error) {
2401
+ * console.error('离开直播间失败:', error);
2402
+ * }
2403
+ * ```
2404
+ */
2405
+ leaveLive(): Promise<void>;
1959
2406
  /**
1960
2407
  * 修改直播间信息
1961
2408
  *
@@ -1987,6 +2434,7 @@ declare class TUILiveListManager {
1987
2434
  coverUrl?: string;
1988
2435
  isPublicVisible?: boolean;
1989
2436
  backgroundUrl?: string;
2437
+ seatLayoutTemplateId?: number;
1990
2438
  }): Promise<void>;
1991
2439
  /**
1992
2440
  * 获取直播间信息
@@ -2028,6 +2476,35 @@ declare class TUILiveListManager {
2028
2476
  cursor: string;
2029
2477
  count: number;
2030
2478
  }): Promise<TUILiveListResult>;
2479
+ /**
2480
+ * 进房前预览视频流
2481
+ * @since 3.3.0
2482
+ * @param options
2483
+ * @param options.roomId 房间 Id
2484
+ * @param options.isMuteAudio 是否静音预览
2485
+ * @param options.view 播放视频流区域
2486
+ */
2487
+ startPreloadVideoStream(options: {
2488
+ roomId: string;
2489
+ isMuteAudio: boolean;
2490
+ view: string;
2491
+ }): Promise<void>;
2492
+ /**
2493
+ * 停止预览视频流
2494
+ * @since 3.3.0
2495
+ * @param options
2496
+ * @param options.roomId 房间 Id
2497
+ */
2498
+ stopPreloadVideoStream(options: {
2499
+ roomId: string;
2500
+ }): Promise<void>;
2501
+ /**
2502
+ * @private
2503
+ * 调用 TUIRoomEngineWASM 的 CallAPI 方法
2504
+ * @param funcName
2505
+ * @param jsonString
2506
+ */
2507
+ private JSCallNativeCallAPIPromise;
2031
2508
  private JSCallNativeFunctionPromise;
2032
2509
  /**
2033
2510
  * 监听 TUILiveListManager 事件
@@ -2170,6 +2647,92 @@ declare class TUILiveConnectionManager {
2170
2647
  logger: Logger;
2171
2648
  roomEngineWASM: any;
2172
2649
  });
2650
+ /**
2651
+ * 请求跨房连线
2652
+ *
2653
+ * @param {object} options
2654
+ * @param {Array<string>} options.roomIdList 待邀请的连线房间ID列表
2655
+ * @param {number} options.timeout 请求超时时间, 单位 s
2656
+ * @param {string} options.extensionInfo 扩展信息, 可选, 默认为: ''
2657
+ * @returns {Promise<void>}
2658
+ *
2659
+ * @example
2660
+ * const roomEngine = new TUIRoomEngine();
2661
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2662
+ * liveConnectionManager.requestConnection({
2663
+ * roomIdList: ['roomId1','roomId2'],
2664
+ * timeout: 10,
2665
+ * extensionInfo: 'extension info'
2666
+ * });
2667
+ */
2668
+ requestConnection(options: {
2669
+ roomIdList: Array<string>;
2670
+ timeout: number;
2671
+ extensionInfo?: string;
2672
+ }): Promise<void>;
2673
+ /**
2674
+ * 取消跨房连线请求
2675
+ *
2676
+ * @param {object} options
2677
+ * @param {Array<string>} options.roomIdList 被取消连线请求的房间Id列表
2678
+ * @returns {Promise<void>}
2679
+ *
2680
+ * @example
2681
+ * const roomEngine = new TUIRoomEngine();
2682
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2683
+ * liveConnectionManager.cancelConnectionRequest({
2684
+ * roomIdList: ['roomId1', 'roomId2']
2685
+ * });
2686
+ */
2687
+ cancelConnectionRequest(options: {
2688
+ roomIdList: Array<string>;
2689
+ }): Promise<void>;
2690
+ /**
2691
+ * 同意连线请求
2692
+ *
2693
+ * @param {object} options
2694
+ * @param {string} options.roomId 直播房间 ID
2695
+ * @returns {Promise<void>}
2696
+ *
2697
+ * @example
2698
+ * const roomEngine = new TUIRoomEngine();
2699
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2700
+ * liveConnectionManager.acceptConnection({
2701
+ * roomId: 'roomId'
2702
+ * });
2703
+ */
2704
+ acceptConnection(options: {
2705
+ roomId: string;
2706
+ }): Promise<void>;
2707
+ /**
2708
+ * 拒绝连线请求
2709
+ *
2710
+ * @param {object} options
2711
+ * @param {string} options.roomId 直播房间 ID
2712
+ * @returns {Promise<void>}
2713
+ *
2714
+ * @example
2715
+ * const roomEngine = new TUIRoomEngine();
2716
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2717
+ * liveConnectionManager.rejectConnection({
2718
+ * roomId: 'roomId'
2719
+ * });
2720
+ */
2721
+ rejectConnection(options: {
2722
+ roomId: string;
2723
+ }): Promise<void>;
2724
+ /**
2725
+ * 断开直播连线
2726
+ *
2727
+ * @returns {Promise<void>}
2728
+ *
2729
+ * @example
2730
+ * const roomEngine = new TUIRoomEngine();
2731
+ * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2732
+ * liveConnectionManager.disconnect();
2733
+ */
2734
+ disconnect(): Promise<void>;
2735
+ private JSCallNativeFunctionPromise;
2173
2736
  /**
2174
2737
  * 监听 TUILiveConnectionManager 事件
2175
2738
  * @param {TUILiveConnectionManagerEvents} event 事件名
@@ -2181,7 +2744,7 @@ declare class TUILiveConnectionManager {
2181
2744
  * const callback = (inviter) => {
2182
2745
  * console.log('liveConnectionManager.onConnectionRequestReceived', inviter);
2183
2746
  * };
2184
- * liveConnectionManager.on(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
2747
+ * liveConnectionManager.on(TUILiveConnectionManagerEvents.onLiveVideoLayoutChanged, callback);
2185
2748
  */
2186
2749
  on(event: TUILiveConnectionManagerEvents, func: (...args: any[]) => void): void;
2187
2750
  /**
@@ -2195,73 +2758,149 @@ declare class TUILiveConnectionManager {
2195
2758
  * const callback = (inviter) => {
2196
2759
  * console.log('liveConnectionManager.onConnectionRequestReceived', inviter);
2197
2760
  * };
2198
- * liveConnectionManager.off(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
2761
+ * liveConnectionManager.off(TUILiveConnectionManagerEvents.onLiveVideoLayoutChanged, callback);
2199
2762
  */
2200
2763
  off(event: TUILiveConnectionManagerEvents, func: (...args: any[]) => void): void;
2764
+ private observerFunction;
2765
+ }
2766
+
2767
+ /**
2768
+ * 直播PK
2769
+ * @class TUILiveBattleManager
2770
+ */
2771
+ declare class TUILiveBattleManager {
2772
+ private liveBattleManagerWASM;
2773
+ private logger;
2774
+ private static liveBattleManager;
2775
+ constructor(options: {
2776
+ Module: any;
2777
+ logger: Logger;
2778
+ roomEngineWASM: any;
2779
+ });
2201
2780
  /**
2202
- * 请求跨房连线
2781
+ * 请求PK
2203
2782
  *
2204
- * @param {Array<string>} roomIdList 待邀请的连线房间ID列表
2205
- * @param {string} timeOut 请求超时时间, 单位 s
2206
- * @param {string} extensionInfo 扩展信息, 可选, 默认为: ''
2783
+ * @param {object} options
2784
+ * @param {TUIBattleConfig} options.config
2785
+ * @param {Array<string>} options.userIdList
2786
+ * @param {number} options.timeOut
2207
2787
  * @returns {Promise<void>}
2208
2788
  *
2209
2789
  * @example
2210
2790
  * const roomEngine = new TUIRoomEngine();
2211
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2212
- * liveConnectionManager.requestConnection(['roomId1','roomId2'], 10);
2791
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2792
+ * liveBattleManager.requestBattle({
2793
+ * config: {duration: 100, needResponse: true},
2794
+ * userIdList: ['userId1'],
2795
+ * timeout: 10
2796
+ * });
2213
2797
  */
2214
- requestConnection(roomIdList: Array<string>, timeOut: number, extensionInfo?: string): Promise<void>;
2798
+ requestBattle(options: {
2799
+ config: TUIBattleConfig;
2800
+ userIdList: Array<string>;
2801
+ timeout: number;
2802
+ }): Promise<any>;
2215
2803
  /**
2216
- * 取消跨房连线请求
2804
+ * 取消PK请求
2217
2805
  *
2218
- * @param {Array<string>} roomIdList 被取消连线请求的房间Id列表
2806
+ * @param {object} options
2807
+ * @param {string} options.battleId
2808
+ * @param {Array<string>} options.userIdList
2219
2809
  * @returns {Promise<void>}
2220
2810
  *
2221
2811
  * @example
2222
2812
  * const roomEngine = new TUIRoomEngine();
2223
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2224
- * liveConnectionManager.cancelConnectionRequest(['roomId1', 'roomId2']);
2813
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2814
+ * liveBattleManager.cancelBattleRequest({
2815
+ * battleId: 'battleId',
2816
+ * userIdList: ['userId1'],
2817
+ * });
2225
2818
  */
2226
- cancelConnectionRequest(roomIdList: Array<string>): Promise<void>;
2819
+ cancelBattleRequest(options: {
2820
+ battleId: string;
2821
+ userIdList: Array<string>;
2822
+ }): Promise<void>;
2227
2823
  /**
2228
- * 同意连线请求
2824
+ * 接受PK请求
2229
2825
  *
2230
- * @param {string} roomId 直播房间 ID
2826
+ * @param {object} options
2827
+ * @param {string} options.battleId
2231
2828
  * @returns {Promise<void>}
2232
2829
  *
2233
2830
  * @example
2234
2831
  * const roomEngine = new TUIRoomEngine();
2235
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2236
- * liveConnectionManager.acceptConnection('roomId');
2832
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2833
+ * liveBattleManager.acceptBattle({
2834
+ * battleId: 'battleId',
2835
+ * });
2237
2836
  */
2238
- acceptConnection(roomId: string): Promise<void>;
2837
+ acceptBattle(options: {
2838
+ battleId: string;
2839
+ }): Promise<void>;
2239
2840
  /**
2240
- * 拒绝连线请求
2841
+ * 拒绝PK请求
2241
2842
  *
2242
- * @param {string} roomId 直播房间 ID
2843
+ * @param {object} options
2844
+ * @param {string} options.battleId
2243
2845
  * @returns {Promise<void>}
2244
2846
  *
2245
2847
  * @example
2246
2848
  * const roomEngine = new TUIRoomEngine();
2247
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2248
- * liveConnectionManager.rejectConnection('roomId');
2849
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2850
+ * liveBattleManager.rejectBattle({
2851
+ * battleId: 'battleId',
2852
+ * });
2249
2853
  */
2250
- rejectConnection(roomId: string): Promise<void>;
2854
+ rejectBattle(options: {
2855
+ battleId: string;
2856
+ }): Promise<void>;
2251
2857
  /**
2252
- * 断开直播连线
2858
+ * 退出PK
2253
2859
  *
2860
+ * @param {object} options
2861
+ * @param {string} options.battleId
2254
2862
  * @returns {Promise<void>}
2255
2863
  *
2256
2864
  * @example
2257
2865
  * const roomEngine = new TUIRoomEngine();
2258
- * const liveConnectionManager = roomEngine.getLiveConnectionManager();
2259
- * liveConnectionManager.disconnect();
2866
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2867
+ * liveBattleManager.exitBattle({
2868
+ * battleId: 'battleId',
2869
+ * });
2260
2870
  */
2261
- disconnect(): Promise<void>;
2871
+ exitBattle(options: {
2872
+ battleId: string;
2873
+ }): Promise<void>;
2874
+ /**
2875
+ * 监听 TUILiveBattleManager 事件
2876
+ * @param {TUILiveBattleManagerEvents} event 事件名
2877
+ * @param func 事件回调函数
2878
+ *
2879
+ * @example
2880
+ * const roomEngine = new TUIRoomEngine();
2881
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2882
+ * const callback = (battleInfo) => {
2883
+ * console.log('liveBattleManager.onBattleStarted', battleInfo);
2884
+ * };
2885
+ * liveBattleManager.on(TUILiveBattleManagerEvents.onBattleStarted, callback);
2886
+ */
2887
+ on(event: TUILiveBattleManagerEvents, func: (...args: any[]) => void): void;
2888
+ /**
2889
+ * 取消监听 TUILiveBattleManager 事件
2890
+ * @param {TUILiveBattleManagerEvents} event 事件名
2891
+ * @param func 事件回调函数
2892
+ *
2893
+ * @example
2894
+ * const roomEngine = new TUIRoomEngine();
2895
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
2896
+ * const callback = (battleInfo) => {
2897
+ * console.log('liveBattleManager.onBattleStarted', battleInfo);
2898
+ * };
2899
+ * liveBattleManager.off(TUILiveBattleManagerEvents.onBattleStarted, callback);
2900
+ */
2901
+ off(event: TUILiveBattleManagerEvents, func: (...args: any[]) => void): void;
2262
2902
  private JSCallNativeFunctionPromise;
2263
2903
  private observerFunction;
2264
- private handleLiveConnectionEvent;
2265
2904
  }
2266
2905
 
2267
2906
  /**
@@ -2281,6 +2920,7 @@ declare class TUIRoomEngine {
2281
2920
  private liveListManager;
2282
2921
  private liveLayoutManager;
2283
2922
  private liveConnectionManager;
2923
+ private liveBattleManager;
2284
2924
  private static userId;
2285
2925
  private static sdkAppId;
2286
2926
  private static Module;
@@ -3711,6 +4351,17 @@ declare class TUIRoomEngine {
3711
4351
  * const liveConnectionManager = roomEngine.getLiveConnectionManager();
3712
4352
  */
3713
4353
  getLiveConnectionManager(): TUILiveConnectionManager;
4354
+ /**
4355
+ * v3.3.0 版本起支持 getLiveBattleManager 获取 TUILiveBattleManager 模块
4356
+ *
4357
+ * @since v3.3.0
4358
+ * @returns {TUILiveBattleManager}
4359
+ *
4360
+ * @example
4361
+ * const roomEngine = new TUIRoomEngine();
4362
+ * const liveBattleManager = roomEngine.getLiveBattleManager();
4363
+ */
4364
+ getLiveBattleManager(): TUILiveBattleManager;
3714
4365
  /**
3715
4366
  * v2.6.0 版本起支持使用 getConferenceInvitationManager 获取 conferenceInvitation 模块
3716
4367
  * @since v2.6.0
@@ -3753,4 +4404,4 @@ declare class TUIRoomEngine {
3753
4404
  private static handleSetFramework;
3754
4405
  }
3755
4406
 
3756
- export { TRTCRole, TUIAudioQuality, TUIAudioRoute, type TUIAutoPlayCallbackInfo, 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 };
4407
+ export { TRTCRole, TUIAudioQuality, TUIAudioRoute, type TUIAutoPlayCallbackInfo, 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 };