trtc-electron-sdk 12.2.115-beta.2 → 12.2.115-beta.21

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.
Files changed (34) hide show
  1. package/liteav/MediaMixingDesigner/index.d.ts +12 -8
  2. package/liteav/MediaMixingDesigner/index.js +135 -79
  3. package/liteav/base/DevicePixelRatioObserver.d.ts +12 -0
  4. package/liteav/base/DevicePixelRatioObserver.js +32 -0
  5. package/liteav/base/PromiseStore.d.ts +10 -0
  6. package/liteav/base/PromiseStore.js +58 -0
  7. package/liteav/constant.d.ts +1 -0
  8. package/liteav/constant.js +4 -0
  9. package/liteav/extensions/MediaMixingManager/MediaMixingManager.d.ts +429 -0
  10. package/liteav/extensions/MediaMixingManager/MediaMixingManager.js +1290 -0
  11. package/liteav/extensions/MediaMixingManager/MediaMixingService.d.ts +60 -0
  12. package/liteav/extensions/MediaMixingManager/MediaMixingService.js +80 -0
  13. package/liteav/extensions/MediaMixingManager/StreamLayout/BaseStreamLayoutManager.d.ts +32 -0
  14. package/liteav/extensions/MediaMixingManager/StreamLayout/BaseStreamLayoutManager.js +114 -0
  15. package/liteav/extensions/MediaMixingManager/StreamLayout/CustomStreamLayoutManager.d.ts +11 -0
  16. package/liteav/extensions/MediaMixingManager/StreamLayout/CustomStreamLayoutManager.js +135 -0
  17. package/liteav/extensions/MediaMixingManager/StreamLayout/NoneStreamLayoutManager.d.ts +11 -0
  18. package/liteav/extensions/MediaMixingManager/StreamLayout/NoneStreamLayoutManager.js +73 -0
  19. package/liteav/extensions/MediaMixingManager/StreamLayout/index.d.ts +7 -0
  20. package/liteav/extensions/MediaMixingManager/StreamLayout/index.js +34 -0
  21. package/liteav/extensions/MediaMixingManager/StreamLayout/types.d.ts +25 -0
  22. package/liteav/extensions/MediaMixingManager/StreamLayout/types.js +2 -0
  23. package/liteav/extensions/MediaMixingManager/index.d.ts +4 -227
  24. package/liteav/extensions/MediaMixingManager/index.js +30 -589
  25. package/liteav/extensions/MediaMixingManager/types.d.ts +107 -0
  26. package/liteav/extensions/MediaMixingManager/types.js +26 -0
  27. package/liteav/trtc.d.ts +67 -13
  28. package/liteav/trtc.js +159 -61
  29. package/liteav/trtc_define.d.ts +29 -3
  30. package/liteav/trtc_define.js +97 -29
  31. package/liteav/utils.d.ts +27 -0
  32. package/liteav/utils.js +85 -1
  33. package/package.json +2 -2
  34. package/scripts/download.js +153 -169
