trtc-electron-sdk 12.1.608 → 12.2.701

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,132 @@
1
+ import { TRTCVideoEncParam, TRTCVideoRotation, TRTCVideoFillMode, TRTCVideoMirrorType, TRTCCameraCaptureParams, Rect } from '../../trtc_define';
2
+ import { TRTCDeviceManager } from '../DeviceManager';
3
+ export { TRTCLocalMediaTranscodingParams } from '../../LocalMediaTranscoder/index';
4
+ export declare enum TRTCMediaMixingEvent {
5
+ onError = "onError"
6
+ }
7
+ export declare enum TRTCMediaSourceType {
8
+ kCamera = 0,
9
+ kScreen = 1,
10
+ kImage = 2,
11
+ kRemoteVideo = 3
12
+ }
13
+ export declare type TRTCMediaSource = {
14
+ sourceType: TRTCMediaSourceType;
15
+ sourceId: string;
16
+ zOrder: number;
17
+ enableGreenScreen?: boolean;
18
+ rect: Rect;
19
+ isSelected?: boolean;
20
+ rotation?: TRTCVideoRotation;
21
+ fillMode?: TRTCVideoFillMode;
22
+ mirrorType?: TRTCVideoMirrorType;
23
+ };
24
+ export declare type TRTCMediaMixingEncParam = {
25
+ videoEncoderParams: TRTCVideoEncParam;
26
+ canvasColor: number;
27
+ };
28
+ /**
29
+ * 本地混流管理器
30
+ */
31
+ export declare class TRTCMediaMixingManager {
32
+ private logPrefix;
33
+ private static mediaMixingManager;
34
+ private nodeMediaMixingPlugin;
35
+ private deviceManager;
36
+ private eventEmitter;
37
+ constructor(options: {
38
+ deviceManager: TRTCDeviceManager;
39
+ });
40
+ /**
41
+ * 获取混流管理器
42
+ *
43
+ * @returns {TRTCMediaMixingManager}
44
+ */
45
+ static getInstance(options: {
46
+ deviceManager: TRTCDeviceManager;
47
+ }): TRTCMediaMixingManager;
48
+ private eventHandler;
49
+ /**
50
+ * 设置混流视频预览参数
51
+ *
52
+ * @param windowID {Number|Uint8Array} - 操作系统层的窗口 ID,Electron 下可以通过 getNativeWindowID 接口获取
53
+ * @param region {Rect} - 视频在窗口中的显示区域
54
+ */
55
+ setDisplayParams(windowID: number | Uint8Array, region: Rect): void;
56
+ /**
57
+ * 添加媒体源
58
+ * @param mediaSource {TRTCMediaSource} - 媒体源信息
59
+ * @returns {Promise<Rect>}
60
+ */
61
+ addMediaSource(mediaSource: TRTCMediaSource): Promise<Rect>;
62
+ /**
63
+ * 删除媒体源
64
+ * @param mediaSource {TRTCMediaSource} - 媒体源信息
65
+ * @returns {Promise<void>}
66
+ */
67
+ removeMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
68
+ /**
69
+ * 更新媒体源
70
+ * @param mediaSource {TRTCMediaSource} - 媒体源信息
71
+ * @returns {Promise<void>}
72
+ */
73
+ updateMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
74
+ /**
75
+ * 设置摄像头采集参数
76
+ * @param cameraID {string} - 摄像头 ID
77
+ * @param params {TRTCCameraCaptureParams} - 摄像头采集参数
78
+ */
79
+ setCameraCaptureParam(cameraID: string, params: TRTCCameraCaptureParams): void;
80
+ /**
81
+ * 开始推流
82
+ * @returns {Promise<void>}
83
+ */
84
+ startPublish(): Promise<void>;
85
+ /**
86
+ * 停止推流
87
+ * @returns {Promise<void>}
88
+ */
89
+ stopPublish(): Promise<void>;
90
+ /**
91
+ * 更新本地混流编码参数
92
+ * @param params {TRTCMediaMixingEncParam} - 推流视频编码参数、背景色等参数
93
+ * @returns {Promise<void>}
94
+ */
95
+ updatePublishParams(params: TRTCMediaMixingEncParam): Promise<void>;
96
+ /**
97
+ * @private
98
+ * 设置服务进程程序路径
99
+ *
100
+ * 开发模式,默认路径:node_modules\\trtc-electron-sdk\\build\\Release\\liteav_media_server.exe
101
+ * 构建模式,默认路径:${resourcesPath}\\liteav_media_server.exe
102
+ *
103
+ * 如果用户应用有特殊配置,默认路径可能找不到服务进程程序,需要自行传入路径。
104
+ *
105
+ * @param path {string} - 设置服务进程程序路径
106
+ *
107
+ * @returns {Promise<void>}
108
+ */
109
+ setMediaServerPath(path: string): Promise<void>;
110
+ /**
111
+ * 注册事件监听
112
+ *
113
+ * @param event {string} - 事件名称
114
+ * @param func {Function} - 事件回调函数
115
+ */
116
+ on(event: string, func: (...args: any[]) => void): void;
117
+ /**
118
+ * 取消事件监听
119
+ *
120
+ * @param event {string} - 事件名
121
+ * @param func {Function} - 事件回调函数
122
+ */
123
+ off(event: string, func: (...args: any[]) => void): void;
124
+ startCameraDeviceTest(windowID: number | Uint8Array, rect?: Rect): Promise<number>;
125
+ stopCameraDeviceTest(): Promise<number>;
126
+ setCameraTestRenderMirror(mirror: boolean): void;
127
+ setCameraTestDeviceId(cameraId: string): void;
128
+ setCameraTestResolution(width: number, height: number): void;
129
+ setCameraTestVideoPluginPath(path: string): void;
130
+ setCameraTestVideoPluginParameter(params: string): void;
131
+ }
132
+ export default TRTCMediaMixingManager;
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TRTCMediaMixingManager = exports.TRTCMediaSourceType = exports.TRTCMediaMixingEvent = void 0;
13
+ const events_1 = require("events");
14
+ const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
15
+ var TRTCMediaMixingEvent;
16
+ (function (TRTCMediaMixingEvent) {
17
+ // 合图插件异常(比如独立进程异常等)
18
+ TRTCMediaMixingEvent["onError"] = "onError";
19
+ })(TRTCMediaMixingEvent = exports.TRTCMediaMixingEvent || (exports.TRTCMediaMixingEvent = {}));
20
+ var TRTCMediaSourceType;
21
+ (function (TRTCMediaSourceType) {
22
+ TRTCMediaSourceType[TRTCMediaSourceType["kCamera"] = 0] = "kCamera";
23
+ TRTCMediaSourceType[TRTCMediaSourceType["kScreen"] = 1] = "kScreen";
24
+ TRTCMediaSourceType[TRTCMediaSourceType["kImage"] = 2] = "kImage";
25
+ TRTCMediaSourceType[TRTCMediaSourceType["kRemoteVideo"] = 3] = "kRemoteVideo";
26
+ })(TRTCMediaSourceType = exports.TRTCMediaSourceType || (exports.TRTCMediaSourceType = {}));
27
+ const logger = console;
28
+ /**
29
+ * 本地混流管理器
30
+ */
31
+ class TRTCMediaMixingManager {
32
+ constructor(options) {
33
+ this.logPrefix = '[TRTCMediaMixingManager]';
34
+ if (!TRTCMediaMixingManager.mediaMixingManager) {
35
+ this.eventEmitter = new events_1.EventEmitter();
36
+ this.eventHandler = this.eventHandler.bind(this);
37
+ this.nodeMediaMixingPlugin = new NodeTRTCEngine.NodeRemoteMultiSourcePlugin();
38
+ this.nodeMediaMixingPlugin.setRemoteMultiSourcePluginCallback(this.eventHandler);
39
+ this.deviceManager = options.deviceManager;
40
+ TRTCMediaMixingManager.mediaMixingManager = this;
41
+ this.setMediaServerPath('');
42
+ }
43
+ else {
44
+ return TRTCMediaMixingManager.mediaMixingManager;
45
+ }
46
+ }
47
+ /**
48
+ * 获取混流管理器
49
+ *
50
+ * @returns {TRTCMediaMixingManager}
51
+ */
52
+ static getInstance(options) {
53
+ if (!TRTCMediaMixingManager.mediaMixingManager) {
54
+ TRTCMediaMixingManager.mediaMixingManager = new TRTCMediaMixingManager(options);
55
+ }
56
+ return TRTCMediaMixingManager.mediaMixingManager;
57
+ }
58
+ eventHandler(args) {
59
+ logger.log(`${this.logPrefix} event:`, args);
60
+ // const key = args[0] as string;
61
+ // const data = args[1] as { [key: string]: never };
62
+ // To do: 待完善
63
+ }
64
+ /**
65
+ * 设置混流视频预览参数
66
+ *
67
+ * @param windowID {Number|Uint8Array} - 操作系统层的窗口 ID,Electron 下可以通过 getNativeWindowID 接口获取
68
+ * @param region {Rect} - 视频在窗口中的显示区域
69
+ */
70
+ setDisplayParams(windowID, region) {
71
+ let newWindowID = 0;
72
+ if (windowID instanceof Uint8Array) {
73
+ for (let i = windowID.length - 1; i >= 0; i--) {
74
+ newWindowID = (newWindowID * 256) + windowID[i];
75
+ }
76
+ }
77
+ else {
78
+ newWindowID = windowID;
79
+ }
80
+ this.nodeMediaMixingPlugin.setDisplayParams(newWindowID, region);
81
+ }
82
+ /**
83
+ * 添加媒体源
84
+ * @param mediaSource {TRTCMediaSource} - 媒体源信息
85
+ * @returns {Promise<Rect>}
86
+ */
87
+ addMediaSource(mediaSource) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ return yield this.nodeMediaMixingPlugin.addMediaSource(mediaSource);
90
+ });
91
+ }
92
+ /**
93
+ * 删除媒体源
94
+ * @param mediaSource {TRTCMediaSource} - 媒体源信息
95
+ * @returns {Promise<void>}
96
+ */
97
+ removeMediaSource(mediaSource) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ return yield this.nodeMediaMixingPlugin.removeMediaSource(mediaSource);
100
+ });
101
+ }
102
+ /**
103
+ * 更新媒体源
104
+ * @param mediaSource {TRTCMediaSource} - 媒体源信息
105
+ * @returns {Promise<void>}
106
+ */
107
+ updateMediaSource(mediaSource) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ return yield this.nodeMediaMixingPlugin.updateMediaSource(mediaSource);
110
+ });
111
+ }
112
+ /**
113
+ * 设置摄像头采集参数
114
+ * @param cameraID {string} - 摄像头 ID
115
+ * @param params {TRTCCameraCaptureParams} - 摄像头采集参数
116
+ */
117
+ setCameraCaptureParam(cameraID, params) {
118
+ this.nodeMediaMixingPlugin.setCameraCaptureParam(cameraID, params);
119
+ }
120
+ /**
121
+ * 开始推流
122
+ * @returns {Promise<void>}
123
+ */
124
+ startPublish() {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ return yield this.nodeMediaMixingPlugin.startPublish();
127
+ });
128
+ }
129
+ /**
130
+ * 停止推流
131
+ * @returns {Promise<void>}
132
+ */
133
+ stopPublish() {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ return yield this.nodeMediaMixingPlugin.stopPublish();
136
+ });
137
+ }
138
+ /**
139
+ * 更新本地混流编码参数
140
+ * @param params {TRTCMediaMixingEncParam} - 推流视频编码参数、背景色等参数
141
+ * @returns {Promise<void>}
142
+ */
143
+ updatePublishParams(params) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ return yield this.nodeMediaMixingPlugin.updatePublishParams(params);
146
+ });
147
+ }
148
+ /**
149
+ * @private
150
+ * 设置服务进程程序路径
151
+ *
152
+ * 开发模式,默认路径:node_modules\\trtc-electron-sdk\\build\\Release\\liteav_media_server.exe
153
+ * 构建模式,默认路径:${resourcesPath}\\liteav_media_server.exe
154
+ *
155
+ * 如果用户应用有特殊配置,默认路径可能找不到服务进程程序,需要自行传入路径。
156
+ *
157
+ * @param path {string} - 设置服务进程程序路径
158
+ *
159
+ * @returns {Promise<void>}
160
+ */
161
+ setMediaServerPath(path) {
162
+ return __awaiter(this, void 0, void 0, function* () {
163
+ let serverPath = '';
164
+ if (path && path.trim() !== '') {
165
+ serverPath = path;
166
+ }
167
+ else {
168
+ const { resourcesPath, execPath } = globalThis.process;
169
+ if (execPath.endsWith('electron.exe')) {
170
+ serverPath = '..\\..\\..\\..\\node_modules\\trtc-electron-sdk\\build\\Release\\liteav_media_server.exe';
171
+ }
172
+ else {
173
+ serverPath = `${resourcesPath}\\liteav_media_server.exe`;
174
+ }
175
+ }
176
+ logger.log(`${this.logPrefix} server path:${serverPath}`);
177
+ return yield this.nodeMediaMixingPlugin.setMediaServerPath(serverPath);
178
+ });
179
+ }
180
+ /**
181
+ * 注册事件监听
182
+ *
183
+ * @param event {string} - 事件名称
184
+ * @param func {Function} - 事件回调函数
185
+ */
186
+ on(event, func) {
187
+ var _a;
188
+ (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.on(event, func);
189
+ }
190
+ /**
191
+ * 取消事件监听
192
+ *
193
+ * @param event {string} - 事件名
194
+ * @param func {Function} - 事件回调函数
195
+ */
196
+ off(event, func) {
197
+ var _a;
198
+ (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.off(event, func);
199
+ }
200
+ // ****** 这一部分接口暴露不合理,暂时不对暴露在 API 文档上 **************/
201
+ startCameraDeviceTest(windowID, rect) {
202
+ return this.deviceManager.startCameraDeviceTest(windowID, rect);
203
+ }
204
+ stopCameraDeviceTest() {
205
+ return this.deviceManager.stopCameraDeviceTest();
206
+ }
207
+ setCameraTestRenderMirror(mirror) {
208
+ this.deviceManager.setCameraTestRenderMirror(mirror);
209
+ }
210
+ setCameraTestDeviceId(cameraId) {
211
+ this.deviceManager.setCameraTestDeviceId(cameraId);
212
+ }
213
+ setCameraTestResolution(width, height) {
214
+ this.deviceManager.setCameraTestResolution(width, height);
215
+ }
216
+ setCameraTestVideoPluginPath(path) {
217
+ this.deviceManager.setCameraTestVideoPluginPath(path);
218
+ }
219
+ setCameraTestVideoPluginParameter(params) {
220
+ this.deviceManager.setCameraTestVideoPluginParameter(params);
221
+ }
222
+ }
223
+ exports.TRTCMediaMixingManager = TRTCMediaMixingManager;
224
+ exports.default = TRTCMediaMixingManager;
@@ -0,0 +1,62 @@
1
+ import { TRTCPluginType, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioProcessPluginOptions, TRTCPluginInfo } from "../../trtc_define";
2
+ declare const NodeTRTCEngine: any;
3
+ /**
4
+ * TRTC 插件
5
+ */
6
+ export declare class TRTCPlugin {
7
+ private logPrefix;
8
+ private pluginId;
9
+ private device_id;
10
+ private nativeVideoEffectPlugin;
11
+ constructor(pluginId: string, deviceId: string, nativeVideoEffectPlugin: typeof NodeTRTCEngine.NodeRemoteVideoPlugin);
12
+ get deviceId(): string;
13
+ get id(): string;
14
+ enable(flag?: boolean): void;
15
+ /**
16
+ * @deprecated
17
+ */
18
+ disable(): void;
19
+ setParameter(param: string): void;
20
+ }
21
+ /**
22
+ * TRTC 插件管理器
23
+ */
24
+ export declare class TRTCPluginManager {
25
+ private logPrefix;
26
+ private static pluginManager;
27
+ private static isIPCMode;
28
+ private nodePluginManager;
29
+ private videoProcessBufferType;
30
+ private videoProcessPixelFormat;
31
+ constructor(options: {
32
+ isIPCMode: boolean;
33
+ nodeTRTCCloud: typeof NodeTRTCEngine.TRTCCloud | typeof NodeTRTCEngine.RemoteTRTCCloud;
34
+ });
35
+ /**
36
+ * 获取插件管理器
37
+ *
38
+ * @returns {TRTCPluginManager}
39
+ */
40
+ static getInstance(options: {
41
+ isIPCMode: boolean;
42
+ nodeTRTCCloud: typeof NodeTRTCEngine.TRTCCloud | typeof NodeTRTCEngine.RemoteTRTCCloud;
43
+ }): TRTCPluginManager;
44
+ setPluginParams(type: TRTCPluginType, options: TRTCVideoProcessPluginOptions | TRTCMediaEncryptDecryptPluginOptions | TRTCAudioProcessPluginOptions): void;
45
+ private _setVideoProcessPluginParams;
46
+ private _setMediaEncryptDecryptPluginParams;
47
+ private _setAudioProcessPluginParams;
48
+ addPlugin(options: {
49
+ id: string;
50
+ path: string;
51
+ type?: TRTCPluginType;
52
+ deviceId?: string;
53
+ }): TRTCPluginInfo;
54
+ private _createPlugin;
55
+ removePlugin(pluginId: string, deviceId: string): void;
56
+ setCallback(callback: (pluginId: string, error: number, errorMessage: string) => void): void;
57
+ /**
58
+ * @deprecated
59
+ */
60
+ getPluginList(): TRTCPluginInfo[] | null;
61
+ }
62
+ export default TRTCPluginManager;
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TRTCPluginManager = exports.TRTCPlugin = void 0;
4
+ const trtc_define_1 = require("../../trtc_define");
5
+ const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
6
+ const logger = console;
7
+ /**
8
+ * TRTC 插件
9
+ */
10
+ class TRTCPlugin {
11
+ constructor(pluginId, deviceId, nativeVideoEffectPlugin) {
12
+ this.logPrefix = "[TRTCPlugin]";
13
+ this.pluginId = pluginId;
14
+ this.device_id = deviceId;
15
+ this.nativeVideoEffectPlugin = nativeVideoEffectPlugin;
16
+ }
17
+ get deviceId() {
18
+ return this.device_id;
19
+ }
20
+ get id() {
21
+ return this.pluginId;
22
+ }
23
+ enable(flag = true) {
24
+ logger.log(`${this.logPrefix}enable:${flag} ${this.pluginId}`);
25
+ this.nativeVideoEffectPlugin.enable(flag);
26
+ }
27
+ /**
28
+ * @deprecated
29
+ */
30
+ disable() {
31
+ this.enable(false);
32
+ }
33
+ setParameter(param) {
34
+ logger.log(`${this.logPrefix}setParameter:${this.pluginId}`);
35
+ this.nativeVideoEffectPlugin.setParameter(param);
36
+ }
37
+ }
38
+ exports.TRTCPlugin = TRTCPlugin;
39
+ /**
40
+ * TRTC 插件管理器
41
+ */
42
+ class TRTCPluginManager {
43
+ constructor(options) {
44
+ this.logPrefix = '[TRTCPluginManager]';
45
+ this.videoProcessBufferType = trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer;
46
+ this.videoProcessPixelFormat = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
47
+ if (!TRTCPluginManager.pluginManager) {
48
+ TRTCPluginManager.isIPCMode = options.isIPCMode;
49
+ if (TRTCPluginManager.isIPCMode) {
50
+ this.nodePluginManager = new NodeTRTCEngine.NodeRemoteVideoPluginManager();
51
+ }
52
+ else {
53
+ this.videoProcessBufferType = trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer;
54
+ this.videoProcessPixelFormat = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
55
+ this.nodePluginManager = options.nodeTRTCCloud;
56
+ }
57
+ TRTCPluginManager.pluginManager = this;
58
+ }
59
+ else {
60
+ return TRTCPluginManager.pluginManager;
61
+ }
62
+ }
63
+ ;
64
+ /**
65
+ * 获取插件管理器
66
+ *
67
+ * @returns {TRTCPluginManager}
68
+ */
69
+ static getInstance(options) {
70
+ if (!TRTCPluginManager.pluginManager) {
71
+ TRTCPluginManager.pluginManager = new TRTCPluginManager(options);
72
+ }
73
+ return TRTCPluginManager.pluginManager;
74
+ }
75
+ setPluginParams(type, options) {
76
+ logger.log(`${this.logPrefix}setPluginParams params:`, type, options);
77
+ if (TRTCPluginManager.isIPCMode) {
78
+ if (type === trtc_define_1.TRTCPluginType.TRTCPluginTypeVideoProcess) {
79
+ this.nodePluginManager.setVideoPluginFormat(trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer, options.pixelFormat);
80
+ }
81
+ else {
82
+ logger.log(`${this.logPrefix}setPluginParams not supported params:`, type, options);
83
+ }
84
+ }
85
+ else {
86
+ switch (type) {
87
+ case trtc_define_1.TRTCPluginType.TRTCPluginTypeVideoProcess:
88
+ this._setVideoProcessPluginParams(options);
89
+ break;
90
+ case trtc_define_1.TRTCPluginType.TRTCPluginTypeMediaEncryptDecrypt:
91
+ this._setMediaEncryptDecryptPluginParams(options);
92
+ break;
93
+ case trtc_define_1.TRTCPluginType.TRTCPluginTypeAudioProcess:
94
+ this._setAudioProcessPluginParams(options);
95
+ break;
96
+ default:
97
+ logger.log(`setPluginParams invalid type:${type}`);
98
+ break;
99
+ }
100
+ }
101
+ }
102
+ _setVideoProcessPluginParams(options) {
103
+ if (options.pixelFormat !== undefined) {
104
+ switch (options.pixelFormat) {
105
+ case trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420:
106
+ case trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_RGBA32:
107
+ case trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_BGRA32:
108
+ this.videoProcessBufferType = trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer;
109
+ break;
110
+ case trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_Texture_2D:
111
+ this.videoProcessBufferType = trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Texture;
112
+ break;
113
+ default:
114
+ logger.error(`${this.logPrefix}setPluginParams() unspported pixelFormat: ${options.pixelFormat}`);
115
+ return;
116
+ }
117
+ this.videoProcessPixelFormat = options.pixelFormat;
118
+ }
119
+ if (options.enable !== undefined) {
120
+ this.nodePluginManager.enableLocalVideoCustomProcess(!!options.enable, this.videoProcessPixelFormat, this.videoProcessBufferType);
121
+ }
122
+ }
123
+ _setMediaEncryptDecryptPluginParams(options) {
124
+ if (options.enable !== undefined) {
125
+ this.nodePluginManager.enableEncodedDataCustomProcess(!!options.enable);
126
+ }
127
+ }
128
+ _setAudioProcessPluginParams(options) {
129
+ if (options.enable !== undefined) {
130
+ this.nodePluginManager.enableAudioFrameCustomProcess(!!options.enable);
131
+ }
132
+ }
133
+ addPlugin(options) {
134
+ logger.log(`${this.logPrefix}addPlugin options:`, options);
135
+ if (TRTCPluginManager.isIPCMode) {
136
+ const nativeVideoEffectPlugin = this.nodePluginManager.addVideoPlugin(options.deviceId, options.id, options.path);
137
+ return new TRTCPlugin(options.id, options.deviceId || '', nativeVideoEffectPlugin);
138
+ }
139
+ else {
140
+ const pluginType = options.type || trtc_define_1.TRTCPluginType.TRTCPluginTypeVideoProcess;
141
+ const realDeviceId = options.deviceId || "";
142
+ this.nodePluginManager.registerPlugin(options.id, options.path, pluginType, realDeviceId);
143
+ return this._createPlugin(options.id, realDeviceId);
144
+ }
145
+ }
146
+ _createPlugin(pluginId, deviceId) {
147
+ return {
148
+ id: pluginId,
149
+ deviceId: deviceId || "",
150
+ enable: (flag = true) => {
151
+ return this.nodePluginManager.enablePlugin(pluginId, flag, deviceId || "");
152
+ },
153
+ disable: () => {
154
+ return this.nodePluginManager.enablePlugin(pluginId, false, deviceId || "");
155
+ },
156
+ setParameter: (param) => {
157
+ return this.nodePluginManager.setPluginParameter(pluginId, param, deviceId || "");
158
+ }
159
+ };
160
+ }
161
+ removePlugin(pluginId, deviceId) {
162
+ logger.log(`${this.logPrefix}removePlugin pluginId:${pluginId} deviceId:${deviceId}`);
163
+ if (TRTCPluginManager.isIPCMode) {
164
+ this.nodePluginManager.removeVideoPlugin(deviceId, pluginId);
165
+ }
166
+ else {
167
+ this.nodePluginManager.unregisterPlugin(pluginId, deviceId || "");
168
+ }
169
+ }
170
+ setCallback(callback) {
171
+ if (TRTCPluginManager.isIPCMode) {
172
+ this.nodePluginManager.setCallback(callback);
173
+ }
174
+ else {
175
+ this.nodePluginManager.setPluginCallback(callback);
176
+ }
177
+ }
178
+ /**
179
+ * @deprecated
180
+ */
181
+ getPluginList() {
182
+ logger.log(`${this.logPrefix}getPluginList`);
183
+ if (TRTCPluginManager.isIPCMode) {
184
+ logger.warn(`${this.logPrefix}getPluginList not supported`);
185
+ return null;
186
+ }
187
+ else {
188
+ return this.nodePluginManager.getPluginIds().map((item) => {
189
+ const ids = item.split('__');
190
+ return this._createPlugin(ids[0], ids[1]);
191
+ });
192
+ }
193
+ }
194
+ }
195
+ exports.TRTCPluginManager = TRTCPluginManager;
196
+ exports.default = TRTCPluginManager;