@tencentcloud/tuiroom-engine-js 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,98 @@
1
+ import { TUILiveLayoutManagerEvents } from '../types';
2
+ import Logger from '../utils/logger';
3
+ /**
4
+ * 直播自定义布局插件
5
+ * @class TUILiveLayoutManager
6
+ */
7
+ declare class TUILiveLayoutManager {
8
+ private liveLayoutManagerWASM;
9
+ private logger;
10
+ private static liveLayoutManager;
11
+ constructor(options: {
12
+ Module: any;
13
+ logger: Logger;
14
+ roomEngineWASM: any;
15
+ });
16
+ private observerFunction;
17
+ private handleLiveLayoutChangeEvent;
18
+ private JSCallNativeFunctionPromise;
19
+ /**
20
+ * 监听 TUILiveLayoutManager 事件
21
+ * @param {TUILiveLayoutManagerEvents} event 事件名
22
+ * @param func 事件回调函数
23
+ *
24
+ * @example
25
+ * const roomEngine = new TUIRoomEngine();
26
+ * const liveLayoutManager = roomEngine.getLiveLayoutManager();
27
+ * const callback = (roomId, layoutInfo) => {
28
+ * console.log('liveLayoutManager.onLiveVideoLayoutChanged', roomId, layoutInfo);
29
+ * };
30
+ * liveLayoutManager.on(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
31
+ */
32
+ on(event: TUILiveLayoutManagerEvents, func: (...args: any[]) => void): void;
33
+ /**
34
+ * 取消 TUILiveLayoutManager 事件监听
35
+ * @param {TUILiveLayoutManagerEvents} event 事件名
36
+ * @param {Function} func 事件回调函数
37
+ *
38
+ * @example
39
+ * const roomEngine = new TUIRoomEngine();
40
+ * const liveLayoutManager = roomEngine.getLiveLayoutManager();
41
+ * const callback = (roomId, layoutInfo) => {
42
+ * console.log('liveLayoutManager.onLiveVideoLayoutChanged', roomId, layoutInfo);
43
+ * };
44
+ * liveLayoutManager.off(TUILiveLayoutManagerEvents.onLiveVideoLayoutChanged, callback);
45
+ */
46
+ off(event: TUILiveLayoutManagerEvents, func: (...args: any[]) => void): void;
47
+ /**
48
+ * 设置自定义布局信息
49
+ *
50
+ * @param {string} roomId 直播房间 ID
51
+ * @param {string} layoutInfo 自定义布局信息, 格式为 JSON 字符串
52
+ * @returns {Promise<void>}
53
+ *
54
+ * @example
55
+ * const roomEngine = new TUIRoomEngine();
56
+ * const liveLayoutManager = roomEngine.getLiveLayoutManager();
57
+ * liveLayoutManager.setLiveStreamLayoutInfo('roomId', '{
58
+ * // 设置画布大小
59
+ * "VideoEncode": {
60
+ * "Width": 1920,
61
+ * "Height": 1080,
62
+ * },
63
+ * "LayoutMode": 0, // 0~9 内置布局模板, 1000自定义布局, 只有1000时候才能修改LayoutInfo,目前只支持 0 和 1000
64
+ * // 设置画面布局
65
+ * "LayoutInfo": {
66
+ * "LayoutList": [
67
+ * {
68
+ * "LocationX": 0, // 以画面左上角为原点的 x 坐标
69
+ * "LocationY": 0, // 以画面左上角为原点的 y 坐标
70
+ * "ImageWidth": 1080, // 调整后的画面宽度
71
+ * "ImageHeight": 960, // 调整后的画面高度
72
+ * "ZOrder": 0, // 画面层级
73
+ * "StreamType": 0, // 0 摄像头, 1 屏幕共享, 2 白板, 3 自定义
74
+ * "Member_Account": "admin001", // 该路流的用户ID
75
+ * "BackgroundImageUrl": "ImageUrl",
76
+ * "RoomId": "roomId",
77
+ * "BackgroundColor": "0x1F212C",
78
+ *
79
+ * }
80
+ * ],
81
+ * // 设置最大画面,只能有一路
82
+ * "MaxUserLayout": {
83
+ * "LocationX": 0, // 以画面左上角为原点的 x 坐标
84
+ * "LocationY": 0, // 以画面左上角为原点的 y 坐标
85
+ * "ImageWidth": 1920, // 调整后的画面宽度
86
+ * "ImageHeight": 1080, // 调整后的画面高度
87
+ * "ZOrder": 0, // 层级
88
+ * "StreamType": 0, // 0为摄像头, 1为屏幕共享
89
+ * "Member_Account": "admin001",
90
+ * "BackgroundImageUrl": "ImageUrl", // 可以设置看看,可能在最大画面时候没作用
91
+ * "RoomId":"roomId",
92
+ * "BackgroundColor":"0x1F212C"
93
+ * }
94
+ * }}');
95
+ */
96
+ setLiveStreamLayoutInfo(roomId: string, layoutInfo: string): Promise<void>;
97
+ }
98
+ export default TUILiveLayoutManager;
@@ -0,0 +1,120 @@
1
+ import { TUILiveInfo, TUILiveListResult, TUILiveListManagerEvents } from '../types';
2
+ import Logger from '../utils/logger';
3
+ /**
4
+ * 直播列表
5
+ * @class TUILiveListManager
6
+ */
7
+ declare class TUILiveListManager {
8
+ private liveListManagerWASM;
9
+ private logger;
10
+ private static liveListManager;
11
+ constructor(options: {
12
+ Module: any;
13
+ logger: Logger;
14
+ roomEngineWASM: any;
15
+ });
16
+ /**
17
+ * 修改直播间信息
18
+ *
19
+ * @param {object} options
20
+ * @param {string} options.roomId 直播房间 ID
21
+ * @param {number} options.activityStatus 可选,直播间活跃状态: 用户自定义标记
22
+ * @param {Array<number>} options.categoryList 可选,直播间分类标签,单个房间最大支持3个标记
23
+ * @param {string} options.coverUrl 可选,直播间封面图片 HTTP URL 地址,最大支持 200 个字节
24
+ * @param {string} options.backgroundUrl 可选,直播间背景图片 HTTP URL 地址,最大支持 200 个字节
25
+ * @param {boolean} options.isPublicVisible 可选,直播间是否公开
26
+ * @returns {Promise<void>}
27
+ *
28
+ * @example
29
+ * const roomEngine = new TUIRoomEngine();
30
+ * const liveListManager = roomEngine.getLiveListManager();
31
+ * liveListManager.setLiveInfo({
32
+ * roomId: "141569",
33
+ * coverUrl: "https://qcloudimg.tencent-cloud.cn/image/document/live-cover.png",
34
+ * isPublicVisible: false,
35
+ * activityStatus: 1,
36
+ * categoryList: [1,2,3],
37
+ * backgroundUrl: "https://qcloudimg.tencent-cloud.cn/image/document/live-cover.png"
38
+ * });
39
+ */
40
+ setLiveInfo(options: {
41
+ roomId: string;
42
+ activityStatus?: number;
43
+ categoryList?: Array<number>;
44
+ coverUrl?: string;
45
+ isPublicVisible?: boolean;
46
+ backgroundUrl?: string;
47
+ }): Promise<void>;
48
+ /**
49
+ * 获取直播间信息
50
+ *
51
+ * @param {object} options
52
+ * @param {string} options.roomId 直播房间 ID
53
+ * @returns {Promise<TUILiveInfo>}
54
+ *
55
+ * @example
56
+ * const roomEngine = new TUIRoomEngine();
57
+ * const liveListManager = roomEngine.getLiveListManager();
58
+ * const result = await liveListManager.getLiveInfo({ roomId: "141569" });
59
+ */
60
+ getLiveInfo(options: {
61
+ roomId: string;
62
+ }): Promise<TUILiveInfo>;
63
+ /**
64
+ * 获取直播间列表
65
+ *
66
+ * @param {object} options
67
+ * @param {string} options.cursor 分页获取索引,第一次拉取填 '',返回的数据中 cursor 不为 '',表示需要分页,请以返回的 cursor 作为参数再次调用接口拉取,直至返回的cursor为 '',表示数据已经全部拉取。
68
+ * @param {number} options.count 本次拉取数量
69
+ * @returns {Promise<TUILiveListResult>}
70
+ *
71
+ * @example
72
+ * const roomEngine = new TUIRoomEngine();
73
+ * const liveListManager = roomEngine.getLiveListManager();
74
+ * const liveList = [];
75
+ * let cursor = '';
76
+ * let count = 20;
77
+ * let result;
78
+ * do {
79
+ * result = await liveListManager.fetchLiveList({ cursor, count });
80
+ * liveList.push(...result.liveInfoList);
81
+ * cursor = result.cursor;
82
+ * } while(cursor !== '');
83
+ */
84
+ fetchLiveList(options: {
85
+ cursor: string;
86
+ count: number;
87
+ }): Promise<TUILiveListResult>;
88
+ private JSCallNativeFunctionPromise;
89
+ /**
90
+ * 监听 TUILiveListManager 事件
91
+ * @param {TUILiveListManagerEvents} event - 事件名
92
+ * @param {Function} func - 事件回调函数
93
+ *
94
+ * @example
95
+ * const roomEngine = new TUIRoomEngine();
96
+ * const liveListManager = roomEngine.getLiveListManager();
97
+ * const callback = ({ liveModifyInfo }) => {
98
+ * console.log('liveListManager.onLiveInfoChanged', liveModifyInfo);
99
+ * };
100
+ * liveListManager.on(TUILiveListManagerEvents.onLiveInfoChanged, callback);
101
+ */
102
+ on(event: TUILiveListManagerEvents, func: (...args: any[]) => void): void;
103
+ /**
104
+ * 取消 TUILiveListManager 事件监听
105
+ * @param {TUILiveListManagerEvents} event - 事件名
106
+ * @param {Function} func - 事件回调函数
107
+ *
108
+ * @example
109
+ * const roomEngine = new TUIRoomEngine();
110
+ * const liveListManager = roomEngine.getLiveListManager();
111
+ * const callback = ({ liveModifyInfo }) => {
112
+ * console.log('liveListManager.onLiveInfoChanged', liveModifyInfo);
113
+ * };
114
+ * liveListManager.off(TUILiveListManagerEvents.onLiveInfoChanged, callback);
115
+ */
116
+ off(event: TUILiveListManagerEvents, func: (...args: any[]) => void): void;
117
+ private observerFunction;
118
+ private handleLiveInfoChangeEvent;
119
+ }
120
+ export default TUILiveListManager;