trtc-electron-sdk 13.0.709-alpha.0 → 13.0.709-beta.1

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.
@@ -227,7 +227,6 @@ class Resizable {
227
227
  this.originLeft = window.parseInt(resizeTargetStyle.left);
228
228
  this.originWidth = this.resizeTarget.offsetWidth;
229
229
  this.originHeight = this.resizeTarget.offsetHeight;
230
- logger_1.default.debug("resize origin:", this.originTop, this.originLeft, this.originWidth, this.originHeight);
231
230
  }
232
231
  else {
233
232
  logger_1.default.error(`${this.logPrefix}mouseDown 'resizeTarget' is null`);
@@ -63,7 +63,6 @@ class TRTCMediaMixingDesigner {
63
63
  }
64
64
  }
65
65
  setWorkingArea(relative, fillMode = trtc_define_1.TRTCVideoFillMode.TRTCVideoFillMode_Fit) {
66
- logger_1.default.log(`${this.logPrefix}setWorkingArea:`, JSON.stringify(relative), `fillMode:${fillMode}`);
67
66
  if (relative) {
68
67
  this.relativeWorkingArea = Object.assign({}, relative);
69
68
  this.fillMode = fillMode;
@@ -159,7 +158,7 @@ class TRTCMediaMixingDesigner {
159
158
  (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.off(event, func);
160
159
  }
161
160
  destroy() {
162
- var _a, _b, _c, _d, _e;
161
+ var _a, _b, _c, _d;
163
162
  if (this.resizeObserver) {
164
163
  if (this.container) {
165
164
  this.resizeObserver.unobserve(this.container);
@@ -172,9 +171,9 @@ class TRTCMediaMixingDesigner {
172
171
  this.movableHandler = null;
173
172
  this.resizableHandler = null;
174
173
  (_c = this.container) === null || _c === void 0 ? void 0 : _c.removeEventListener('contextmenu', this.onRightButtonClicked, false);
175
- (_d = this.container) === null || _d === void 0 ? void 0 : _d.removeEventListener("mousedown", this.onContainerMousedown, false);
174
+ document.removeEventListener("mousedown", this.onContainerMousedown, false);
176
175
  if (this.moveAndResizeOverlay) {
177
- (_e = this.container) === null || _e === void 0 ? void 0 : _e.removeChild(this.moveAndResizeOverlay);
176
+ (_d = this.container) === null || _d === void 0 ? void 0 : _d.removeChild(this.moveAndResizeOverlay);
178
177
  this.moveAndResizeOverlay = null;
179
178
  }
180
179
  this.container = null;
@@ -205,7 +204,7 @@ class TRTCMediaMixingDesigner {
205
204
  this.onContainerMousedown = this.onContainerMousedown.bind(this);
206
205
  this.onContainerMousemove = this.onContainerMousemove.bind(this);
207
206
  this.onContainerMouseup = this.onContainerMouseup.bind(this);
208
- this.container.addEventListener("mousedown", this.onContainerMousedown, false);
207
+ document.addEventListener("mousedown", this.onContainerMousedown, false);
209
208
  this.onRightButtonClicked = this.onRightButtonClicked.bind(this);
210
209
  this.container.addEventListener('contextmenu', this.onRightButtonClicked, false);
211
210
  }
@@ -221,7 +220,6 @@ class TRTCMediaMixingDesigner {
221
220
  }
222
221
  }
223
222
  onPreviewAreaResize(entries) {
224
- logger_1.default.log(`${this.logPrefix}onPreviewAreaResize:`, entries);
225
223
  for (const entry of entries) {
226
224
  if (entry.target === this.container) {
227
225
  this.updateWorkingArea();
@@ -242,7 +240,6 @@ class TRTCMediaMixingDesigner {
242
240
  width: (this.relativeWorkingArea.right - this.relativeWorkingArea.left) * containerRect.width,
243
241
  height: (this.relativeWorkingArea.bottom - this.relativeWorkingArea.top) * containerRect.height,
244
242
  };
245
- logger_1.default.log(`${this.logPrefix}updateWorkingArea absolute working area:`, JSON.stringify(this.absoluteWorkingArea));
246
243
  }
247
244
  else {
248
245
  logger_1.default.error(`${this.logPrefix}updateWorkingArea no data:`, this.relativeWorkingArea, this.container);
@@ -269,7 +266,6 @@ class TRTCMediaMixingDesigner {
269
266
  this.previewHeight = this.mixingVideoHeight * this.previewScale;
270
267
  this.previewLeft = (workingAreaWidth - this.previewWidth) / 2;
271
268
  this.previewTop = (workingAreaHeight - this.previewHeight) / 2;
272
- logger_1.default.debug(`${this.logPrefix}updatePreviewProperty: fillMode: ${this.fillMode} previewScale: ${this.previewScale}, previewWidth: ${this.previewWidth}, previewHeight: ${this.previewHeight}, previewLeft: ${this.previewLeft}, previewTop: ${this.previewTop}`);
273
269
  }
274
270
  else {
275
271
  logger_1.default.error(`${this.logPrefix}updatePreviewProperty failed, no HTML element to display`);
@@ -282,7 +278,6 @@ class TRTCMediaMixingDesigner {
282
278
  let width = 0;
283
279
  let height = 0;
284
280
  if (this.selectedMediaIndex >= 0) {
285
- logger_1.default.debug(`${this.logPrefix}updateOverlay: selected media:`, this.mediaList[this.selectedMediaIndex].rect);
286
281
  this.moveAndResizeOverlay.style.display = 'block';
287
282
  const selectedPreviewRect = {
288
283
  left: this.mediaList[this.selectedMediaIndex].rect.left * this.previewScale,
@@ -319,12 +314,10 @@ class TRTCMediaMixingDesigner {
319
314
  this.moveAndResizeOverlay.style.transform = 'none';
320
315
  this.moveAndResizeOverlay.style.transformOrigin = 'none';
321
316
  }
322
- logger_1.default.debug(`${this.logPrefix}updateOverlay: ${left} ${top} ${width} ${height} ${renderScale}`);
323
317
  }
324
318
  }
325
319
  onMove(left, top) {
326
320
  var _a;
327
- logger_1.default.log(`${this.logPrefix}onMove: ${left} ${top}`);
328
321
  const target = this.mediaList[this.selectedMediaIndex];
329
322
  if (target && this.moveAndResizeOverlay) {
330
323
  // calc new preview rect
@@ -342,8 +335,6 @@ class TRTCMediaMixingDesigner {
342
335
  right: Math.round(newPreviewRect.right / this.previewScale),
343
336
  bottom: Math.round(newPreviewRect.bottom / this.previewScale),
344
337
  };
345
- logger_1.default.debug(`${this.logPrefix}onMove new preview rect: ${JSON.stringify(newPreviewRect)}`);
346
- logger_1.default.debug(`${this.logPrefix}onMove new rect in mixing: ${JSON.stringify(newRectInMixing)}`);
347
338
  (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit('onSourceMoved', Object.assign({}, target), newRectInMixing);
348
339
  }
349
340
  else {
@@ -371,7 +362,6 @@ class TRTCMediaMixingDesigner {
371
362
  }
372
363
  onResize(left, top, width, height) {
373
364
  var _a;
374
- logger_1.default.log(`${this.logPrefix}onResize: ${left} ${top} ${width} ${height}`);
375
365
  const target = this.mediaList[this.selectedMediaIndex];
376
366
  if (target) {
377
367
  // calc new preview rect
@@ -412,40 +402,38 @@ class TRTCMediaMixingDesigner {
412
402
  (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit('onSourceSelected', media ? Object.assign({}, media) : null);
413
403
  }
414
404
  onContainerMousedown(event) {
415
- logger_1.default.log(`${this.logPrefix}onContainerMousedown event:`, event, event.target, event.currentTarget);
416
405
  const target = event.target;
417
406
  this.eventButton = event.button;
418
407
  if (target && this.container) {
419
- // calc click point coordinates in mix video image
420
- logger_1.default.log(`${this.logPrefix}onContainerMousedown mix video image clicked`);
421
- const containerBounds = this.container.getBoundingClientRect();
422
- const xInPreviewImage = event.clientX - containerBounds.left - this.absoluteWorkingArea.left - this.previewLeft;
423
- const yInPreviewImage = event.clientY - containerBounds.top - this.absoluteWorkingArea.top - this.previewTop;
424
- const xInImage = xInPreviewImage / this.previewScale;
425
- const yInImage = yInPreviewImage / this.previewScale;
426
- logger_1.default.log(`${this.logPrefix}onContainerMousedown click point coordinates in mix video:`, xInPreviewImage, yInPreviewImage, xInImage, yInImage);
427
- for (let i = 0; i < this.mediaList.length; i++) {
428
- const item = this.mediaList[i];
429
- if (item.rect &&
430
- xInImage >= item.rect.left &&
431
- xInImage <= item.rect.right &&
432
- yInImage >= item.rect.top &&
433
- yInImage <= item.rect.bottom) {
434
- this.clickedMediaSources.push(item);
435
- if (this.mediaList[this.selectedMediaIndex]) {
436
- if (item.id === this.mediaList[this.selectedMediaIndex].id) {
437
- this.oldSelectedIndex = this.clickedMediaSources.length - 1;
408
+ if (this.container.contains(target)) {
409
+ // calc click point coordinates in mix video image
410
+ const containerBounds = this.container.getBoundingClientRect();
411
+ const xInPreviewImage = event.clientX - containerBounds.left - this.absoluteWorkingArea.left - this.previewLeft;
412
+ const yInPreviewImage = event.clientY - containerBounds.top - this.absoluteWorkingArea.top - this.previewTop;
413
+ const xInImage = xInPreviewImage / this.previewScale;
414
+ const yInImage = yInPreviewImage / this.previewScale;
415
+ for (let i = 0; i < this.mediaList.length; i++) {
416
+ const item = this.mediaList[i];
417
+ if (item.rect &&
418
+ xInImage >= item.rect.left &&
419
+ xInImage <= item.rect.right &&
420
+ yInImage >= item.rect.top &&
421
+ yInImage <= item.rect.bottom) {
422
+ this.clickedMediaSources.push(item);
423
+ if (this.mediaList[this.selectedMediaIndex]) {
424
+ if (item.id === this.mediaList[this.selectedMediaIndex].id) {
425
+ this.oldSelectedIndex = this.clickedMediaSources.length - 1;
426
+ }
438
427
  }
439
428
  }
440
429
  }
430
+ this.mousedownLeft = event.screenX;
431
+ this.mousedownTop = event.screenY;
441
432
  }
442
- this.mousedownLeft = event.screenX;
443
- this.mousedownTop = event.screenY;
444
433
  if (this.clickedMediaSources.length > 0) {
445
434
  if (this.eventButton === 2 && this.oldSelectedIndex === -1) {
446
435
  // select first media source
447
436
  this.newSelected = this.clickedMediaSources[0];
448
- logger_1.default.log(`${this.logPrefix}onContainerMousedown find clicked media source:`, this.newSelected);
449
437
  // mediaSourcesStore.setSelectedMediaKey(newSelected);
450
438
  this.emitOnSelect(this.newSelected);
451
439
  this.clickedMediaSources.splice(0, this.clickedMediaSources.length);
@@ -457,7 +445,6 @@ class TRTCMediaMixingDesigner {
457
445
  }
458
446
  else {
459
447
  this.newSelected = null;
460
- logger_1.default.log(`${this.logPrefix}onContainerMousedown find clicked media source:`, this.newSelected);
461
448
  this.emitOnSelect(null);
462
449
  this.mousedownLeft = null;
463
450
  this.mousedownTop = null;
@@ -475,14 +462,12 @@ class TRTCMediaMixingDesigner {
475
462
  if (Math.abs(leftMovedDistance) >= MIN_MOVE_DISTANCE || Math.abs(topMovedDistance) >= MIN_MOVE_DISTANCE) {
476
463
  if (this.oldSelectedIndex >= 0) {
477
464
  // move or resize old selected media source
478
- logger_1.default.log(`${this.logPrefix}onContainerMousemove move or resize old selected media source, clear data:`, this.clickedMediaSources, this.oldSelectedIndex);
479
465
  this.clickedMediaSources.splice(0, this.clickedMediaSources.length);
480
466
  this.oldSelectedIndex = -1;
481
467
  }
482
468
  else if (this.clickedMediaSources.length > 0) {
483
469
  // select first media source
484
470
  this.newSelected = this.clickedMediaSources[0];
485
- logger_1.default.log(`${this.logPrefix}onContainerMousemove find clicked media source:`, this.newSelected);
486
471
  this.emitOnSelect(this.newSelected);
487
472
  this.clickedMediaSources.splice(0, this.clickedMediaSources.length);
488
473
  // 支持 mousedown 选中媒体源和 mousemove 移动媒体源同时触发
@@ -499,7 +484,6 @@ class TRTCMediaMixingDesigner {
499
484
  onContainerMouseup(event) {
500
485
  document.removeEventListener("mousemove", this.onContainerMousemove, false);
501
486
  document.removeEventListener("mouseup", this.onContainerMouseup, false);
502
- logger_1.default.log(`${this.logPrefix}onContainerMouseup data:`, this.clickedMediaSources, this.oldSelectedIndex);
503
487
  const target = event.target;
504
488
  if (target && this.container) {
505
489
  if (this.clickedMediaSources.length > 0) {
@@ -508,7 +492,6 @@ class TRTCMediaMixingDesigner {
508
492
  // select next zOrder media source
509
493
  const newSelectedIndex = (this.oldSelectedIndex + 1) % this.clickedMediaSources.length;
510
494
  this.newSelected = this.clickedMediaSources[newSelectedIndex];
511
- logger_1.default.log(`${this.logPrefix}onContainerMouseup find clicked media source:`, this.newSelected);
512
495
  this.emitOnSelect(this.newSelected);
513
496
  }
514
497
  else {
@@ -519,7 +502,6 @@ class TRTCMediaMixingDesigner {
519
502
  else {
520
503
  // select first media source
521
504
  this.newSelected = this.clickedMediaSources[0];
522
- logger_1.default.log(`${this.logPrefix}onContainerMouseup find clicked media source:`, this.newSelected);
523
505
  this.emitOnSelect(this.newSelected);
524
506
  }
525
507
  }
@@ -529,7 +511,6 @@ class TRTCMediaMixingDesigner {
529
511
  }
530
512
  else {
531
513
  // un-select current media source
532
- logger_1.default.log(`${this.logPrefix}onContainerMouseup click outside of mixing video image`);
533
514
  this.emitOnSelect(null);
534
515
  }
535
516
  this.mousedownLeft = null;
@@ -541,7 +522,6 @@ class TRTCMediaMixingDesigner {
541
522
  }
542
523
  onRightButtonClicked(event) {
543
524
  var _a;
544
- logger_1.default.log(`${this.logPrefix}onRightButtonClicked:`, event.target, event.currentTarget, event.buttons);
545
525
  event.preventDefault();
546
526
  (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit('onRightButtonClicked', Object.assign({}, this.mediaList[this.selectedMediaIndex]), {
547
527
  windowX: event.clientX,
@@ -7,6 +7,7 @@ exports.TRTCDeviceManager = void 0;
7
7
  const events_1 = require("events");
8
8
  const trtc_define_1 = require("../../trtc_define");
9
9
  const logger_1 = __importDefault(require("../../logger"));
10
+ const utils_1 = require("../../utils");
10
11
  const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
11
12
  /**
12
13
  * 设备管理器
@@ -456,6 +457,9 @@ class TRTCDeviceManager {
456
457
  // ****** 这一部分接口暴露不合理,暂时通过 TRTCMediaMixingManager 暴露给用户 **************/
457
458
  startCameraDeviceTest(windowID, rect) {
458
459
  logger_1.default.debug(`${this.logPrefix}startCameraDeviceTest`, windowID, rect);
460
+ if (!(0, utils_1.isWindows)()) {
461
+ return Promise.resolve(0);
462
+ }
459
463
  let newWindowID = 0;
460
464
  if (windowID instanceof Uint8Array) {
461
465
  for (let i = windowID.length - 1; i >= 0; i--) {
@@ -262,6 +262,7 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
262
262
  setCameraCaptureParam(cameraID: string, params: TRTCCameraCaptureParams): void;
263
263
  /**
264
264
  * 设置手机投屏参数
265
+ * @private
265
266
  * @param phoneMirrorSourceId {string} - 手机投屏媒体源 ID
266
267
  * @param param {TRTCPhoneMirrorParam} - 手机投屏参数
267
268
  */
@@ -73,6 +73,10 @@ const TRTCMediaSourceType_HACK_JSDOC = {
73
73
  kImage: 2,
74
74
  /** 手机投屏 */
75
75
  kPhoneMirror: 4,
76
+ /** 在线视频 */
77
+ kOnlineVideo: 5,
78
+ /** 本地视频文件 */
79
+ kVideoFile: 6,
76
80
  };
77
81
  /**
78
82
  * 手机投屏媒体源参数
@@ -494,7 +498,7 @@ class TRTCMediaMixingManager {
494
498
  else {
495
499
  realWindowID = windowID;
496
500
  }
497
- this.windowID = realWindowID;
501
+ this.windowID = (0, utils_1.isWindows)() ? realWindowID : 0;
498
502
  if (this.windowID !== 0 && viewOrRegion !== null) {
499
503
  yield this.previewInNativeWindow(viewOrRegion);
500
504
  }
@@ -648,6 +652,7 @@ class TRTCMediaMixingManager {
648
652
  }
649
653
  /**
650
654
  * 设置手机投屏参数
655
+ * @private
651
656
  * @param phoneMirrorSourceId {string} - 手机投屏媒体源 ID
652
657
  * @param param {TRTCPhoneMirrorParam} - 手机投屏参数
653
658
  */
package/liteav/trtc.d.ts CHANGED
@@ -1369,7 +1369,7 @@ declare class TRTCCloud extends EventEmitter {
1369
1369
  * @param {TRTCVideoResolutionMode} params.resMode - 分辨率模式(横屏分辨率 - 竖屏分辨率)
1370
1370
  * - TRTCVideoResolutionModeLandscape: 横屏分辨率
1371
1371
  * - TRTCVideoResolutionModePortrait : 竖屏分辨率
1372
- * @param {Number} params.videoFps - 视频采集帧率
1372
+ * @param {Number} params.videoFps - 视频编码帧率
1373
1373
  * @param {Number} params.videoBitrate - 视频上行码率
1374
1374
  * @param {Number} params.minVideoBitrate - 视频最小码率
1375
1375
  * @param {Boolean} params.enableAdjustRes - 是否允许动态调整分辨率,默认值:关闭。
package/liteav/trtc.js CHANGED
@@ -30,6 +30,7 @@ const yuv_buffer_1 = __importDefault(require("./Renderer/yuv-buffer"));
30
30
  const YCbCr_1 = __importDefault(require("yuv-canvas/src/YCbCr"));
31
31
  const LocalMediaTranscoder_1 = __importDefault(require("./LocalMediaTranscoder"));
32
32
  const trtc_define_1 = require("./trtc_define");
33
+ const utils_1 = require("./utils");
33
34
  const validate_util_1 = require("./validate-util");
34
35
  const logger_1 = __importStar(require("./logger"));
35
36
  const LocalVideoRenderController_1 = __importDefault(require("./VideoRenderControl/LocalVideoRenderController"));
@@ -2542,7 +2543,7 @@ class TRTCCloud extends events_1.EventEmitter {
2542
2543
  * @param {TRTCVideoResolutionMode} params.resMode - 分辨率模式(横屏分辨率 - 竖屏分辨率)
2543
2544
  * - TRTCVideoResolutionModeLandscape: 横屏分辨率
2544
2545
  * - TRTCVideoResolutionModePortrait : 竖屏分辨率
2545
- * @param {Number} params.videoFps - 视频采集帧率
2546
+ * @param {Number} params.videoFps - 视频编码帧率
2546
2547
  * @param {Number} params.videoBitrate - 视频上行码率
2547
2548
  * @param {Number} params.minVideoBitrate - 视频最小码率
2548
2549
  * @param {Boolean} params.enableAdjustRes - 是否允许动态调整分辨率,默认值:关闭。
@@ -5276,7 +5277,7 @@ class TRTCCloud extends events_1.EventEmitter {
5276
5277
  return rgbaData;
5277
5278
  }
5278
5279
  _isMacPlatform() {
5279
- return process.platform == 'darwin';
5280
+ return (0, utils_1.isMacOS)();
5280
5281
  }
5281
5282
  _setRemoteVideoBuffer(userId, streamType) {
5282
5283
  const videoBufferInfo = new trtc_define_1.VideoBufferInfo({
package/liteav/utils.d.ts CHANGED
@@ -35,3 +35,7 @@ export declare function throttle<T extends (...args: any[]) => any>(func: T, wai
35
35
  leading?: boolean;
36
36
  trailing?: boolean;
37
37
  }): (...args: Parameters<T>) => void;
38
+ export declare function getOS(): string;
39
+ export declare function isMacOS(): boolean;
40
+ export declare function isWindows(): boolean;
41
+ export declare function isLinux(): boolean;
package/liteav/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.throttle = exports.debounce = exports.convertUint8ArrayToNumber = exports.safelyParse = exports.isNullOrUndefined = exports.isUndefined = exports.isNull = void 0;
3
+ exports.isLinux = exports.isWindows = exports.isMacOS = exports.getOS = exports.throttle = exports.debounce = exports.convertUint8ArrayToNumber = exports.safelyParse = exports.isNullOrUndefined = exports.isUndefined = exports.isNull = void 0;
4
4
  function isNull(val) {
5
5
  return val === null;
6
6
  }
@@ -131,3 +131,39 @@ function throttle(func, wait, options = {}) {
131
131
  };
132
132
  }
133
133
  exports.throttle = throttle;
134
+ function getOS() {
135
+ var _a, _b;
136
+ let os = '';
137
+ if (process && process.platform) {
138
+ os = process.platform;
139
+ }
140
+ else {
141
+ // @ts-ignore
142
+ const platform = ((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgentData) === null || _b === void 0 ? void 0 : _b.platform) || window.navigator.platform;
143
+ const macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K', 'macOS'];
144
+ const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
145
+ if (macosPlatforms.indexOf(platform) !== -1) {
146
+ os = 'darwin';
147
+ }
148
+ else if (windowsPlatforms.indexOf(platform) !== -1) {
149
+ os = 'win32';
150
+ }
151
+ else if (/Linux/.test(platform)) {
152
+ os = 'linux';
153
+ }
154
+ }
155
+ return os;
156
+ }
157
+ exports.getOS = getOS;
158
+ function isMacOS() {
159
+ return getOS() === 'darwin';
160
+ }
161
+ exports.isMacOS = isMacOS;
162
+ function isWindows() {
163
+ return getOS() === 'win32';
164
+ }
165
+ exports.isWindows = isWindows;
166
+ function isLinux() {
167
+ return getOS() === 'linux';
168
+ }
169
+ exports.isLinux = isLinux;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "13.0.709-alpha.0",
3
+ "version": "13.0.709-beta.1",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",
@@ -2,8 +2,6 @@ const path = require("path");
2
2
  const fs = require("fs");
3
3
  const { removeSync, copySync } = require("fs-extra");
4
4
  const signale = require('signale');
5
- const { arch } = process;
6
- const { exec } = require('child_process');
7
5
 
8
6
  // npm run copy:sdk
9
7
  const SDK_ROOT = path.resolve(__dirname, "../../");
@@ -66,16 +64,6 @@ if (process.platform === "win32") {
66
64
  path.resolve(SDK_CPP_PATH, `src/remote-liteav/out/Release-macos/${process.arch}/liblive_kit_engine.dylib`),
67
65
  path.resolve(SDK_JS_PATH, `build/mac-framework/${process.arch}/liblive_kit_engine.dylib`)
68
66
  );
69
-
70
- sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
71
- targetPath = path.join(__dirname, '../../../samples/trtc-electron-test-demo/node_modules/electron/dist/Electron.app/Contents/Frameworks');
72
- if (fs.existsSync(sourcePath) && fs.existsSync(targetPath)) {
73
- const command = `rsync -a ${sourcePath} ${targetPath}`;
74
- signale.log(command);
75
- exec(command);
76
- } else {
77
- signale.warn('sourcePath or targetPath is not exist');
78
- }
79
67
  } else {
80
68
  // linux
81
69
  let soPrefix = ""
@@ -9,21 +9,13 @@ const maxRetryCount = 60;
9
9
 
10
10
  function rsync() {
11
11
  if (platform === 'darwin') {
12
+ const sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
13
+ const targetPath = path.join(__dirname, '../../electron/dist/Electron.app/Contents/Frameworks');
12
14
 
13
- const currentPath = process.cwd();
14
- const pathFlagValue = `packages${
15
- process.platform === "win32" ? "\\" : "/"
16
- }trtc-electron-sdk`;
17
- const isLocal = currentPath.indexOf(pathFlagValue) !== -1;
18
-
19
- let sourcePath = '';
20
- let targetPath = '';
21
- if(isLocal) {
22
- sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
23
- targetPath = path.join(__dirname, '../../../samples/trtc-electron-test-demo/node_modules/electron/dist/Electron.app/Contents/Frameworks');
24
- } else {
25
- sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
26
- targetPath = path.join(__dirname, '../../electron/dist/Electron.app/Contents/Frameworks');
15
+ if (targetPath.indexOf("node_modules") === -1) {
16
+ // SDK 本身安装,不用同步动态库,直接退出
17
+ console.warn(`trtc-electron-sdk self install do not need 'rsync'`);
18
+ return;
27
19
  }
28
20
 
29
21
  retryCount++;