trtc-electron-sdk 12.2.701 → 12.2.702-beta.0

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.
@@ -90,8 +90,8 @@ class VideoRenderFPSMonitor {
90
90
  }
91
91
  else {
92
92
  logger_1.default.info(`${this.logPrefix} document show`);
93
- this.videoRenderFPS = 5; // 慢启动
94
- this.pageRefreshFPS = 5;
93
+ this.videoRenderFPS = 30;
94
+ this.pageRefreshFPS = 30;
95
95
  }
96
96
  this.lastVideoRenderFPS = this.videoRenderFPS;
97
97
  this.lastTimestamp = 0;
@@ -5,22 +5,14 @@ declare const NodeTRTCEngine: any;
5
5
  */
6
6
  export declare class TRTCAudioEffectManager {
7
7
  private logPrefix;
8
- private static audioEffectManager;
9
- private static isIPCMode;
8
+ private isIPCMode;
10
9
  private nodeAudioEffectManager;
11
10
  private promiseStore;
12
11
  constructor(options: {
13
12
  isIPCMode: boolean;
14
13
  nodeTRTCCloud: typeof NodeTRTCEngine.TRTCCloud | typeof NodeTRTCEngine.RemoteTRTCCloud;
15
14
  });
16
- /**
17
- * 获取音效管理器
18
- * @returns {TRTCAudioEffectManager}
19
- */
20
- static getInstance(options: {
21
- isIPCMode: boolean;
22
- nodeTRTCCloud: typeof NodeTRTCEngine.TRTCCloud | typeof NodeTRTCEngine.RemoteTRTCCloud;
23
- }): TRTCAudioEffectManager;
15
+ destroy(): void;
24
16
  /**
25
17
  * 开启耳返
26
18
  *
@@ -10,32 +10,27 @@ const logger = console;
10
10
  class TRTCAudioEffectManager {
11
11
  constructor(options) {
12
12
  this.logPrefix = "[TRTCAudioEffectManager]";
13
- if (!TRTCAudioEffectManager.audioEffectManager) {
14
- this.promiseStore = new Map();
15
- this.eventHandler = this.eventHandler.bind(this);
16
- TRTCAudioEffectManager.isIPCMode = options.isIPCMode;
17
- if (TRTCAudioEffectManager.isIPCMode) {
18
- this.nodeAudioEffectManager = new NodeTRTCEngine.NodeRemoteAudioEffectManager();
19
- this.nodeAudioEffectManager.setRemoteAudioEffectManagerCallback(this.eventHandler);
20
- }
21
- else {
22
- this.nodeAudioEffectManager = options.nodeTRTCCloud;
23
- }
24
- TRTCAudioEffectManager.audioEffectManager = this;
13
+ this.promiseStore = new Map();
14
+ this.eventHandler = this.eventHandler.bind(this);
15
+ this.isIPCMode = options.isIPCMode;
16
+ if (this.isIPCMode) {
17
+ this.nodeAudioEffectManager = new NodeTRTCEngine.NodeRemoteAudioEffectManager();
18
+ this.nodeAudioEffectManager.setRemoteAudioEffectManagerCallback(this.eventHandler);
25
19
  }
26
20
  else {
27
- return TRTCAudioEffectManager.audioEffectManager;
21
+ this.nodeAudioEffectManager = options.nodeTRTCCloud;
28
22
  }
29
23
  }
30
- /**
31
- * 获取音效管理器
32
- * @returns {TRTCAudioEffectManager}
33
- */
34
- static getInstance(options) {
35
- if (!TRTCAudioEffectManager.audioEffectManager) {
36
- TRTCAudioEffectManager.audioEffectManager = new TRTCAudioEffectManager(options);
37
- }
38
- return TRTCAudioEffectManager.audioEffectManager;
24
+ destroy() {
25
+ var _a, _b;
26
+ this.nodeAudioEffectManager = null;
27
+ (_a = this.promiseStore) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
28
+ value.forEach(({ reject }) => {
29
+ reject();
30
+ });
31
+ });
32
+ (_b = this.promiseStore) === null || _b === void 0 ? void 0 : _b.clear();
33
+ this.promiseStore = undefined;
39
34
  }
40
35
  /////////////////////////////////////////////////////////////////////////////////
41
36
  //
