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

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.
@@ -149,7 +149,7 @@ export declare type TRTCLocalMediaTranscodingParams = {
149
149
  * TRTCVideoPixelFormat
150
150
  * } from 'trtc-electron-sdk';
151
151
  *
152
- * const trtcCloud = new TRTCCloud();
152
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
153
153
  * const cameraList =trtcCloud.getCameraDevicesList();
154
154
  *
155
155
  * // 获取本地合图转码推流对象
@@ -214,7 +214,7 @@ const TRTCLocalMediaTranscodingParams_HACK_JSDOC = null;
214
214
  * TRTCVideoPixelFormat
215
215
  * } from 'trtc-electron-sdk';
216
216
  *
217
- * const trtcCloud = new TRTCCloud();
217
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
218
218
  * const cameraList =trtcCloud.getCameraDevicesList();
219
219
  *
220
220
  * // 获取本地合图转码推流对象
@@ -5,7 +5,7 @@
5
5
  * @example
6
6
  * // 使用示例代码:
7
7
  * const TRTCCloud = require('trtc-electron-sdk');
8
- * this.rtcCloud = new TRTCCloud();
8
+ * this.rtcCloud = TRTCCloud.getTRTCShareInstance();
9
9
  * this.rtcCloud.getConfigObject().setDebugMode(true);
10
10
  *
11
11
  */
@@ -7,7 +7,7 @@ exports.generateUniqueId = exports.allocBuffer = exports.config = exports.calcVi
7
7
  * @example
8
8
  * // 使用示例代码:
9
9
  * const TRTCCloud = require('trtc-electron-sdk');
10
- * this.rtcCloud = new TRTCCloud();
10
+ * this.rtcCloud = TRTCCloud.getTRTCShareInstance();
11
11
  * this.rtcCloud.getConfigObject().setDebugMode(true);
12
12
  *
13
13
  */
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @example
6
6
  * import TRTCCloud from trtc-electron-sdk';
7
- * const rtcCloud = new TRTCCloud();
7
+ * const rtcCloud = TRTCCloud.getTRTCShareInstance();
8
8
  * rtcCloud.getConfigObject().setDebugMode(true);
9
9
  */
