@tencentcloud/tuiroom-engine-js 3.3.0-beta.1 → 3.3.0-beta.3
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.cjs.js +1 -1
- package/index.d.ts +540 -39
- package/index.esm.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1292,13 +1292,19 @@ declare enum TUILiveLayoutManagerEvents {
|
|
|
1292
1292
|
* @example
|
|
1293
1293
|
* const roomEngine = new TUIRoomEngine();
|
|
1294
1294
|
* const liveLayoutManager = roomEngine.getLiveLayoutManager();
|
|
1295
|
-
* const callback = (roomId, seatLayout) => {
|
|
1295
|
+
* const callback = ({ roomId, seatLayout }) => {
|
|
1296
1296
|
* console.log('liveLayoutManager.onSeatLayoutChanged', roomId, seatLayout);
|
|
1297
1297
|
* });
|
|
1298
1298
|
* liveLayoutManager.on(TUILiveLayoutManagerEvents.onSeatLayoutChanged, callback);
|
|
1299
1299
|
*/
|
|
1300
1300
|
onSeatLayoutChanged = "onSeatLayoutChanged"
|
|
1301
1301
|
}
|
|
1302
|
+
/** 麦上用户的媒体状态信息
|
|
1303
|
+
* @typedef {object} TUIDeviceStatus
|
|
1304
|
+
* @property {number} TUIDeviceStatusOpened 当前设备处于打开状态
|
|
1305
|
+
* @property {number} TUIDeviceStatusClosedBySelf 当前设备处于关闭状态,且是用户主动关闭
|
|
1306
|
+
* @property {number} TUIDeviceStatusClosedByAdmin 当前设备处于关闭状态,且是被房主/管理员强制关闭
|
|
1307
|
+
*/
|
|
1302
1308
|
declare enum TUIDeviceStatus {
|
|
1303
1309
|
TUIDeviceStatusOpened = 0,
|
|
1304
1310
|
TUIDeviceStatusClosedBySelf = 1,
|
|
@@ -1309,7 +1315,7 @@ declare enum TUIDeviceStatus {
|
|
|
1309
1315
|
* @typedef {object} TUISeatRegion
|
|
1310
1316
|
* @property {string} roomId 直播间 ID
|
|
1311
1317
|
* @property {number} seatIndex 麦位序号
|
|
1312
|
-
* @property {
|
|
1318
|
+
* @property {boolean} isSeatLocked 是否被锁定
|
|
1313
1319
|
* @property {string} userId 用户 ID
|
|
1314
1320
|
* @property {string} userName 用户名称
|
|
1315
1321
|
* @property {string} userAvatar 用户头像
|
|
@@ -1350,14 +1356,6 @@ type TUISeatLayout = {
|
|
|
1350
1356
|
canvasHeight: number;
|
|
1351
1357
|
regions: Array<TUISeatRegion>;
|
|
1352
1358
|
};
|
|
1353
|
-
declare enum TUISeatLayoutTemplate {
|
|
1354
|
-
LandscapeDynamic_1v3 = 200,
|
|
1355
|
-
PortraitDynamic_Grid9 = 600,
|
|
1356
|
-
PortraitDynamic_1v6 = 601,
|
|
1357
|
-
PortraitFixed_Grid9 = 800,
|
|
1358
|
-
PortraitFixed_1v6 = 801,
|
|
1359
|
-
PortraitFixed_6v6 = 802
|
|
1360
|
-
}
|
|
1361
1359
|
/**
|
|
1362
1360
|
* 直播间统计信息
|
|
1363
1361
|
* @typedef {object} TUILiveStatisticsData
|
|
@@ -1474,6 +1472,220 @@ declare enum TUILiveConnectionManagerEvents {
|
|
|
1474
1472
|
* });
|
|
1475
1473
|
*/
|
|
1476
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"
|
|
1477
1689
|
}
|
|
1478
1690
|
|
|
1479
1691
|
declare class Logger {
|
|
@@ -2073,9 +2285,123 @@ declare class TUILiveListManager {
|
|
|
2073
2285
|
logger: Logger;
|
|
2074
2286
|
roomEngineWASM: any;
|
|
2075
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
|
+
*/
|
|
2076
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
|
+
*/
|
|
2077
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
|
+
*/
|
|
2078
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
|
+
*/
|
|
2079
2405
|
leaveLive(): Promise<void>;
|
|
2080
2406
|
/**
|
|
2081
2407
|
* 修改直播间信息
|
|
@@ -2321,6 +2647,92 @@ declare class TUILiveConnectionManager {
|
|
|
2321
2647
|
logger: Logger;
|
|
2322
2648
|
roomEngineWASM: any;
|
|
2323
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;
|
|
2324
2736
|
/**
|
|
2325
2737
|
* 监听 TUILiveConnectionManager 事件
|
|
2326
2738
|
* @param {TUILiveConnectionManagerEvents} event 事件名
|
|
@@ -2332,7 +2744,7 @@ declare class TUILiveConnectionManager {
|
|
|
2332
2744
|
* const callback = (inviter) => {
|
|
2333
2745
|
* console.log('liveConnectionManager.onConnectionRequestReceived', inviter);
|
|
2334
2746
|
* };
|
|
2335
|
-
* liveConnectionManager.on(
|
|
2747
|
+
* liveConnectionManager.on(TUILiveConnectionManagerEvents.onLiveVideoLayoutChanged, callback);
|
|
2336
2748
|
*/
|
|
2337
2749
|
on(event: TUILiveConnectionManagerEvents, func: (...args: any[]) => void): void;
|
|
2338
2750
|
/**
|
|
@@ -2346,70 +2758,147 @@ declare class TUILiveConnectionManager {
|
|
|
2346
2758
|
* const callback = (inviter) => {
|
|
2347
2759
|
* console.log('liveConnectionManager.onConnectionRequestReceived', inviter);
|
|
2348
2760
|
* };
|
|
2349
|
-
* liveConnectionManager.off(
|
|
2761
|
+
* liveConnectionManager.off(TUILiveConnectionManagerEvents.onLiveVideoLayoutChanged, callback);
|
|
2350
2762
|
*/
|
|
2351
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
|
+
});
|
|
2352
2780
|
/**
|
|
2353
|
-
*
|
|
2781
|
+
* 请求PK
|
|
2354
2782
|
*
|
|
2355
|
-
* @param {
|
|
2356
|
-
* @param {
|
|
2357
|
-
* @param {string}
|
|
2783
|
+
* @param {object} options
|
|
2784
|
+
* @param {TUIBattleConfig} options.config
|
|
2785
|
+
* @param {Array<string>} options.userIdList
|
|
2786
|
+
* @param {number} options.timeOut
|
|
2358
2787
|
* @returns {Promise<void>}
|
|
2359
2788
|
*
|
|
2360
2789
|
* @example
|
|
2361
2790
|
* const roomEngine = new TUIRoomEngine();
|
|
2362
|
-
* const
|
|
2363
|
-
*
|
|
2791
|
+
* const liveBattleManager = roomEngine.getLiveBattleManager();
|
|
2792
|
+
* liveBattleManager.requestBattle({
|
|
2793
|
+
* config: {duration: 100, needResponse: true},
|
|
2794
|
+
* userIdList: ['userId1'],
|
|
2795
|
+
* timeout: 10
|
|
2796
|
+
* });
|
|
2364
2797
|
*/
|
|
2365
|
-
|
|
2798
|
+
requestBattle(options: {
|
|
2799
|
+
config: TUIBattleConfig;
|
|
2800
|
+
userIdList: Array<string>;
|
|
2801
|
+
timeout: number;
|
|
2802
|
+
}): Promise<any>;
|
|
2366
2803
|
/**
|
|
2367
|
-
*
|
|
2804
|
+
* 取消PK请求
|
|
2368
2805
|
*
|
|
2369
|
-
* @param {
|
|
2806
|
+
* @param {object} options
|
|
2807
|
+
* @param {string} options.battleId
|
|
2808
|
+
* @param {Array<string>} options.userIdList
|
|
2370
2809
|
* @returns {Promise<void>}
|
|
2371
2810
|
*
|
|
2372
2811
|
* @example
|
|
2373
2812
|
* const roomEngine = new TUIRoomEngine();
|
|
2374
|
-
* const
|
|
2375
|
-
*
|
|
2813
|
+
* const liveBattleManager = roomEngine.getLiveBattleManager();
|
|
2814
|
+
* liveBattleManager.cancelBattleRequest({
|
|
2815
|
+
* battleId: 'battleId',
|
|
2816
|
+
* userIdList: ['userId1'],
|
|
2817
|
+
* });
|
|
2376
2818
|
*/
|
|
2377
|
-
|
|
2819
|
+
cancelBattleRequest(options: {
|
|
2820
|
+
battleId: string;
|
|
2821
|
+
userIdList: Array<string>;
|
|
2822
|
+
}): Promise<void>;
|
|
2378
2823
|
/**
|
|
2379
|
-
*
|
|
2824
|
+
* 接受PK请求
|
|
2380
2825
|
*
|
|
2381
|
-
* @param {
|
|
2826
|
+
* @param {object} options
|
|
2827
|
+
* @param {string} options.battleId
|
|
2382
2828
|
* @returns {Promise<void>}
|
|
2383
2829
|
*
|
|
2384
2830
|
* @example
|
|
2385
2831
|
* const roomEngine = new TUIRoomEngine();
|
|
2386
|
-
* const
|
|
2387
|
-
*
|
|
2832
|
+
* const liveBattleManager = roomEngine.getLiveBattleManager();
|
|
2833
|
+
* liveBattleManager.acceptBattle({
|
|
2834
|
+
* battleId: 'battleId',
|
|
2835
|
+
* });
|
|
2388
2836
|
*/
|
|
2389
|
-
|
|
2837
|
+
acceptBattle(options: {
|
|
2838
|
+
battleId: string;
|
|
2839
|
+
}): Promise<void>;
|
|
2390
2840
|
/**
|
|
2391
|
-
*
|
|
2841
|
+
* 拒绝PK请求
|
|
2392
2842
|
*
|
|
2393
|
-
* @param {
|
|
2843
|
+
* @param {object} options
|
|
2844
|
+
* @param {string} options.battleId
|
|
2394
2845
|
* @returns {Promise<void>}
|
|
2395
2846
|
*
|
|
2396
2847
|
* @example
|
|
2397
2848
|
* const roomEngine = new TUIRoomEngine();
|
|
2398
|
-
* const
|
|
2399
|
-
*
|
|
2849
|
+
* const liveBattleManager = roomEngine.getLiveBattleManager();
|
|
2850
|
+
* liveBattleManager.rejectBattle({
|
|
2851
|
+
* battleId: 'battleId',
|
|
2852
|
+
* });
|
|
2400
2853
|
*/
|
|
2401
|
-
|
|
2854
|
+
rejectBattle(options: {
|
|
2855
|
+
battleId: string;
|
|
2856
|
+
}): Promise<void>;
|
|
2402
2857
|
/**
|
|
2403
|
-
*
|
|
2858
|
+
* 退出PK
|
|
2404
2859
|
*
|
|
2860
|
+
* @param {object} options
|
|
2861
|
+
* @param {string} options.battleId
|
|
2405
2862
|
* @returns {Promise<void>}
|
|
2406
2863
|
*
|
|
2407
2864
|
* @example
|
|
2408
2865
|
* const roomEngine = new TUIRoomEngine();
|
|
2409
|
-
* const
|
|
2410
|
-
*
|
|
2866
|
+
* const liveBattleManager = roomEngine.getLiveBattleManager();
|
|
2867
|
+
* liveBattleManager.exitBattle({
|
|
2868
|
+
* battleId: 'battleId',
|
|
2869
|
+
* });
|
|
2411
2870
|
*/
|
|
2412
|
-
|
|
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;
|
|
2413
2902
|
private JSCallNativeFunctionPromise;
|
|
2414
2903
|
private observerFunction;
|
|
2415
2904
|
}
|
|
@@ -2431,6 +2920,7 @@ declare class TUIRoomEngine {
|
|
|
2431
2920
|
private liveListManager;
|
|
2432
2921
|
private liveLayoutManager;
|
|
2433
2922
|
private liveConnectionManager;
|
|
2923
|
+
private liveBattleManager;
|
|
2434
2924
|
private static userId;
|
|
2435
2925
|
private static sdkAppId;
|
|
2436
2926
|
private static Module;
|
|
@@ -3861,6 +4351,17 @@ declare class TUIRoomEngine {
|
|
|
3861
4351
|
* const liveConnectionManager = roomEngine.getLiveConnectionManager();
|
|
3862
4352
|
*/
|
|
3863
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;
|
|
3864
4365
|
/**
|
|
3865
4366
|
* v2.6.0 版本起支持使用 getConferenceInvitationManager 获取 conferenceInvitation 模块
|
|
3866
4367
|
* @since v2.6.0
|
|
@@ -3903,4 +4404,4 @@ declare class TUIRoomEngine {
|
|
|
3903
4404
|
private static handleSetFramework;
|
|
3904
4405
|
}
|
|
3905
4406
|
|
|
3906
|
-
export { TRTCRole, TUIAudioQuality, TUIAudioRoute, type TUIAutoPlayCallbackInfo, TUICaptureSourceType, TUIChangeReason, TUIConferenceCancelReason, type TUIConferenceInfo, TUIConferenceInvitationManager, TUIConferenceInvitationManagerEvents, TUIConferenceListManager, TUIConferenceListManagerEvents, type TUIConferenceModifyInfo, TUIConferenceStatus, type TUIDeviceInfo, TUIDeviceStatus, type TUIEnterRoomOptions, TUIErrorCode, type TUIInvitation, TUIInvitationCode, TUIInvitationRejectedReason, TUIInvitationStatus, TUIKickedOutOfRoomReason, 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,
|
|
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 };
|