@@ -266,7 +261,7 @@ class TRTCAudioEffectManager {
266
261
  */
267
262
  getMusicCurrentPosInMS(id) {
268
263
  logger.debug(`${this.logPrefix}getMusicCurrentPosInMS: ${id}`);
269
- if (TRTCAudioEffectManager.isIPCMode) {
264
+ if (this.isIPCMode) {
270
265
  return new Promise((resolve, reject) => {
271
266
  const key = `onGetMusicCurrentPosInMS-${id}`;
272
267
  this.addPromise(key, resolve, reject);
@@ -285,7 +280,7 @@ class TRTCAudioEffectManager {
285
280
  */
286
281
  getMusicDurationInMS(path) {
287
282
  logger.debug(`${this.logPrefix}getMusicDurationInMS: ${path}`);
288
- if (TRTCAudioEffectManager.isIPCMode) {
283
+ if (this.isIPCMode) {
289
284
  return new Promise((resolve, reject) => {
290
285
  const key = `onGetMusicDurationInMS-${path}`;
291
286
  this.addPromise(key, resolve, reject);
@@ -361,7 +356,7 @@ class TRTCAudioEffectManager {
361
356
  */
362
357
  getMusicTrackCount(id) {
363
358
  logger.debug(`${this.logPrefix}getMusicTrackCount: ${id}`);
364
- if (TRTCAudioEffectManager.isIPCMode) {
359
+ if (this.isIPCMode) {
365
360
  return new Promise((resolve, reject) => {
366
361
  const key = `onGetMusicTrackCount-${id}`;
367
362
  this.addPromise(key, resolve, reject);
@@ -5,8 +5,7 @@ import { TRTCCameraCaptureParams, TRTCDeviceInfo, TRTCDeviceType, Rect } from '.
5
5
  */
6
6
  export declare class TRTCDeviceManager {
7
7
  private logPrefix;
8
- private static deviceNanager;
9
- private static isIPCMode;
8
+ private isIPCMode;
10
9
  private nodeDeviceManager;
11
10
  private promiseStore;
12
11
  private eventEmitter;
@@ -14,14 +13,7 @@ export declare class TRTCDeviceManager {
14
13
  isIPCMode: boolean;
15
14
  nodeTRTCCloud: typeof NodeTRTCEngine.TRTCCloud | typeof NodeTRTCEngine.RemoteTRTCCloud;
16
15
  });
17
- /**
18
- * 获取设备管理器
19
- * @returns {TRTCDeviceManager}
20
- */
21
- static getInstance(options: {
22
- isIPCMode: boolean;
23
- nodeTRTCCloud: typeof NodeTRTCEngine.TRTCCloud | typeof NodeTRTCEngine.RemoteTRTCCloud;
24
- }): TRTCDeviceManager;
16
+ destroy(): void;
25
17
  /**
26
18
  * 获取设备列表
27
19
  *
@@ -11,33 +11,29 @@ const logger = console;
11
11
  class TRTCDeviceManager {
12
12
  constructor(options) {
13
13
  this.logPrefix = '[TRTCDeviceManager]';
14
- if (!TRTCDeviceManager.deviceNanager) {
15
- this.promiseStore = new Map();
16
- this.eventEmitter = new events_1.EventEmitter();
17
- this.eventHandler = this.eventHandler.bind(this);
18
- TRTCDeviceManager.isIPCMode = options.isIPCMode;
19
- if (TRTCDeviceManager.isIPCMode) {
20
- this.nodeDeviceManager = new NodeTRTCEngine.NodeRemoteDeviceManager();
21
- this.nodeDeviceManager.setRemoteDeviceManagerCallback(this.eventHandler);
22
- }
23
- else {
24
- this.nodeDeviceManager = options.nodeTRTCCloud;
25
- }
26
- TRTCDeviceManager.deviceNanager = this;
14
+ this.promiseStore = new Map();
15
+ this.eventEmitter = new events_1.EventEmitter();
16
+ this.eventHandler = this.eventHandler.bind(this);
17
+ this.isIPCMode = options.isIPCMode;
18
+ if (this.isIPCMode) {
19
+ this.nodeDeviceManager = new NodeTRTCEngine.NodeRemoteDeviceManager();
20
+ this.nodeDeviceManager.setRemoteDeviceManagerCallback(this.eventHandler);
27
21
  }
28
22
  else {
29
- return TRTCDeviceManager.deviceNanager;
23
+ this.nodeDeviceManager = options.nodeTRTCCloud;
30
24
  }
31
25
  }
32
- /**
33
- * 获取设备管理器
34
- * @returns {TRTCDeviceManager}
35
- */
36
- static getInstance(options) {
37
- if (!TRTCDeviceManager.deviceNanager) {
38
- TRTCDeviceManager.deviceNanager = new TRTCDeviceManager(options);
39
- }
40
- return TRTCDeviceManager.deviceNanager;
26
+ destroy() {
27
+ var _a, _b;
28
+ this.nodeDeviceManager = null;
29
+ (_a = this.promiseStore) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
30
+ value.forEach(({ reject }) => {
31
+ reject();
32
+ });
33
+ });
34
+ (_b = this.promiseStore) === null || _b === void 0 ? void 0 : _b.clear();
35
+ this.promiseStore = undefined;
36
+ this.eventEmitter = undefined;
41
37
  }
42
38
  /**
43
39
  * 获取设备列表
@@ -70,7 +66,7 @@ class TRTCDeviceManager {
70
66
  }
71
67
  setCurrentDevice(type, deviceId) {
72
68
  logger.debug(`${this.logPrefix}setCurrentDevice`, type, deviceId);
73
- if (TRTCDeviceManager.isIPCMode) {
69
+ if (this.isIPCMode) {
74
70
  return new Promise((resolve, reject) => {
75
71
  const key = `setCurrentDevice-${type}`;
76
72
  this.addPromise(key, resolve, reject);
@@ -83,7 +79,7 @@ class TRTCDeviceManager {
83
79
  }
84
80
  getCurrentDevice(type) {
85
81
  logger.debug(`${this.logPrefix}getCurrentDevice`, type);
86
- if (TRTCDeviceManager.isIPCMode) {
82
+ if (this.isIPCMode) {
87
83
  return new Promise((resolve, reject) => {
88
84
  const key = `getCurrentDevice-${type}`;
89
85
  this.addPromise(key, resolve, reject);
@@ -96,7 +92,7 @@ class TRTCDeviceManager {
96
92
  }
97
93
  setCurrentDeviceVolume(type, volume) {
98
94
  logger.debug(`${this.logPrefix}setCurrentDeviceVolume`, type, volume);
99
- if (TRTCDeviceManager.isIPCMode) {
95
+ if (this.isIPCMode) {
100
96
  return new Promise((resolve, reject) => {
101
97
  const key = `setCurrentDeviceVolume-${type}`;
102
98
  this.addPromise(key, resolve, reject);
@@ -109,7 +105,7 @@ class TRTCDeviceManager {
109
105
  }
110
106
  getCurrentDeviceVolume(type) {
111
107
  logger.debug(`${this.logPrefix}getCurrentDeviceVolume`, type);
112
- if (TRTCDeviceManager.isIPCMode) {
108
+ if (this.isIPCMode) {
113
109
  return new Promise((resolve, reject) => {
114
110
  const key = `getCurrentDeviceVolume-${type}`;
115
111
  this.addPromise(key, resolve, reject);
@@ -122,7 +118,7 @@ class TRTCDeviceManager {
122
118
  }
123
119
  setCurrentDeviceMute(type, mute) {
124
120
  logger.debug(`${this.logPrefix}setCurrentDeviceMute`, type, mute);
125
- if (TRTCDeviceManager.isIPCMode) {
121
+ if (this.isIPCMode) {
126
122
  return new Promise((resolve, reject) => {
127
123
  const key = `setCurrentDeviceMute-${type}`;
128
124
  this.addPromise(key, resolve, reject);
@@ -135,7 +131,7 @@ class TRTCDeviceManager {
135
131
  }
136
132
  getCurrentDeviceMute(type) {
137
133
  logger.debug(`${this.logPrefix}getCurrentDeviceMute`);
138
- if (TRTCDeviceManager.isIPCMode) {
134
+ if (this.isIPCMode) {
139
135
  return new Promise((resolve, reject) => {
140
136
  const key = `getCurrentDeviceMute-${type}`;
141
137
  this.addPromise(key, resolve, reject);
@@ -148,7 +144,7 @@ class TRTCDeviceManager {
148
144
  }
149
145
  enableFollowingDefaultAudioDevice(type, enable) {
150
146
  logger.debug(`${this.logPrefix}enableFollowingDefaultAudioDevice`, type, enable);
151
- if (TRTCDeviceManager.isIPCMode) {
147
+ if (this.isIPCMode) {
152
148
  return new Promise((resolve, reject) => {
153
149
  const key = `enableFollowingDefaultAudioDevice-${type}`;
154
150
  this.addPromise(key, resolve, reject);
@@ -161,7 +157,7 @@ class TRTCDeviceManager {
161
157
  }
162
158
  startMicDeviceTest(interval, playback = false) {
163
159
  logger.debug(`${this.logPrefix}startMicDeviceTest`, interval, playback);
164
- if (TRTCDeviceManager.isIPCMode) {
160
+ if (this.isIPCMode) {
165
161
  return new Promise((resolve, reject) => {
166
162
  const key = `startMicDeviceTest`;
167
163
  this.addPromise(key, resolve, reject);
@@ -174,7 +170,7 @@ class TRTCDeviceManager {
174
170
  }
175
171
  stopMicDeviceTest() {
176
172
  logger.debug(`${this.logPrefix}stopMicDeviceTest`);
177
- if (TRTCDeviceManager.isIPCMode) {
173
+ if (this.isIPCMode) {
178
174
  return new Promise((resolve, reject) => {
179
175
  const key = `stopMicDeviceTest`;
180
176
  this.addPromise(key, resolve, reject);
@@ -187,7 +183,7 @@ class TRTCDeviceManager {
187
183
  }
188
184
  startSpeakerDeviceTest(filePath) {
189
185
  logger.debug(`${this.logPrefix}startSpeakerDeviceTest`, filePath);
190
- if (TRTCDeviceManager.isIPCMode) {
186
+ if (this.isIPCMode) {
191
187
  return new Promise((resolve, reject) => {
192
188
  const key = `startSpeakerDeviceTest`;
193
189
  this.addPromise(key, resolve, reject);
@@ -200,7 +196,7 @@ class TRTCDeviceManager {
200
196
  }
201
197
  stopSpeakerDeviceTest() {
202
198
  logger.debug(`${this.logPrefix}stopSpeakerDeviceTest`);
203
- if (TRTCDeviceManager.isIPCMode) {
199
+ if (this.isIPCMode) {
204
200
  return new Promise((resolve, reject) => {
205
201
  const key = `stopSpeakerDeviceTest`;
206
202
  this.addPromise(key, resolve, reject);
@@ -213,7 +209,7 @@ class TRTCDeviceManager {
213
209
  }
214
210
  setApplicationPlayVolume(volume) {
215
211
  logger.debug(`${this.logPrefix}setApplicationPlayVolume`, volume);
216
- if (TRTCDeviceManager.isIPCMode) {
212
+ if (this.isIPCMode) {
217
213
  return new Promise((resolve, reject) => {
218
214
  const key = `setApplicationPlayVolume`;
219
215
  this.addPromise(key, resolve, reject);
@@ -226,7 +222,7 @@ class TRTCDeviceManager {
226
222
  }
227
223
  getApplicationPlayVolume() {
228
224
  logger.debug(`${this.logPrefix}getApplicationPlayVolume`);
229
- if (TRTCDeviceManager.isIPCMode) {
225
+ if (this.isIPCMode) {
230
226
  return new Promise((resolve, reject) => {
231
227
  const key = `getApplicationPlayVolume`;
232
228
  this.addPromise(key, resolve, reject);
@@ -239,7 +235,7 @@ class TRTCDeviceManager {
239
235
  }
240
236
  setApplicationMuteState(mute) {
241
237
  logger.debug(`${this.logPrefix}setApplicationMuteState`, mute);
242
- if (TRTCDeviceManager.isIPCMode) {
238
+ if (this.isIPCMode) {
243
239
  return new Promise((resolve, reject) => {
244
240
  const key = `setApplicationMuteState`;
245
241
  this.addPromise(key, resolve, reject);
@@ -252,7 +248,7 @@ class TRTCDeviceManager {
252
248
  }
253
249
  getApplicationMuteState() {
254
250
  logger.debug(`${this.logPrefix}getApplicationMuteState`);
255
- if (TRTCDeviceManager.isIPCMode) {
251
+ if (this.isIPCMode) {
256
252
  return new Promise((resolve, reject) => {
257
253
  const key = `setApplicationMuteState`;
258
254
  this.addPromise(key, resolve, reject);
@@ -265,7 +261,7 @@ class TRTCDeviceManager {
265
261
  }
266
262
  setCameraCaptureParam(params) {
267
263
  logger.debug(`${this.logPrefix}setCameraCaptureParam:`, params);
268
- if (TRTCDeviceManager.isIPCMode) {
264
+ if (this.isIPCMode) {
269
265
  return this.nodeDeviceManager.setCameraCapturerParam(params);
270
266
  }
271
267
  else {
@@ -30,21 +30,13 @@ export declare type TRTCMediaMixingEncParam = {
30
30
  */
31
31
  export declare class TRTCMediaMixingManager {
32
32
  private logPrefix;
33
- private static mediaMixingManager;
34
33
  private nodeMediaMixingPlugin;
35
34
  private deviceManager;
36
35
  private eventEmitter;
37
36
  constructor(options: {
38
37
  deviceManager: TRTCDeviceManager;
39
38
  });
40
- /**
41
- * 获取混流管理器
42
- *
43
- * @returns {TRTCMediaMixingManager}
44
- */
45
- static getInstance(options: {
46
- deviceManager: TRTCDeviceManager;
47
- }): TRTCMediaMixingManager;
39
+ destroy(): void;
48
40
  private eventHandler;
49
41
  /**
50
42
  * 设置混流视频预览参数
@@ -31,29 +31,17 @@ const logger = console;
31
31
  class TRTCMediaMixingManager {
32
32
  constructor(options) {
33
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;
34
+ this.eventEmitter = new events_1.EventEmitter();
35
+ this.eventHandler = this.eventHandler.bind(this);
36
+ this.nodeMediaMixingPlugin = new NodeTRTCEngine.NodeRemoteMultiSourcePlugin();
37
+ this.nodeMediaMixingPlugin.setRemoteMultiSourcePluginCallback(this.eventHandler);
38
+ this.deviceManager = options.deviceManager;
39
+ this.setMediaServerPath('');
40
+ }
41
+ destroy() {
42
+ this.deviceManager = null;
43
+ this.nodeMediaMixingPlugin = null;
44
+ this.eventEmitter = null;
57
45
  }
58
46
  eventHandler(args) {
59
47
  logger.log(`${this.logPrefix} event:`, args);
@@ -199,25 +187,32 @@ class TRTCMediaMixingManager {
199
187
  }
200
188
  // ****** 这一部分接口暴露不合理,暂时不对暴露在 API 文档上 **************/
201
189
  startCameraDeviceTest(windowID, rect) {
202
- return this.deviceManager.startCameraDeviceTest(windowID, rect);
190
+ var _a;
191
+ return ((_a = this.deviceManager) === null || _a === void 0 ? void 0 : _a.startCameraDeviceTest(windowID, rect)) || Promise.reject();
203
192
  }
204
193
  stopCameraDeviceTest() {
205
- return this.deviceManager.stopCameraDeviceTest();
194
+ var _a;
195
+ return ((_a = this.deviceManager) === null || _a === void 0 ? void 0 : _a.stopCameraDeviceTest()) || Promise.reject();
206
196
  }
207
197
  setCameraTestRenderMirror(mirror) {
208
- this.deviceManager.setCameraTestRenderMirror(mirror);
198
+ var _a;
199
+ (_a = this.deviceManager) === null || _a === void 0 ? void 0 : _a.setCameraTestRenderMirror(mirror);
209
200
  }
210
201
  setCameraTestDeviceId(cameraId) {
211
- this.deviceManager.setCameraTestDeviceId(cameraId);
202
+ var _a;
203
+ (_a = this.deviceManager) === null || _a === void 0 ? void 0 : _a.setCameraTestDeviceId(cameraId);
212
204
  }
213
205
  setCameraTestResolution(width, height) {
214
- this.deviceManager.setCameraTestResolution(width, height);
206
+ var _a;
207
+ (_a = this.deviceManager) === null || _a === void 0 ? void 0 : _a.setCameraTestResolution(width, height);
215
208
  }
216
209
  setCameraTestVideoPluginPath(path) {
217
- this.deviceManager.setCameraTestVideoPluginPath(path);
210
+ var _a;
211
+ (_a = this.deviceManager) === null || _a === void 0 ? void 0 : _a.setCameraTestVideoPluginPath(path);
218
212
  }
219
213
  setCameraTestVideoPluginParameter(params) {
220
- this.deviceManager.setCameraTestVideoPluginParameter(params);
214
+ var _a;
215
+ (_a = this.deviceManager) === null || _a === void 0 ? void 0 : _a.setCameraTestVideoPluginParameter(params);
221
216
  }
222
217
  }
223
218
  exports.TRTCMediaMixingManager = TRTCMediaMixingManager;
@@ -23,8 +23,7 @@ export declare class TRTCPlugin {
23
23
  */
24
24
  export declare class TRTCPluginManager {
25
25
  private logPrefix;
26
- private static pluginManager;
27
- private static isIPCMode;
26
+ private isIPCMode;
28
27
  private nodePluginManager;
29
28
  private videoProcessBufferType;
30
29
  private videoProcessPixelFormat;
@@ -32,15 +31,7 @@ export declare class TRTCPluginManager {
32
31
  isIPCMode: boolean;
33
32
  nodeTRTCCloud: typeof NodeTRTCEngine.TRTCCloud | typeof NodeTRTCEngine.RemoteTRTCCloud;
34
33
  });
35
- /**
36
- * 获取插件管理器
37
- *
38
- * @returns {TRTCPluginManager}
39
- */
40
- static getInstance(options: {
41
- isIPCMode: boolean;
42
- nodeTRTCCloud: typeof NodeTRTCEngine.TRTCCloud | typeof NodeTRTCEngine.RemoteTRTCCloud;
43
- }): TRTCPluginManager;
34
+ destroy(): void;
44
35
  setPluginParams(type: TRTCPluginType, options: TRTCVideoProcessPluginOptions | TRTCMediaEncryptDecryptPluginOptions | TRTCAudioProcessPluginOptions): void;
45
36
  private _setVideoProcessPluginParams;
46
37
  private _setMediaEncryptDecryptPluginParams;
@@ -44,37 +44,23 @@ class TRTCPluginManager {
44
44
  this.logPrefix = '[TRTCPluginManager]';
45
45
  this.videoProcessBufferType = trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer;
46
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;
47
+ this.isIPCMode = options.isIPCMode;
48
+ if (this.isIPCMode) {
49
+ this.nodePluginManager = new NodeTRTCEngine.NodeRemoteVideoPluginManager();
58
50
  }
59
51
  else {
60
- return TRTCPluginManager.pluginManager;
52
+ this.videoProcessBufferType = trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer;
53
+ this.videoProcessPixelFormat = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
54
+ this.nodePluginManager = options.nodeTRTCCloud;
61
55
  }
62
56
  }
63
57
  ;
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;
58
+ destroy() {
59
+ this.nodePluginManager = null;
74
60
  }
75
61
  setPluginParams(type, options) {
76
62
  logger.log(`${this.logPrefix}setPluginParams params:`, type, options);
77
- if (TRTCPluginManager.isIPCMode) {
63
+ if (this.isIPCMode) {
78
64
  if (type === trtc_define_1.TRTCPluginType.TRTCPluginTypeVideoProcess) {
79
65
  this.nodePluginManager.setVideoPluginFormat(trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer, options.pixelFormat);
80
66
  }
@@ -132,7 +118,7 @@ class TRTCPluginManager {
132
118
  }
133
119
  addPlugin(options) {
134
120
  logger.log(`${this.logPrefix}addPlugin options:`, options);
135
- if (TRTCPluginManager.isIPCMode) {
121
+ if (this.isIPCMode) {
136
122
  const nativeVideoEffectPlugin = this.nodePluginManager.addVideoPlugin(options.deviceId, options.id, options.path);
137
123
  return new TRTCPlugin(options.id, options.deviceId || '', nativeVideoEffectPlugin);
138
124
  }
@@ -160,7 +146,7 @@ class TRTCPluginManager {
160
146
  }
161
147
  removePlugin(pluginId, deviceId) {
162
148
  logger.log(`${this.logPrefix}removePlugin pluginId:${pluginId} deviceId:${deviceId}`);
163
- if (TRTCPluginManager.isIPCMode) {
149
+ if (this.isIPCMode) {
164
150
  this.nodePluginManager.removeVideoPlugin(deviceId, pluginId);
165
151
  }
166
152
  else {
@@ -168,7 +154,7 @@ class TRTCPluginManager {
168
154
  }
169
155
  }
170
156
  setCallback(callback) {
171
- if (TRTCPluginManager.isIPCMode) {
157
+ if (this.isIPCMode) {
172
158
  this.nodePluginManager.setCallback(callback);
173
159
  }
174
160
  else {
@@ -180,7 +166,7 @@ class TRTCPluginManager {
180
166
  */
181
167
  getPluginList() {
182
168
  logger.log(`${this.logPrefix}getPluginList`);
183
- if (TRTCPluginManager.isIPCMode) {
169
+ if (this.isIPCMode) {
184
170
  logger.warn(`${this.logPrefix}getPluginList not supported`);
185
171
  return null;
186
172
  }