@@ -1,228 +1,5 @@
1
- import { TRTCVideoRotation, TRTCVideoFillMode, TRTCVideoMirrorType, TRTCVideoEncParam, TRTCCameraCaptureParams, Rect } from '../../trtc_define';
2
- import { TRTCDeviceManager } from '../DeviceManager';
3
- declare const NodeTRTCEngine: any;
4
- export declare enum TRTCMediaSourceType {
5
- kCamera = 0,
6
- kScreen = 1,
7
- kImage = 2
8
- }
9
- export declare type TRTCMediaSource = {
10
- sourceType: TRTCMediaSourceType;
11
- sourceId: string;
12
- zOrder: number;
13
- enableGreenScreen?: boolean;
14
- rect: Rect;
15
- isSelected?: boolean;
16
- rotation?: TRTCVideoRotation;
17
- fillMode?: TRTCVideoFillMode;
18
- mirrorType?: TRTCVideoMirrorType;
19
- };
20
- export declare type TRTCMediaMixingEncParam = {
21
- videoEncoderParams: TRTCVideoEncParam;
22
- canvasColor: number;
23
- };
24
- /**
25
- * @namespace TRTCMediaMixingEvent
26
- * @description 目前只支持 `Windows` 操作系统
27
- */
28
- export declare enum TRTCMediaMixingEvent {
29
- /**
30
- * @description 媒体源选中事件
31
- *
32
- * @event TRTCMediaMixingEvent#onSourceSelected
33
- * @param {TRTCMediaInfo | null} mediaSource 新选中的媒体源数据,取消选中则为`null`
34
- */
35
- onSourceSelected = "onSourceSelected",
36
- /**
37
- * @description 媒体源移动事件
38
- *
39
- * @event TRTCMediaMixingEvent#onSourceMoved
40
- * @param {TRTCMediaInfo} mediaSource 被移动的媒体源
41
- * @param {Rect} rect 移动后的位置、区域数据
42
- */
43
- onSourceMoved = "onSourceMoved",
44
- /**
45
- * @description 媒体源尺寸变化事件
46
- *
47
- * @event TRTCMediaMixingEvent#onSourceResized
48
- * @param {TRTCMediaInfo} mediaSource 尺寸变化的媒体源
49
- * @param {Rect} rect 尺寸变化后的位置、区域数据
50
- */
51
- onSourceResized = "onSourceResized",
52
- /**
53
- * @description 媒体源鼠标右键事件
54
- *
55
- * @event TRTCMediaMixingEvent#onRightButtonClicked
56
- * @param {TRTCMediaInfo} mediaSource 鼠标右键点击的媒体源
57
- */
58
- onRightButtonClicked = "onRightButtonClicked"
59
- }
60
- export declare enum TRTCMediaMixingErrorCode {
61
- Success = 0,
62
- Error = -1,
63
- InvalidParams = -2,
64
- NotFoundSource = -3,
65
- ImageSourceLoadFailed = -4
66
- }
67
- /**
68
- * 本地混流管理器
69
- */
70
- export declare class TRTCMediaMixingManager {
71
- private logPrefix;
72
- private nodeMediaMixingPlugin;
73
- private nodeTRTCCloud;
74
- private deviceManager;
75
- private eventEmitter;
76
- private publishParams;
77
- private mediaMixingDesigner;
78
- private windowID;
79
- private view;
80
- private resizeObserver;
81
- private sourceList;
82
- constructor(options: {
83
- deviceManager: TRTCDeviceManager;
84
- nodeTRTCCloud: typeof NodeTRTCEngine.NodeRemoteTRTCCloud;
85
- });
86
- destroy(): void;
87
- private eventHandler;
88
- /**
89
- * 设置混流视频预览参数
90
- *
91
- * @param windowID {Number|Uint8Array} - 操作系统层的窗口 ID,Electron 下可以通过 Electron API [BrowserWindow.getNativeWindowHandle()]{@link https://www.electronjs.org/docs/latest/api/browser-window#wingetnativewindowhandle} 接口获取
92
- * @param viewOrRegion {HTMLElement | Rect | null} - 本地混流视频显示位置
93
- * - 传入 HTMLElement 元素,则 SDK 将本地混流视频显示在 HTMLElement 元素内,同时支持点击选中、移动、缩放媒体源,支持触发右键菜单事件。HTMLElement 元素必须是块元素。
94
- * - 传入 Rect 显示区域,则 SDK 将本地混流视频显示在 Rect 指定区域内,不支持点击选中、移动、缩放媒体源,不支持触发右键菜单事件,这些功能您可以在 Web 页面中自行实现。
95
- * - 传入 null 则 SDK 将停止显示本地混流视频。
96
- *
97
- * @example
98
- * // Display in HTML Element
99
- * import TRTCCloud from 'trtc-electron-sdk';
100
- *
101
- * const trtcCloud = TRTCCloud.getTRTCShareInstance({
102
- * isIPCMode: true
103
- * });
104
- *
105
- * const mediaMixingManager = trtcCloud.getMediaMixingManager();
106
- *
107
- * const windowID = 0; // Use Electron API BrowserWindow.getNativeWindowHandle()
108
- * const previewDOM = document.getElementById("preview-local-mixed-media-stream");
109
- * mediaMixingManager.setDisplayParams(windowID, previewDOM);
110
- *
111
- * @example
112
- * // Display in a rectangle section
113
- * import TRTCCloud from 'trtc-electron-sdk';
114
- *
115
- * const trtcCloud = TRTCCloud.getTRTCShareInstance({
116
- * isIPCMode: true
117
- * });
118
- *
119
- * const mediaMixingManager = trtcCloud.getMediaMixingManager();
120
- *
121
- * const windowID = 0; // Use Electron API BrowserWindow.getNativeWindowHandle()
122
- * const previewDOM = document.getElementById("preview-local-mixed-media-stream");
123
- * const domRect = previewDOM.getBoundingClientRect();
124
- * const rect = {
125
- * left: domRect.left * window.devicePixelRatio,
126
- * right: domRect.right * window.devicePixelRatio,
127
- * top: domRect.top * window.devicePixelRatio,
128
- * bottom: domRect.bottom * window.devicePixelRatio
129
- * };
130
- *
131
- * mediaMixingManager.setDisplayParams(windowID, previewDOM);
132
- */
133
- setDisplayParams(windowID: number | Uint8Array, viewOrRegion: HTMLElement | Rect | null): void;
134
- /**
135
- * 添加媒体源
136
- * @param mediaSource {TRTCMediaSource} - 媒体源信息
137
- * @returns {Promise<Rect>}
138
- */
139
- addMediaSource(mediaSource: TRTCMediaSource): Promise<Rect>;
140
- /**
141
- * 删除媒体源
142
- * @param mediaSource {TRTCMediaSource} - 媒体源信息
143
- * @returns {Promise<void>}
144
- */
145
- removeMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
146
- /**
147
- * 更新媒体源
148
- * @param mediaSource {TRTCMediaSource} - 媒体源信息
149
- * @returns {Promise<void>}
150
- */
151
- updateMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
152
- /**
153
- * 设置摄像头采集参数
154
- * @param cameraID {string} - 摄像头 ID
155
- * @param params {TRTCCameraCaptureParams} - 摄像头采集参数
156
- */
157
- setCameraCaptureParam(cameraID: string, params: TRTCCameraCaptureParams): void;
158
- /**
159
- * 开始推流
160
- * @returns {Promise<void>}
161
- */
162
- startPublish(): Promise<void>;
163
- /**
164
- * 停止推流
165
- * @returns {Promise<void>}
166
- */
167
- stopPublish(): Promise<void>;
168
- /**
169
- * 更新本地混流编码参数
170
- * @param params {TRTCMediaMixingEncParam} - 推流视频编码参数、背景色等参数
171
- * @returns {Promise<void>}
172
- */
173
- updatePublishParams(params: TRTCMediaMixingEncParam): Promise<void>;
174
- /**
175
- * @private
176
- * 设置服务进程程序路径
177
- *
178
- * 开发模式,默认路径:node_modules\\trtc-electron-sdk\\build\\Release\\liteav_media_server.exe
179
- * 构建模式,默认路径:${resourcesPath}\\liteav_media_server.exe
180
- *
181
- * 如果用户应用有特殊配置,默认路径可能找不到服务进程程序,需要自行传入路径。
182
- *
183
- * @param path {string} - 服务进程程序路径
184
- *
185
- * @returns {Promise<void>}
186
- */
187
- setMediaServerPath(path: string): Promise<void>;
188
- /**
189
- * 注册事件监听
190
- *
191
- * @param event {TRTCMediaMixingEvent} - 事件名称
192
- * @param func {Function} - 事件回调函数
193
- */
194
- on(event: TRTCMediaMixingEvent, func: (...args: any[]) => void): void;
195
- /**
196
- * 取消事件监听
197
- *
198
- * @param event {TRTCMediaMixingEvent} - 事件名
199
- * @param func {Function} - 事件回调函数
200
- */
201
- off(event: TRTCMediaMixingEvent, func: (...args: any[]) => void): void;
202
- private initResizeObserver;
203
- private onPreviewAreaResize;
204
- private onVisibilityChange;
205
- private setDisplayRect;
206
- private createDesigner;
207
- private destroyDesigner;
208
- private listenDesignerEvent;
209
- private unlistenDesignerEvent;
210
- private onError;
211
- private onSourceSelected;
212
- private onSourceMoved;
213
- private onSourceResized;
214
- private onRightButtonClicked;
215
- private isSameMediaSource;
216
- private isMediaSourceExisted;
217
- private findMediaSourceIndex;
218
- private findSelectedMediaSource;
219
- private unselectMediaSource;
220
- startCameraDeviceTest(windowID: number | Uint8Array, rect?: Rect): Promise<number>;
221
- stopCameraDeviceTest(): Promise<number>;
222
- setCameraTestRenderMirror(mirror: boolean): void;
223
- setCameraTestDeviceId(cameraId: string): void;
224
- setCameraTestResolution(width: number, height: number): void;
225
- setCameraTestVideoPluginPath(path: string): void;
226
- setCameraTestVideoPluginParameter(params: string): void;
227
- }
1
+ import TRTCMediaMixingManager, { TRTCMediaMixingEvent } from "./MediaMixingManager";
2
+ import TRTCMediaMixingService, { TRTCMediaMixingServiceEvent } from "./MediaMixingService";
3
+ export { TRTCMediaMixingErrorCode, TRTCMediaSourceType, TRTCMediaSource, TRTCMediaMixingEncParam, TRTCPhoneMirrorParam, TRTCStreamLayoutMode, TRTCUserStream, TRTCStreamInfo, TRTCStreamLayout } from './types';
4
+ export { TRTCMediaMixingManager, TRTCMediaMixingService, TRTCMediaMixingEvent, TRTCMediaMixingServiceEvent };
228
5
  export default TRTCMediaMixingManager;