10
10
  export declare class TRTCConfig {
@@ -6,7 +6,7 @@ exports.isSupportWebGL = exports.transferBGRA2RGBA = exports.generateUniqueId =
6
6
  *
7
7
  * @example
8
8
  * import TRTCCloud from trtc-electron-sdk';
9
- * const rtcCloud = new TRTCCloud();
9
+ * const rtcCloud = TRTCCloud.getTRTCShareInstance();
10
10
  * rtcCloud.getConfigObject().setDebugMode(true);
11
11
  */
12
12
  class TRTCConfig {
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.TRTCAudioEffectManager = void 0;
7
+ const logger_1 = __importDefault(require("../../logger"));
4
8
  const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
5
- // To do: 待替换为 SDK JS 层 Logger
6
- const logger = console;
7
9
  /**
8
10
  * 音效管理器
9
11
  */
@@ -50,7 +52,7 @@ class TRTCAudioEffectManager {
50
52
  * @returns {Promise<void>}
51
53
  */
52
54
  enableVoiceEarMonitor(enable) {
53
- logger.debug(`${this.logPrefix}enableVoiceEarMonitor:${enable}`);
55
+ logger_1.default.debug(`${this.logPrefix}enableVoiceEarMonitor:${enable}`);
54
56
  this.nodeAudioEffectManager.enableVoiceEarMonitor(enable);
55
57
  return Promise.resolve();
56
58
  }
@@ -64,7 +66,7 @@ class TRTCAudioEffectManager {
64
66
  * @returns {Promise<void>}
65
67
  */
66
68
  setVoiceEarMonitorVolume(volume) {
67
- logger.debug(`${this.logPrefix}setVoiceEarMonitorVolume:${volume}`);
69
+ logger_1.default.debug(`${this.logPrefix}setVoiceEarMonitorVolume:${volume}`);
68
70
  this.nodeAudioEffectManager.setVoiceEarMonitorVolume(volume);
69
71
  return Promise.resolve();
70
72
  }
@@ -78,7 +80,7 @@ class TRTCAudioEffectManager {
78
80
  * @returns {Promise<void>}
79
81
  */
80
82
  setVoiceReverbType(type) {
81
- logger.debug(`${this.logPrefix}setVoiceReverbType: ${type}`);
83
+ logger_1.default.debug(`${this.logPrefix}setVoiceReverbType: ${type}`);
82
84
  this.nodeAudioEffectManager.setVoiceReverbType(type);
83
85
  return Promise.resolve();
84
86
  }
@@ -92,7 +94,7 @@ class TRTCAudioEffectManager {
92
94
  * @returns {Promise<void>}
93
95
  */
94
96
  setVoiceChangerType(type) {
95
- logger.debug(`${this.logPrefix}setVoiceChangerType: ${type}`);
97
+ logger_1.default.debug(`${this.logPrefix}setVoiceChangerType: ${type}`);
96
98
  this.nodeAudioEffectManager.setVoiceChangerType(type);
97
99
  return Promise.resolve();
98
100
  }
@@ -106,7 +108,7 @@ class TRTCAudioEffectManager {
106
108
  * @returns {Promise<void>}
107
109
  */
108
110
  setVoiceCaptureVolume(volume) {
109
- logger.debug(`${this.logPrefix}setVoiceCaptureVolume: ${volume}`);
111
+ logger_1.default.debug(`${this.logPrefix}setVoiceCaptureVolume: ${volume}`);
110
112
  this.nodeAudioEffectManager.setVoiceCaptureVolume(volume);
111
113
  return Promise.resolve();
112
114
  }
@@ -118,7 +120,7 @@ class TRTCAudioEffectManager {
118
120
  * @returns {Promise<void>}
119
121
  */
120
122
  setVoicePitch(pitch) {
121
- logger.debug(`${this.logPrefix}setVoicePitch: ${pitch}`);
123
+ logger_1.default.debug(`${this.logPrefix}setVoicePitch: ${pitch}`);
122
124
  this.nodeAudioEffectManager.setVoicePitch(pitch);
123
125
  return Promise.resolve();
124
126
  }
@@ -136,7 +138,7 @@ class TRTCAudioEffectManager {
136
138
  * @returns {Promise<void>}
137
139
  */
138
140
  setMusicObserver(observer) {
139
- logger.debug(`${this.logPrefix}setMusicObserver:`, observer);
141
+ logger_1.default.debug(`${this.logPrefix}setMusicObserver:`, observer);
140
142
  this.nodeAudioEffectManager.setMusicObserver(observer.onStart, observer.onPlayProgress, observer.onComplete);
141
143
  return Promise.resolve();
142
144
  }
@@ -147,7 +149,7 @@ class TRTCAudioEffectManager {
147
149
  * @returns {Promise<void>}
148
150
  */
149
151
  startPlayMusic(param) {
150
- logger.debug(`${this.logPrefix}startPlayMusic:`, param);
152
+ logger_1.default.debug(`${this.logPrefix}startPlayMusic:`, param);
151
153
  this.nodeAudioEffectManager.startPlayMusic(param);
152
154
  return Promise.resolve();
153
155
  }
@@ -158,7 +160,7 @@ class TRTCAudioEffectManager {
158
160
  * @returns {Promise<void>}
159
161
  */
160
162
  stopPlayMusic(id) {
161
- logger.debug(`${this.logPrefix}stopPlayMusic:${id}`);
163
+ logger_1.default.debug(`${this.logPrefix}stopPlayMusic:${id}`);
162
164
  this.nodeAudioEffectManager.stopPlayMusic(id);
163
165
  return Promise.resolve();
164
166
  }
@@ -169,7 +171,7 @@ class TRTCAudioEffectManager {
169
171
  * @returns {Promise<void>}
170
172
  */
171
173
  pausePlayMusic(id) {
172
- logger.debug(`${this.logPrefix}pausePlayMusic:${id}`);
174
+ logger_1.default.debug(`${this.logPrefix}pausePlayMusic:${id}`);
173
175
  this.nodeAudioEffectManager.pausePlayMusic(id);
174
176
  return Promise.resolve();
175
177
  }
@@ -180,7 +182,7 @@ class TRTCAudioEffectManager {
180
182
  * @returns {Promise<void>}
181
183
  */
182
184
  resumePlayMusic(id) {
183
- logger.debug(`${this.logPrefix}resumePlayMusic:${id}`);
185
+ logger_1.default.debug(`${this.logPrefix}resumePlayMusic:${id}`);
184
186
  this.nodeAudioEffectManager.resumePlayMusic(id);
185
187
  return Promise.resolve();
186
188
  }
@@ -197,7 +199,7 @@ class TRTCAudioEffectManager {
197
199
  * @returns {Promise<void>}
198
200
  */
199
201
  setAllMusicVolume(volume) {
200
- logger.debug(`${this.logPrefix}setAllMusicVolume:${volume}`);
202
+ logger_1.default.debug(`${this.logPrefix}setAllMusicVolume:${volume}`);
201
203
  this.nodeAudioEffectManager.setAllMusicVolume(volume);
202
204
  return Promise.resolve();
203
205
  }
@@ -211,7 +213,7 @@ class TRTCAudioEffectManager {
211
213
  * @returns {Promise<void>}
212
214
  */
213
215
  setMusicPublishVolume(id, volume) {
214
- logger.debug(`${this.logPrefix}setMusicPublishVolume:${id} ${volume}`);
216
+ logger_1.default.debug(`${this.logPrefix}setMusicPublishVolume:${id} ${volume}`);
215
217
  this.nodeAudioEffectManager.setMusicPublishVolume(id, volume);
216
218
  return Promise.resolve();
217
219
  }
@@ -225,7 +227,7 @@ class TRTCAudioEffectManager {
225
227
  * @returns {Promise<void>}
226
228
  */
227
229
  setMusicPlayoutVolume(id, volume) {
228
- logger.debug(`${this.logPrefix}setMusicPlayoutVolume:${id} ${volume}`);
230
+ logger_1.default.debug(`${this.logPrefix}setMusicPlayoutVolume:${id} ${volume}`);
229
231
  this.nodeAudioEffectManager.setMusicPlayoutVolume(id, volume);
230
232
  return Promise.resolve();
231
233
  }
@@ -237,7 +239,7 @@ class TRTCAudioEffectManager {
237
239
  * @returns {Promise<void>}
238
240
  */
239
241
  setMusicPitch(id, pitch) {
240
- logger.debug(`${this.logPrefix}setMusicPitch:${id} ${pitch}`);
242
+ logger_1.default.debug(`${this.logPrefix}setMusicPitch:${id} ${pitch}`);
241
243
  this.nodeAudioEffectManager.setMusicPitch(id, pitch);
242
244
  return Promise.resolve();
243
245
  }
@@ -249,7 +251,7 @@ class TRTCAudioEffectManager {
249
251
  * @returns {Promise<void>}
250
252
  */
251
253
  setMusicSpeedRate(id, speedRate) {
252
- logger.debug(`${this.logPrefix}setMusicSpeedRate:${id} ${speedRate}`);
254
+ logger_1.default.debug(`${this.logPrefix}setMusicSpeedRate:${id} ${speedRate}`);
253
255
  this.nodeAudioEffectManager.setMusicSpeedRate(id, speedRate);
254
256
  return Promise.resolve();
255
257
  }
@@ -260,7 +262,7 @@ class TRTCAudioEffectManager {
260
262
  * @return {Promise<Number>|Number} 成功返回当前播放时间,单位:毫秒,失败返回 -1。
261
263
  */
262
264
  getMusicCurrentPosInMS(id) {
263
- logger.debug(`${this.logPrefix}getMusicCurrentPosInMS: ${id}`);
265
+ logger_1.default.debug(`${this.logPrefix}getMusicCurrentPosInMS: ${id}`);
264
266
  if (this.isIPCMode) {
265
267
  return new Promise((resolve, reject) => {
266
268
  const key = `onGetMusicCurrentPosInMS-${id}`;
@@ -279,7 +281,7 @@ class TRTCAudioEffectManager {
279
281
  * @return {Promise<number>|Number} 成功返回时长,失败返回 -1。
280
282
  */
281
283
  getMusicDurationInMS(path) {
282
- logger.debug(`${this.logPrefix}getMusicDurationInMS: ${path}`);
284
+ logger_1.default.debug(`${this.logPrefix}getMusicDurationInMS: ${path}`);
283
285
  if (this.isIPCMode) {
284
286
  return new Promise((resolve, reject) => {
285
287
  const key = `onGetMusicDurationInMS-${path}`;
@@ -302,7 +304,7 @@ class TRTCAudioEffectManager {
302
304
  * @returns {Promise<void>}
303
305
  */
304
306
  seekMusicToPosInTime(id, pts) {
305
- logger.debug(`${this.logPrefix}seekMusicToPosInTime:${id} ${pts}`);
307
+ logger_1.default.debug(`${this.logPrefix}seekMusicToPosInTime:${id} ${pts}`);
306
308
  this.nodeAudioEffectManager.seekMusicToPosInTime(id, pts);
307
309
  return Promise.resolve();
308
310
  }
@@ -315,7 +317,7 @@ class TRTCAudioEffectManager {
315
317
  * @returns {Promise<void>}
316
318
  */
317
319
  setMusicScratchSpeedRate(id, speedRate) {
318
- logger.debug(`${this.logPrefix}seekMusicToPosInTime:${id} ${speedRate}`);
320
+ logger_1.default.debug(`${this.logPrefix}seekMusicToPosInTime:${id} ${speedRate}`);
319
321
  this.nodeAudioEffectManager.setMusicScratchSpeedRate(id, speedRate);
320
322
  return Promise.resolve();
321
323
  }
@@ -327,7 +329,7 @@ class TRTCAudioEffectManager {
327
329
  * @returns {Promise<void>}
328
330
  */
329
331
  setPreloadObserver(observer) {
330
- logger.debug(`${this.logPrefix}setPreloadObserver:`, observer);
332
+ logger_1.default.debug(`${this.logPrefix}setPreloadObserver:`, observer);
331
333
  this.nodeAudioEffectManager.setPreloadObserver(observer.onLoadProgress, observer.onLoadError);
332
334
  return Promise.resolve();
333
335
  }
@@ -344,7 +346,7 @@ class TRTCAudioEffectManager {
344
346
  * @returns {Promise<void>}
345
347
  */
346
348
  preloadMusic(param) {
347
- logger.debug(`${this.logPrefix}preloadMusic:`, param);
349
+ logger_1.default.debug(`${this.logPrefix}preloadMusic:`, param);
348
350
  this.nodeAudioEffectManager.preloadMusic(param);
349
351
  return Promise.resolve();
350
352
  }
@@ -355,7 +357,7 @@ class TRTCAudioEffectManager {
355
357
  * @returns {Promise<Number>|Number}
356
358
  */
357
359
  getMusicTrackCount(id) {
358
- logger.debug(`${this.logPrefix}getMusicTrackCount: ${id}`);
360
+ logger_1.default.debug(`${this.logPrefix}getMusicTrackCount: ${id}`);
359
361
  if (this.isIPCMode) {
360
362
  return new Promise((resolve, reject) => {
361
363
  const key = `onGetMusicTrackCount-${id}`;
@@ -377,15 +379,15 @@ class TRTCAudioEffectManager {
377
379
  * @returns {Promise<void>}
378
380
  */
379
381
  setMusicTrack(id, trackIndex) {
380
- logger.debug(`${this.logPrefix}getMusicTrackCount:${id} ${trackIndex}`);
382
+ logger_1.default.debug(`${this.logPrefix}getMusicTrackCount:${id} ${trackIndex}`);
381
383
  this.nodeAudioEffectManager.setMusicTrack(id, trackIndex);
382
384
  return Promise.resolve();
383
385
  }
384
386
  eventHandler(args) {
385
- logger.debug(`${this.logPrefix} event:`, args);
387
+ logger_1.default.debug(`${this.logPrefix} event:`, args);
386
388
  const key = args[0];
387
389
  const data = args[1];
388
- logger.debug(`${this.logPrefix} event key: ${key} data:`, data);
390
+ logger_1.default.debug(`${this.logPrefix} event key: ${key} data:`, data);
389
391
  switch (key) {
390
392
  case "onGetMusicCurrentPosInMS":
391
393
  this.removePromise(`${key}-${data.id}`, data.currentPos);
@@ -397,7 +399,7 @@ class TRTCAudioEffectManager {
397
399
  this.removePromise(`${key}-${data.id}`, data.trackCount);
398
400
  break;
399
401
  default:
400
- logger.warn(`${this.logPrefix}eventHandler un-supported event:`, key);
402
+ logger_1.default.warn(`${this.logPrefix}eventHandler un-supported event:`, key);
401
403
  }
402
404
  }
403
405
  addPromise(key, resolve, reject) {
@@ -1,5 +1,5 @@
1
- declare const NodeTRTCEngine: any;
2
1
  import { TRTCCameraCaptureParams, TRTCDeviceInfo, TRTCDeviceType, Rect } from '../../trtc_define';
2
+ declare const NodeTRTCEngine: any;
3
3
  /**
4
4
  * 设备管理器
5
5
  */
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.TRTCDeviceManager = void 0;
4
7
  const events_1 = require("events");
5
- const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
6
8
  const trtc_define_1 = require("../../trtc_define");
7
- const logger = console;
9
+ const logger_1 = __importDefault(require("../../logger"));
10
+ const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
8
11
  /**
9
12
  * 设备管理器
10
13
  */
@@ -42,7 +45,7 @@ class TRTCDeviceManager {
42
45
  * @returns {Array<TRTCDeviceInfo>}
43
46
  */
44
47
  getDevicesList(type) {
45
- logger.debug(`${this.logPrefix}getDevicesList`, type);
48
+ logger_1.default.debug(`${this.logPrefix}getDevicesList`, type);
46
49
  const deviceInfos = this.nodeDeviceManager.getDevicesList(type);
47
50
  if (type === trtc_define_1.TRTCDeviceType.TRTCDeviceTypeCamera) {
48
51
  deviceInfos === null || deviceInfos === void 0 ? void 0 : deviceInfos.forEach((item) => {
@@ -57,7 +60,7 @@ class TRTCDeviceManager {
57
60
  }
58
61
  }
59
62
  catch (e) {
60
- logger.warn(`${this.logPrefix}camera device properties parse error.`, JSON.stringify(item));
63
+ logger_1.default.warn(`${this.logPrefix}camera device properties parse error.`, JSON.stringify(item));
61
64
  item.deviceProperties = {};
62
65
  }
63
66
  });
@@ -65,7 +68,7 @@ class TRTCDeviceManager {
65
68
  return deviceInfos;
66
69
  }
67
70
  setCurrentDevice(type, deviceId) {
68
- logger.debug(`${this.logPrefix}setCurrentDevice`, type, deviceId);
71
+ logger_1.default.debug(`${this.logPrefix}setCurrentDevice`, type, deviceId);
69
72
  if (this.isIPCMode) {
70
73
  return new Promise((resolve, reject) => {
71
74
  const key = `setCurrentDevice-${type}`;
@@ -78,7 +81,7 @@ class TRTCDeviceManager {
78
81
  }
79
82
  }
80
83
  getCurrentDevice(type) {
81
- logger.debug(`${this.logPrefix}getCurrentDevice`, type);
84
+ logger_1.default.debug(`${this.logPrefix}getCurrentDevice`, type);
82
85
  if (this.isIPCMode) {
83
86
  return new Promise((resolve, reject) => {
84
87
  const key = `getCurrentDevice-${type}`;
@@ -91,7 +94,7 @@ class TRTCDeviceManager {
91
94
  }
92
95
  }
93
96
  setCurrentDeviceVolume(type, volume) {
94
- logger.debug(`${this.logPrefix}setCurrentDeviceVolume`, type, volume);
97
+ logger_1.default.debug(`${this.logPrefix}setCurrentDeviceVolume`, type, volume);
95
98
  if (this.isIPCMode) {
96
99
  return new Promise((resolve, reject) => {
97
100
  const key = `setCurrentDeviceVolume-${type}`;
@@ -104,7 +107,7 @@ class TRTCDeviceManager {
104
107
  }
105
108
  }
106
109
  getCurrentDeviceVolume(type) {
107
- logger.debug(`${this.logPrefix}getCurrentDeviceVolume`, type);
110
+ logger_1.default.debug(`${this.logPrefix}getCurrentDeviceVolume`, type);
108
111
  if (this.isIPCMode) {
109
112
  return new Promise((resolve, reject) => {
110
113
  const key = `getCurrentDeviceVolume-${type}`;
@@ -117,7 +120,7 @@ class TRTCDeviceManager {
117
120
  }
118
121
  }
119
122
  setCurrentDeviceMute(type, mute) {
120
- logger.debug(`${this.logPrefix}setCurrentDeviceMute`, type, mute);
123
+ logger_1.default.debug(`${this.logPrefix}setCurrentDeviceMute`, type, mute);
121
124
  if (this.isIPCMode) {
122
125
  return new Promise((resolve, reject) => {
123
126
  const key = `setCurrentDeviceMute-${type}`;
@@ -130,7 +133,7 @@ class TRTCDeviceManager {
130
133
  }
131
134
  }
132
135
  getCurrentDeviceMute(type) {
133
- logger.debug(`${this.logPrefix}getCurrentDeviceMute`);
136
+ logger_1.default.debug(`${this.logPrefix}getCurrentDeviceMute`);
134
137
  if (this.isIPCMode) {
135
138
  return new Promise((resolve, reject) => {
136
139
  const key = `getCurrentDeviceMute-${type}`;
@@ -143,7 +146,7 @@ class TRTCDeviceManager {
143
146
  }
144
147
  }
145
148
  enableFollowingDefaultAudioDevice(type, enable) {
146
- logger.debug(`${this.logPrefix}enableFollowingDefaultAudioDevice`, type, enable);
149
+ logger_1.default.debug(`${this.logPrefix}enableFollowingDefaultAudioDevice`, type, enable);
147
150
  if (this.isIPCMode) {
148
151
  return new Promise((resolve, reject) => {
149
152
  const key = `enableFollowingDefaultAudioDevice-${type}`;
@@ -156,7 +159,7 @@ class TRTCDeviceManager {
156
159
  }
157
160
  }
158
161
  startMicDeviceTest(interval, playback = false) {
159
- logger.debug(`${this.logPrefix}startMicDeviceTest`, interval, playback);
162
+ logger_1.default.debug(`${this.logPrefix}startMicDeviceTest`, interval, playback);
160
163
  if (this.isIPCMode) {
161
164
  return new Promise((resolve, reject) => {
162
165
  const key = `startMicDeviceTest`;
@@ -169,7 +172,7 @@ class TRTCDeviceManager {
169
172
  }
170
173
  }
171
174
  stopMicDeviceTest() {
172
- logger.debug(`${this.logPrefix}stopMicDeviceTest`);
175
+ logger_1.default.debug(`${this.logPrefix}stopMicDeviceTest`);
173
176
  if (this.isIPCMode) {
174
177
  return new Promise((resolve, reject) => {
175
178
  const key = `stopMicDeviceTest`;
@@ -182,7 +185,7 @@ class TRTCDeviceManager {
182
185
  }
183
186
  }
184
187
  startSpeakerDeviceTest(filePath) {
185
- logger.debug(`${this.logPrefix}startSpeakerDeviceTest`, filePath);
188
+ logger_1.default.debug(`${this.logPrefix}startSpeakerDeviceTest`, filePath);
186
189
  if (this.isIPCMode) {
187
190
  return new Promise((resolve, reject) => {
188
191
  const key = `startSpeakerDeviceTest`;
@@ -195,7 +198,7 @@ class TRTCDeviceManager {
195
198
  }
196
199
  }
197
200
  stopSpeakerDeviceTest() {
198
- logger.debug(`${this.logPrefix}stopSpeakerDeviceTest`);
201
+ logger_1.default.debug(`${this.logPrefix}stopSpeakerDeviceTest`);
199
202
  if (this.isIPCMode) {
200
203
  return new Promise((resolve, reject) => {
201
204
  const key = `stopSpeakerDeviceTest`;
@@ -208,7 +211,7 @@ class TRTCDeviceManager {
208
211
  }
209
212
  }
210
213
  setApplicationPlayVolume(volume) {
211
- logger.debug(`${this.logPrefix}setApplicationPlayVolume`, volume);
214
+ logger_1.default.debug(`${this.logPrefix}setApplicationPlayVolume`, volume);
212
215
  if (this.isIPCMode) {
213
216
  return new Promise((resolve, reject) => {
214
217
  const key = `setApplicationPlayVolume`;
@@ -221,7 +224,7 @@ class TRTCDeviceManager {
221
224
  }
222
225
  }
223
226
  getApplicationPlayVolume() {
224
- logger.debug(`${this.logPrefix}getApplicationPlayVolume`);
227
+ logger_1.default.debug(`${this.logPrefix}getApplicationPlayVolume`);
225
228
  if (this.isIPCMode) {
226
229
  return new Promise((resolve, reject) => {
227
230
  const key = `getApplicationPlayVolume`;
@@ -234,7 +237,7 @@ class TRTCDeviceManager {
234
237
  }
235
238
  }
236
239
  setApplicationMuteState(mute) {
237
- logger.debug(`${this.logPrefix}setApplicationMuteState`, mute);
240
+ logger_1.default.debug(`${this.logPrefix}setApplicationMuteState`, mute);
238
241
  if (this.isIPCMode) {
239
242
  return new Promise((resolve, reject) => {
240
243
  const key = `setApplicationMuteState`;
@@ -247,7 +250,7 @@ class TRTCDeviceManager {
247
250
  }
248
251
  }
249
252
  getApplicationMuteState() {
250
- logger.debug(`${this.logPrefix}getApplicationMuteState`);
253
+ logger_1.default.debug(`${this.logPrefix}getApplicationMuteState`);
251
254
  if (this.isIPCMode) {
252
255
  return new Promise((resolve, reject) => {
253
256
  const key = `setApplicationMuteState`;
@@ -260,7 +263,7 @@ class TRTCDeviceManager {
260
263
  }
261
264
  }
262
265
  setCameraCaptureParam(params) {
263
- logger.debug(`${this.logPrefix}setCameraCaptureParam:`, params);
266
+ logger_1.default.debug(`${this.logPrefix}setCameraCaptureParam:`, params);
264
267
  if (this.isIPCMode) {
265
268
  return this.nodeDeviceManager.setCameraCapturerParam(params);
266
269
  }
@@ -310,7 +313,7 @@ class TRTCDeviceManager {
310
313
  }
311
314
  }
312
315
  eventHandler(args) {
313
- logger.debug('TRTCDeviceManager event:', args);
316
+ logger_1.default.debug('TRTCDeviceManager event:', args);
314
317
  const key = args[0];
315
318
  const data = args[1];
316
319
  switch (key) {
@@ -373,13 +376,13 @@ class TRTCDeviceManager {
373
376
  this.onGetApplicationMuteStateFinished(data.muted);
374
377
  break;
375
378
  default:
376
- logger.warn("TRTCDeviceManager unsupported event type:", key);
379
+ logger_1.default.warn("TRTCDeviceManager unsupported event type:", key);
377
380
  break;
378
381
  }
379
382
  }
380
383
  onDeviceChange(deviceId, type, state) {
381
384
  var _a;
382
- logger.debug(`${this.logPrefix}onDeviceChange`, deviceId, type, state);
385
+ logger_1.default.debug(`${this.logPrefix}onDeviceChange`, deviceId, type, state);
383
386
  (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit('onDeviceChange', deviceId, type, state);
384
387
  }
385
388
  onSetCurrentDeviceFinished(type, result) {
@@ -452,7 +455,7 @@ class TRTCDeviceManager {
452
455
  }
453
456
  // ****** 这一部分接口暴露不合理,暂时通过 TRTCMediaMixingManager 暴露给用户 **************/
454
457
  startCameraDeviceTest(windowID, rect) {
455
- logger.debug(`${this.logPrefix}startCameraDeviceTest`, windowID, rect);
458
+ logger_1.default.debug(`${this.logPrefix}startCameraDeviceTest`, windowID, rect);
456
459
  let newWindowID = 0;
457
460
  if (windowID instanceof Uint8Array) {
458
461
  for (let i = windowID.length - 1; i >= 0; i--) {
@@ -469,7 +472,7 @@ class TRTCDeviceManager {
469
472
  });
470
473
  }
471
474
  stopCameraDeviceTest() {
472
- logger.debug(`${this.logPrefix}stopCameraDeviceTest`);
475
+ logger_1.default.debug(`${this.logPrefix}stopCameraDeviceTest`);
473
476
  return new Promise((resolve, reject) => {
474
477
  const key = `stopCameraDeviceTest`;
475
478
  this.addPromise(key, resolve, reject);
@@ -477,23 +480,23 @@ class TRTCDeviceManager {
477
480
  });
478
481
  }
479
482
  setCameraTestRenderMirror(mirror) {
480
- logger.debug(`${this.logPrefix}setCameraTestRenderMirror`, mirror);
483
+ logger_1.default.debug(`${this.logPrefix}setCameraTestRenderMirror`, mirror);
481
484
  this.nodeDeviceManager.setCameraTestRenderMirror(mirror);
482
485
  }
483
486
  setCameraTestDeviceId(cameraId) {
484
- logger.debug(`${this.logPrefix}setCameraTestDeviceId`, cameraId);
487
+ logger_1.default.debug(`${this.logPrefix}setCameraTestDeviceId`, cameraId);
485
488
  this.nodeDeviceManager.setCameraTestDeviceId(cameraId);
486
489
  }
487
490
  setCameraTestResolution(width, height) {
488
- logger.debug(`${this.logPrefix}setCameraTestResolution`, width, height);
491
+ logger_1.default.debug(`${this.logPrefix}setCameraTestResolution`, width, height);
489
492
  this.nodeDeviceManager.setCameraTestResolution(width, height);
490
493
  }
491
494
  setCameraTestVideoPluginPath(path) {
492
- logger.debug(`${this.logPrefix}setCameraTestVideoPluginPath`, path);
495
+ logger_1.default.debug(`${this.logPrefix}setCameraTestVideoPluginPath`, path);
493
496
  this.nodeDeviceManager.setCameraTestVideoPluginPath(path);
494
497
  }
495
498
  setCameraTestVideoPluginParameter(params) {
496
- logger.debug(`${this.logPrefix}setCameraTestVideoPluginParameter`, params);
499
+ logger_1.default.debug(`${this.logPrefix}setCameraTestVideoPluginParameter`, params);
497
500
  this.nodeDeviceManager.setCameraTestVideoPluginParameter(params);
498
501
  }
499
502
  }
@@ -94,7 +94,7 @@ export declare class TRTCMediaMixingManager {
94
94
  *
95
95
  * 如果用户应用有特殊配置,默认路径可能找不到服务进程程序,需要自行传入路径。
96
96
  *
97
- * @param path {string} - 设置服务进程程序路径
97
+ * @param path {string} - 服务进程程序路径
98
98
  *
99
99
  * @returns {Promise<void>}
100
100
  */
@@ -8,9 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.TRTCMediaMixingManager = exports.TRTCMediaSourceType = exports.TRTCMediaMixingEvent = void 0;
13
16
  const events_1 = require("events");
17
+ const logger_1 = __importDefault(require("../../logger"));
14
18
  const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
15
19
  var TRTCMediaMixingEvent;
16
20
  (function (TRTCMediaMixingEvent) {
@@ -24,7 +28,6 @@ var TRTCMediaSourceType;
24
28
  TRTCMediaSourceType[TRTCMediaSourceType["kImage"] = 2] = "kImage";
25
29
  TRTCMediaSourceType[TRTCMediaSourceType["kRemoteVideo"] = 3] = "kRemoteVideo";
26
30
  })(TRTCMediaSourceType = exports.TRTCMediaSourceType || (exports.TRTCMediaSourceType = {}));
27
- const logger = console;
28
31
  /**
29
32
  * 本地混流管理器
30
33
  */
@@ -44,7 +47,7 @@ class TRTCMediaMixingManager {
44
47
  this.eventEmitter = null;
45
48
  }
46
49
  eventHandler(args) {
47
- logger.log(`${this.logPrefix} event:`, args);
50
+ logger_1.default.log(`${this.logPrefix} event:`, args);
48
51
  // const key = args[0] as string;
49
52
  // const data = args[1] as { [key: string]: never };
50
53
  // To do: 待完善
@@ -142,7 +145,7 @@ class TRTCMediaMixingManager {
142
145
  *
143
146
  * 如果用户应用有特殊配置,默认路径可能找不到服务进程程序,需要自行传入路径。
144
147
  *
145
- * @param path {string} - 设置服务进程程序路径
148
+ * @param path {string} - 服务进程程序路径
146
149
  *
147
150
  * @returns {Promise<void>}
148
151
  */
@@ -161,7 +164,7 @@ class TRTCMediaMixingManager {
161
164
  serverPath = `${resourcesPath}\\liteav_media_server.exe`;
162
165
  }
163
166
  }
164
- logger.log(`${this.logPrefix} server path:${serverPath}`);
167
+ logger_1.default.log(`${this.logPrefix} server path:${serverPath}`);
165
168
  return yield this.nodeMediaMixingPlugin.setMediaServerPath(serverPath);
166
169
  });
167
170
  }
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.TRTCPluginManager = exports.TRTCPlugin = void 0;
4
7
  const trtc_define_1 = require("../../trtc_define");
8
+ const logger_1 = __importDefault(require("../../logger"));
5
9
  const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
6
- const logger = console;
7
10
  /**
8
11
  * TRTC 插件
9
12
  */
@@ -21,7 +24,7 @@ class TRTCPlugin {
21
24
  return this.pluginId;
22
25
  }
23
26
  enable(flag = true) {
24
- logger.log(`${this.logPrefix}enable:${flag} ${this.pluginId}`);
27
+ logger_1.default.log(`${this.logPrefix}enable:${flag} ${this.pluginId}`);
25
28
  this.nativeVideoEffectPlugin.enable(flag);
26
29
  }
27
30
  /**
@@ -31,7 +34,7 @@ class TRTCPlugin {
31
34
  this.enable(false);
32
35
  }
33
36
  setParameter(param) {
34
- logger.log(`${this.logPrefix}setParameter:${this.pluginId}`);
37
+ logger_1.default.log(`${this.logPrefix}setParameter:${this.pluginId}`);
35
38
  this.nativeVideoEffectPlugin.setParameter(param);
36
39
  }
37
40
  }
@@ -59,13 +62,13 @@ class TRTCPluginManager {
59
62
  this.nodePluginManager = null;
60
63
  }
61
64
  setPluginParams(type, options) {
62
- logger.log(`${this.logPrefix}setPluginParams params:`, type, options);
65
+ logger_1.default.log(`${this.logPrefix}setPluginParams params:`, type, options);
63
66
  if (this.isIPCMode) {
64
67
  if (type === trtc_define_1.TRTCPluginType.TRTCPluginTypeVideoProcess) {
65
68
  this.nodePluginManager.setVideoPluginFormat(trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer, options.pixelFormat);
66
69
  }
67
70
  else {
68
- logger.log(`${this.logPrefix}setPluginParams not supported params:`, type, options);
71
+ logger_1.default.log(`${this.logPrefix}setPluginParams not supported params:`, type, options);
69
72
  }
70
73
  }
71
74
  else {
@@ -80,7 +83,7 @@ class TRTCPluginManager {
80
83
  this._setAudioProcessPluginParams(options);
81
84
  break;
82
85
  default:
83
- logger.log(`setPluginParams invalid type:${type}`);
86
+ logger_1.default.log(`setPluginParams invalid type:${type}`);
84
87
  break;
85
88
  }
86
89
  }
@@ -97,7 +100,7 @@ class TRTCPluginManager {
97
100
  this.videoProcessBufferType = trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Texture;
98
101
  break;
99
102
  default:
100
- logger.error(`${this.logPrefix}setPluginParams() unspported pixelFormat: ${options.pixelFormat}`);
103
+ logger_1.default.error(`${this.logPrefix}setPluginParams() unspported pixelFormat: ${options.pixelFormat}`);
101
104
  return;
102
105
  }
103
106
  this.videoProcessPixelFormat = options.pixelFormat;
@@ -117,7 +120,7 @@ class TRTCPluginManager {
117
120
  }
118
121
  }
119
122
  addPlugin(options) {
120
- logger.log(`${this.logPrefix}addPlugin options:`, options);
123
+ logger_1.default.log(`${this.logPrefix}addPlugin options:`, options);
121
124
  if (this.isIPCMode) {
122
125
  const nativeVideoEffectPlugin = this.nodePluginManager.addVideoPlugin(options.deviceId, options.id, options.path);
123
126
  return new TRTCPlugin(options.id, options.deviceId || '', nativeVideoEffectPlugin);
@@ -145,7 +148,7 @@ class TRTCPluginManager {
145
148
  };
146
149
  }
147
150
  removePlugin(pluginId, deviceId) {
148
- logger.log(`${this.logPrefix}removePlugin pluginId:${pluginId} deviceId:${deviceId}`);
151
+ logger_1.default.log(`${this.logPrefix}removePlugin pluginId:${pluginId} deviceId:${deviceId}`);
149
152
  if (this.isIPCMode) {
150
153
  this.nodePluginManager.removeVideoPlugin(deviceId, pluginId);
151
154
  }
@@ -165,9 +168,9 @@ class TRTCPluginManager {
165
168
  * @deprecated
166
169
  */
167
170
  getPluginList() {
168
- logger.log(`${this.logPrefix}getPluginList`);
171
+ logger_1.default.log(`${this.logPrefix}getPluginList`);
169
172
  if (this.isIPCMode) {
170
- logger.warn(`${this.logPrefix}getPluginList not supported`);
173
+ logger_1.default.warn(`${this.logPrefix}getPluginList not supported`);
171
174
  return null;
172
175
  }
173
176
  else {
package/liteav/trtc.d.ts CHANGED
@@ -67,14 +67,18 @@ declare class TRTCCloud extends EventEmitter {
67
67
  private remoteVideoBufferMap;
68
68
  private localVideoBufferMap;
69
69
  /**
70
- * 构造函数
71
- * @param config {TRTCInitConfig} - 初始化参数,可选
72
- * @param config.networkProxy {Record<string, any>} - 网络代理参数,可选。为空时,默认不开启网络代理。
73
- * @param config.isIPCMode {Boolean} - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
70
+ * @param {TRTCInitConfig} [config] - 初始化参数,可选
71
+ * @param {Record<string, any>} [config.networkProxy] - 网络代理参数,可选。为空时,默认不开启网络代理。
72
+ * @param {Boolean} [config.isIPCMode] - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
74
73
  */
75
74
  constructor(config?: TRTCInitConfig);
76
75
  /**
77
76
  * 创建 TRTCCloud 主实例对象(单例模式)
77
+ *
78
+ * @param {TRTCInitConfig} [config] - 初始化参数,可选
79
+ * @param {Record<string, any>} [config.networkProxy] - 网络代理参数,可选。为空时,默认不开启网络代理。
80
+ * @param {Boolean} [config.isIPCMode] - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
81
+ *
78
82
  * @returns {TRTCCloud}
79
83
  */
80
84
  static getTRTCShareInstance(config?: TRTCInitConfig): TRTCCloud;
@@ -867,6 +871,125 @@ declare class TRTCCloud extends EventEmitter {
867
871
  * 3. target 支持同时配置多个 CDN URL(最多同时 10 个)。若您的同一个转推/转码任务需要发布至多路 CDN,则仅需要在 target 中配置多个 CDN URL 即可。同一个转码任务即使有多个转推地址,对应的转码计费仍只收取一份。
868
872
  * 4. 使用时需要注意不要多个任务同时往相同的 URL 地址推送,以免引起异常推流状态。一种推荐的方案是 URL 中使用 “sdkappid_roomid_userid_main” 作为区分标识,这种命名方式容易辨认且不会在您的多个应用中发生冲突。
869
873
  *
874
+ * @example
875
+ * // Publish big stream(camera video) to CDN
876
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
877
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
878
+ *
879
+ * let cdnTaskId = '';
880
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
881
+ * if (code === 0) {
882
+ * cdnTaskId = taskId;
883
+ * } else {
884
+ * console.log('startPublishMediaStream error:', code, message);
885
+ * }
886
+ * });
887
+ *
888
+ * trtc.startPublishMediaStream({
889
+ * mode: TRTCPublishMode.TRTCPublishBigStreamToCdn,
890
+ * cdnUrlList: [{
891
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
892
+ * isInternalLine: true
893
+ * }],
894
+ * mixStreamIdentity: null
895
+ * }, null, null);
896
+ *
897
+ * @example
898
+ * // Publish sub stream(screen sharing video) to CDN
899
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
900
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
901
+ *
902
+ * let cdnTaskId = '';
903
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
904
+ * if (code === 0) {
905
+ * cdnTaskId = taskId;
906
+ * } else {
907
+ * console.log('startPublishMediaStream error:', code, message);
908
+ * }
909
+ * });
910
+ *
911
+ * trtc.startPublishMediaStream({
912
+ * mode: TRTCPublishMode.TRTCPublishSubStreamToCdn,
913
+ * cdnUrlList: [{
914
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
915
+ * isInternalLine: true
916
+ * }],
917
+ * mixStreamIdentity: null
918
+ * }, null, null);
919
+ *
920
+ * @example
921
+ * // Publish and mixing multi-user video and audio to CDN
922
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
923
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
924
+ *
925
+ * let cdnTaskId = '';
926
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
927
+ * if (code === 0) {
928
+ * cdnTaskId = taskId;
929
+ * } else {
930
+ * console.log('startPublishMediaStream error:', code, message);
931
+ * }
932
+ * });
933
+ *
934
+ * trtc.startPublishMediaStream(
935
+ * {
936
+ * mode: TRTCPublishMode.TRTCPublishMixStreamToCdn,
937
+ * cdnUrlList: [{
938
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
939
+ * isInternalLine: true
940
+ * }],
941
+ * mixStreamIdentity: null
942
+ * },
943
+ * {
944
+ * audioEncodedChannelNum: 2,
945
+ * audioEncodedCodecType: 0,
946
+ * audioEncodedKbps: 128,
947
+ * audioEncodedSampleRate: 48000,
948
+ * videoEncodedCodecType: 0,
949
+ * videoEncodedFPS: 30,
950
+ * videoEncodedGOP: 1,
951
+ * videoEncodedWidth: 1280,
952
+ * videoEncodedHeight: 720,
953
+ * videoEncodedKbps: 2000,
954
+ * videoSeiParams: "",
955
+ * },
956
+ * {
957
+ * "backgroundColor": 14362921,
958
+ * "backgroundImage": "",
959
+ * "videoLayoutList": [
960
+ * {
961
+ * "rect": { "top": 0, "left": 0, "right": 960, "bottom": 540 },
962
+ * "zOrder": 1,
963
+ * "fillMode": 0,
964
+ * "backgroundColor": 14483711,
965
+ * "placeHolderImage": "",
966
+ * "fixedVideoUser": { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
967
+ * "fixedVideoStreamType": 0
968
+ * },
969
+ * {
970
+ * "rect": { "top": 360, "left": 640, "right": 1280, "bottom": 720 },
971
+ * "zOrder": 2,
972
+ * "fillMode": 0,
973
+ * "backgroundColor": 14480000,
974
+ * "placeHolderImage": "",
975
+ * "fixedVideoUser": { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" },
976
+ * "fixedVideoStreamType": 0
977
+ * }
978
+ * ],
979
+ * "audioMixUserList": [
980
+ * { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
981
+ * { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" }
982
+ * ],
983
+ * "watermarkList": [
984
+ * {
985
+ * "watermarkUrl": "https://<Your watermark image URL>",
986
+ * "rect": { "top": 540, "left": 0, "right": 320, "bottom": 640 },
987
+ * "zOrder": 3
988
+ * }
989
+ * ]
990
+ * }
991
+ * );
992
+ *
870
993
  * @param target {TRTCPublishTarget} - 媒体流发布的目标地址,支持转推/转码到腾讯或者第三方 CDN,也支持转码回推到 TRTC 房间中。
871
994
  * @param params {TRTCStreamEncoderParam|null} - 媒体流编码输出参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码输出参数。在转推时,为了更好的转推稳定性和 CDN 兼容性,也建议您进行配置。
872
995
  * @param config {TRTCStreamMixingConfig|null} - 媒体流转码配置参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码配置参数。转推模式下则无效。
@@ -882,6 +1005,81 @@ declare class TRTCCloud extends EventEmitter {
882
1005
  * 2. 您可以通过 taskId 来更新调整转推/转码任务。例如在 pk 业务中,您可以先通过 [startPublishMediaStream]{@link startPublishMediaStream} 发起转推,接着在主播发起 pk 时,通过 taskId 和本接口将转推更新为转码任务。此时,CDN 播放将连续并且不会发生断流(您需要保持媒体流编码输出参数 `param` 一致)。
883
1006
  * 3. 同一个任务不支持纯音频、音视频、纯视频之间的切换。
884
1007
  *
1008
+ * @example
1009
+ * // Publish and mixing multi-user video and audio to TRTC Room
1010
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1011
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1012
+ *
1013
+ * let cdnTaskId = '';
1014
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1015
+ * if (code === 0) {
1016
+ * cdnTaskId = taskId;
1017
+ * } else {
1018
+ * console.log('startPublishMediaStream error:', code, message);
1019
+ * }
1020
+ * });
1021
+ *
1022
+ * trtc.updatePublishMediaStream(
1023
+ * cdnTaskId,
1024
+ * {
1025
+ * mode: TRTCPublishMode.TRTCPublishMixStreamToRoom,
1026
+ * cdnUrlList: [],
1027
+ * mixStreamIdentity: { // Publish to TRTC Room
1028
+ * "userId": "__robot__",
1029
+ * "intRoomId": 5055005,
1030
+ * "strRoomId": ""
1031
+ * }
1032
+ * },
1033
+ * {
1034
+ * audioEncodedChannelNum: 2,
1035
+ * audioEncodedCodecType: 0,
1036
+ * audioEncodedKbps: 128,
1037
+ * audioEncodedSampleRate: 48000,
1038
+ * videoEncodedCodecType: 0,
1039
+ * videoEncodedFPS: 30,
1040
+ * videoEncodedGOP: 1,
1041
+ * videoEncodedWidth: 1280,
1042
+ * videoEncodedHeight: 720,
1043
+ * videoEncodedKbps: 2000,
1044
+ * videoSeiParams: "",
1045
+ * },
1046
+ * {
1047
+ * "backgroundColor": 14362921,
1048
+ * "backgroundImage": "",
1049
+ * "videoLayoutList": [
1050
+ * {
1051
+ * "rect": { "top": 0, "left": 0, "right": 960, "bottom": 540 },
1052
+ * "zOrder": 1,
1053
+ * "fillMode": 0,
1054
+ * "backgroundColor": 14483711,
1055
+ * "placeHolderImage": "",
1056
+ * "fixedVideoUser": { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1057
+ * "fixedVideoStreamType": 0
1058
+ * },
1059
+ * {
1060
+ * "rect": { "top": 360, "left": 640, "right": 1280, "bottom": 720 },
1061
+ * "zOrder": 2,
1062
+ * "fillMode": 0,
1063
+ * "backgroundColor": 14480000,
1064
+ * "placeHolderImage": "",
1065
+ * "fixedVideoUser": { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" },
1066
+ * "fixedVideoStreamType": 0
1067
+ * }
1068
+ * ],
1069
+ * "audioMixUserList": [
1070
+ * { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1071
+ * { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" }
1072
+ * ],
1073
+ * "watermarkList": [
1074
+ * {
1075
+ * "watermarkUrl": "https://<Your watermark image URL>",
1076
+ * "rect": { "top": 540, "left": 0, "right": 320, "bottom": 640 },
1077
+ * "zOrder": 3
1078
+ * }
1079
+ * ]
1080
+ * }
1081
+ * );
1082
+ *
885
1083
  * @param taskId {String} - 通过回调 [onStartPublishMediaStream]{@link TRTCCallback#event:onStartPublishMediaStream} 带给您后台启动的任务标识(即 taskId)
886
1084
  * @param target {TRTCPublishTarget|null} - 媒体流发布的目标地址,支持转推/转码到腾讯或者第三方 CDN,也支持转码回推到 TRTC 房间中。
887
1085
  * @param params {TRTCStreamEncoderParam|null} - 媒体流编码输出参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码输出参数。在转推时,为了更好的转推稳定性和 CDN 兼容性,也建议您进行配置。
@@ -2727,6 +2925,10 @@ declare class TRTCCloud extends EventEmitter {
2727
2925
  /**
2728
2926
  * 获取本地混流管理器
2729
2927
  *
2928
+ * 注意:<br/>
2929
+ * 1.目前仅支持 ``Windows`` 操作系统。<br/>
2930
+ * 2.本地混流管理器必须在 [getTRTCShareInstance]{@link TRTCCloud#getTRTCShareInstance} 创建 TRTCCloud 实例时传入 `isIPCMode` 为 `true` 才支持,否则返回 null。
2931
+ *
2730
2932
  * @returns {TRTCMediaMixingManager | null}
2731
2933
  */
2732
2934
  getMediaMixingManager(): TRTCMediaMixingManager | null;
package/liteav/trtc.js CHANGED
@@ -163,10 +163,9 @@ const getComponentNO = function () {
163
163
  */
164
164
  class TRTCCloud extends events_1.EventEmitter {
165
165
  /**
166
- * 构造函数
167
- * @param config {TRTCInitConfig} - 初始化参数,可选
168
- * @param config.networkProxy {Record<string, any>} - 网络代理参数,可选。为空时,默认不开启网络代理。
169
- * @param config.isIPCMode {Boolean} - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
166
+ * @param {TRTCInitConfig} [config] - 初始化参数,可选
167
+ * @param {Record<string, any>} [config.networkProxy] - 网络代理参数,可选。为空时,默认不开启网络代理。
168
+ * @param {Boolean} [config.isIPCMode] - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
170
169
  */
171
170
  constructor(config) {
172
171
  var _a;
@@ -272,6 +271,11 @@ class TRTCCloud extends events_1.EventEmitter {
272
271
  }
273
272
  /**
274
273
  * 创建 TRTCCloud 主实例对象(单例模式)
274
+ *
275
+ * @param {TRTCInitConfig} [config] - 初始化参数,可选
276
+ * @param {Record<string, any>} [config.networkProxy] - 网络代理参数,可选。为空时,默认不开启网络代理。
277
+ * @param {Boolean} [config.isIPCMode] - 是否跨进程模式,跨进程模式支持本地混流且混流视频采用原生窗口渲染。默认:false,不开启。
278
+ *
275
279
  * @returns {TRTCCloud}
276
280
  */
277
281
  static getTRTCShareInstance(config) {
@@ -1752,6 +1756,125 @@ class TRTCCloud extends events_1.EventEmitter {
1752
1756
  * 3. target 支持同时配置多个 CDN URL(最多同时 10 个)。若您的同一个转推/转码任务需要发布至多路 CDN,则仅需要在 target 中配置多个 CDN URL 即可。同一个转码任务即使有多个转推地址,对应的转码计费仍只收取一份。
1753
1757
  * 4. 使用时需要注意不要多个任务同时往相同的 URL 地址推送,以免引起异常推流状态。一种推荐的方案是 URL 中使用 “sdkappid_roomid_userid_main” 作为区分标识,这种命名方式容易辨认且不会在您的多个应用中发生冲突。
1754
1758
  *
1759
+ * @example
1760
+ * // Publish big stream(camera video) to CDN
1761
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1762
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1763
+ *
1764
+ * let cdnTaskId = '';
1765
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1766
+ * if (code === 0) {
1767
+ * cdnTaskId = taskId;
1768
+ * } else {
1769
+ * console.log('startPublishMediaStream error:', code, message);
1770
+ * }
1771
+ * });
1772
+ *
1773
+ * trtc.startPublishMediaStream({
1774
+ * mode: TRTCPublishMode.TRTCPublishBigStreamToCdn,
1775
+ * cdnUrlList: [{
1776
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
1777
+ * isInternalLine: true
1778
+ * }],
1779
+ * mixStreamIdentity: null
1780
+ * }, null, null);
1781
+ *
1782
+ * @example
1783
+ * // Publish sub stream(screen sharing video) to CDN
1784
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1785
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1786
+ *
1787
+ * let cdnTaskId = '';
1788
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1789
+ * if (code === 0) {
1790
+ * cdnTaskId = taskId;
1791
+ * } else {
1792
+ * console.log('startPublishMediaStream error:', code, message);
1793
+ * }
1794
+ * });
1795
+ *
1796
+ * trtc.startPublishMediaStream({
1797
+ * mode: TRTCPublishMode.TRTCPublishSubStreamToCdn,
1798
+ * cdnUrlList: [{
1799
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
1800
+ * isInternalLine: true
1801
+ * }],
1802
+ * mixStreamIdentity: null
1803
+ * }, null, null);
1804
+ *
1805
+ * @example
1806
+ * // Publish and mixing multi-user video and audio to CDN
1807
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1808
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1809
+ *
1810
+ * let cdnTaskId = '';
1811
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1812
+ * if (code === 0) {
1813
+ * cdnTaskId = taskId;
1814
+ * } else {
1815
+ * console.log('startPublishMediaStream error:', code, message);
1816
+ * }
1817
+ * });
1818
+ *
1819
+ * trtc.startPublishMediaStream(
1820
+ * {
1821
+ * mode: TRTCPublishMode.TRTCPublishMixStreamToCdn,
1822
+ * cdnUrlList: [{
1823
+ * rtmpUrl: 'rtmp://<Your RTMP URL>',
1824
+ * isInternalLine: true
1825
+ * }],
1826
+ * mixStreamIdentity: null
1827
+ * },
1828
+ * {
1829
+ * audioEncodedChannelNum: 2,
1830
+ * audioEncodedCodecType: 0,
1831
+ * audioEncodedKbps: 128,
1832
+ * audioEncodedSampleRate: 48000,
1833
+ * videoEncodedCodecType: 0,
1834
+ * videoEncodedFPS: 30,
1835
+ * videoEncodedGOP: 1,
1836
+ * videoEncodedWidth: 1280,
1837
+ * videoEncodedHeight: 720,
1838
+ * videoEncodedKbps: 2000,
1839
+ * videoSeiParams: "",
1840
+ * },
1841
+ * {
1842
+ * "backgroundColor": 14362921,
1843
+ * "backgroundImage": "",
1844
+ * "videoLayoutList": [
1845
+ * {
1846
+ * "rect": { "top": 0, "left": 0, "right": 960, "bottom": 540 },
1847
+ * "zOrder": 1,
1848
+ * "fillMode": 0,
1849
+ * "backgroundColor": 14483711,
1850
+ * "placeHolderImage": "",
1851
+ * "fixedVideoUser": { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1852
+ * "fixedVideoStreamType": 0
1853
+ * },
1854
+ * {
1855
+ * "rect": { "top": 360, "left": 640, "right": 1280, "bottom": 720 },
1856
+ * "zOrder": 2,
1857
+ * "fillMode": 0,
1858
+ * "backgroundColor": 14480000,
1859
+ * "placeHolderImage": "",
1860
+ * "fixedVideoUser": { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" },
1861
+ * "fixedVideoStreamType": 0
1862
+ * }
1863
+ * ],
1864
+ * "audioMixUserList": [
1865
+ * { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1866
+ * { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" }
1867
+ * ],
1868
+ * "watermarkList": [
1869
+ * {
1870
+ * "watermarkUrl": "https://<Your watermark image URL>",
1871
+ * "rect": { "top": 540, "left": 0, "right": 320, "bottom": 640 },
1872
+ * "zOrder": 3
1873
+ * }
1874
+ * ]
1875
+ * }
1876
+ * );
1877
+ *
1755
1878
  * @param target {TRTCPublishTarget} - 媒体流发布的目标地址,支持转推/转码到腾讯或者第三方 CDN,也支持转码回推到 TRTC 房间中。
1756
1879
  * @param params {TRTCStreamEncoderParam|null} - 媒体流编码输出参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码输出参数。在转推时,为了更好的转推稳定性和 CDN 兼容性,也建议您进行配置。
1757
1880
  * @param config {TRTCStreamMixingConfig|null} - 媒体流转码配置参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码配置参数。转推模式下则无效。
@@ -1770,6 +1893,81 @@ class TRTCCloud extends events_1.EventEmitter {
1770
1893
  * 2. 您可以通过 taskId 来更新调整转推/转码任务。例如在 pk 业务中,您可以先通过 [startPublishMediaStream]{@link startPublishMediaStream} 发起转推,接着在主播发起 pk 时,通过 taskId 和本接口将转推更新为转码任务。此时,CDN 播放将连续并且不会发生断流(您需要保持媒体流编码输出参数 `param` 一致)。
1771
1894
  * 3. 同一个任务不支持纯音频、音视频、纯视频之间的切换。
1772
1895
  *
1896
+ * @example
1897
+ * // Publish and mixing multi-user video and audio to TRTC Room
1898
+ * import TRTCCloud, { TRTCPublishMode } from 'trtc-electron-sdk';
1899
+ * const trtcCloud = TRTCCloud.getTRTCShareInstance();
1900
+ *
1901
+ * let cdnTaskId = '';
1902
+ * trtcCloud.on('onStartPublishMediaStream', (taskId: string, code: number, message: string) => {
1903
+ * if (code === 0) {
1904
+ * cdnTaskId = taskId;
1905
+ * } else {
1906
+ * console.log('startPublishMediaStream error:', code, message);
1907
+ * }
1908
+ * });
1909
+ *
1910
+ * trtc.updatePublishMediaStream(
1911
+ * cdnTaskId,
1912
+ * {
1913
+ * mode: TRTCPublishMode.TRTCPublishMixStreamToRoom,
1914
+ * cdnUrlList: [],
1915
+ * mixStreamIdentity: { // Publish to TRTC Room
1916
+ * "userId": "__robot__",
1917
+ * "intRoomId": 5055005,
1918
+ * "strRoomId": ""
1919
+ * }
1920
+ * },
1921
+ * {
1922
+ * audioEncodedChannelNum: 2,
1923
+ * audioEncodedCodecType: 0,
1924
+ * audioEncodedKbps: 128,
1925
+ * audioEncodedSampleRate: 48000,
1926
+ * videoEncodedCodecType: 0,
1927
+ * videoEncodedFPS: 30,
1928
+ * videoEncodedGOP: 1,
1929
+ * videoEncodedWidth: 1280,
1930
+ * videoEncodedHeight: 720,
1931
+ * videoEncodedKbps: 2000,
1932
+ * videoSeiParams: "",
1933
+ * },
1934
+ * {
1935
+ * "backgroundColor": 14362921,
1936
+ * "backgroundImage": "",
1937
+ * "videoLayoutList": [
1938
+ * {
1939
+ * "rect": { "top": 0, "left": 0, "right": 960, "bottom": 540 },
1940
+ * "zOrder": 1,
1941
+ * "fillMode": 0,
1942
+ * "backgroundColor": 14483711,
1943
+ * "placeHolderImage": "",
1944
+ * "fixedVideoUser": { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1945
+ * "fixedVideoStreamType": 0
1946
+ * },
1947
+ * {
1948
+ * "rect": { "top": 360, "left": 640, "right": 1280, "bottom": 720 },
1949
+ * "zOrder": 2,
1950
+ * "fillMode": 0,
1951
+ * "backgroundColor": 14480000,
1952
+ * "placeHolderImage": "",
1953
+ * "fixedVideoUser": { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" },
1954
+ * "fixedVideoStreamType": 0
1955
+ * }
1956
+ * ],
1957
+ * "audioMixUserList": [
1958
+ * { "userId": "windev", "intRoomId": 5055005, "strRoomId": "" },
1959
+ * { "userId": "macdev", "intRoomId": 5055005, "strRoomId": "" }
1960
+ * ],
1961
+ * "watermarkList": [
1962
+ * {
1963
+ * "watermarkUrl": "https://<Your watermark image URL>",
1964
+ * "rect": { "top": 540, "left": 0, "right": 320, "bottom": 640 },
1965
+ * "zOrder": 3
1966
+ * }
1967
+ * ]
1968
+ * }
1969
+ * );
1970
+ *
1773
1971
  * @param taskId {String} - 通过回调 [onStartPublishMediaStream]{@link TRTCCallback#event:onStartPublishMediaStream} 带给您后台启动的任务标识(即 taskId)
1774
1972
  * @param target {TRTCPublishTarget|null} - 媒体流发布的目标地址,支持转推/转码到腾讯或者第三方 CDN,也支持转码回推到 TRTC 房间中。
1775
1973
  * @param params {TRTCStreamEncoderParam|null} - 媒体流编码输出参数,转码和回推到 TRTC 房间中时为必填项,您需要指定您预期的转码输出参数。在转推时,为了更好的转推稳定性和 CDN 兼容性,也建议您进行配置。
@@ -5119,6 +5317,10 @@ class TRTCCloud extends events_1.EventEmitter {
5119
5317
  /**
5120
5318
  * 获取本地混流管理器
5121
5319
  *
5320
+ * 注意:<br/>
5321
+ * 1.目前仅支持 ``Windows`` 操作系统。<br/>
5322
+ * 2.本地混流管理器必须在 [getTRTCShareInstance]{@link TRTCCloud#getTRTCShareInstance} 创建 TRTCCloud 实例时传入 `isIPCMode` 为 `true` 才支持,否则返回 null。
5323
+ *
5122
5324
  * @returns {TRTCMediaMixingManager | null}
5123
5325
  */
5124
5326
  getMediaMixingManager() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "12.2.702-beta.0",
3
+ "version": "12.2.702",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",
@@ -3,14 +3,26 @@ const {copy, remove} = require('fs-sync');
3
3
  const fs = require('fs');
4
4
 
5
5
  const liteavPath = path.join(__dirname, '../liteav');
6
- const liteavFiles = fs.readdirSync(liteavPath, {withFileTypes: true});
7
- liteavFiles.forEach(file => {
8
- if (file.isFile() && file.name.indexOf('_en.') !== -1) {
9
- const filePath = path.join(liteavPath, file.name);
10
- console.log(`Remove en files not to be published: `, filePath);
11
- remove(filePath);
6
+
7
+ function deleteENFileNotToPublish(dir) {
8
+ const files = fs.readdirSync(dir, {withFileTypes: true});
9
+
10
+ for (const file of files) {
11
+ if (file.isFile()) {
12
+ if (file.name.indexOf('_en.') !== -1) {
13
+ const filePath = path.join(dir, file.name);
14
+ console.log(`Remove en files not to be published: `, filePath);
15
+ remove(filePath);
16
+ }
17
+ } else if (file.isDirectory()) {
18
+ const childFilePath = path.join(dir, file.name);
19
+ deleteENFileNotToPublish(childFilePath);
20
+ } else {
21
+ // do nothing
22
+ }
12
23
  }
13
- });
24
+ }
25
+ deleteENFileNotToPublish(liteavPath);
14
26
 
15
27
  remove('./npm');
16
28
  copy(path.resolve('./liteav'), path.resolve('./npm/liteav'));