trtc-electron-sdk 12.9.708-beta.0 → 13.0.709-alpha.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.
- package/liteav/MediaMixingDesigner/Resizable.js +0 -1
- package/liteav/MediaMixingDesigner/index.js +0 -22
- package/liteav/extensions/DeviceManager/index.js +4 -0
- package/liteav/extensions/MediaMixingManager/MediaMixingManager.js +39 -35
- package/liteav/trtc.js +2 -1
- package/liteav/utils.d.ts +4 -0
- package/liteav/utils.js +37 -1
- package/package.json +1 -1
- package/scripts/copy-sdk.js +8 -0
|
@@ -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;
|
|
@@ -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,18 +402,15 @@ 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
408
|
// calc click point coordinates in mix video image
|
|
420
|
-
logger_1.default.log(`${this.logPrefix}onContainerMousedown mix video image clicked`);
|
|
421
409
|
const containerBounds = this.container.getBoundingClientRect();
|
|
422
410
|
const xInPreviewImage = event.clientX - containerBounds.left - this.absoluteWorkingArea.left - this.previewLeft;
|
|
423
411
|
const yInPreviewImage = event.clientY - containerBounds.top - this.absoluteWorkingArea.top - this.previewTop;
|
|
424
412
|
const xInImage = xInPreviewImage / this.previewScale;
|
|
425
413
|
const yInImage = yInPreviewImage / this.previewScale;
|
|
426
|
-
logger_1.default.log(`${this.logPrefix}onContainerMousedown click point coordinates in mix video:`, xInPreviewImage, yInPreviewImage, xInImage, yInImage);
|
|
427
414
|
for (let i = 0; i < this.mediaList.length; i++) {
|
|
428
415
|
const item = this.mediaList[i];
|
|
429
416
|
if (item.rect &&
|
|
@@ -445,7 +432,6 @@ class TRTCMediaMixingDesigner {
|
|
|
445
432
|
if (this.eventButton === 2 && this.oldSelectedIndex === -1) {
|
|
446
433
|
// select first media source
|
|
447
434
|
this.newSelected = this.clickedMediaSources[0];
|
|
448
|
-
logger_1.default.log(`${this.logPrefix}onContainerMousedown find clicked media source:`, this.newSelected);
|
|
449
435
|
// mediaSourcesStore.setSelectedMediaKey(newSelected);
|
|
450
436
|
this.emitOnSelect(this.newSelected);
|
|
451
437
|
this.clickedMediaSources.splice(0, this.clickedMediaSources.length);
|
|
@@ -457,7 +443,6 @@ class TRTCMediaMixingDesigner {
|
|
|
457
443
|
}
|
|
458
444
|
else {
|
|
459
445
|
this.newSelected = null;
|
|
460
|
-
logger_1.default.log(`${this.logPrefix}onContainerMousedown find clicked media source:`, this.newSelected);
|
|
461
446
|
this.emitOnSelect(null);
|
|
462
447
|
this.mousedownLeft = null;
|
|
463
448
|
this.mousedownTop = null;
|
|
@@ -475,14 +460,12 @@ class TRTCMediaMixingDesigner {
|
|
|
475
460
|
if (Math.abs(leftMovedDistance) >= MIN_MOVE_DISTANCE || Math.abs(topMovedDistance) >= MIN_MOVE_DISTANCE) {
|
|
476
461
|
if (this.oldSelectedIndex >= 0) {
|
|
477
462
|
// 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
463
|
this.clickedMediaSources.splice(0, this.clickedMediaSources.length);
|
|
480
464
|
this.oldSelectedIndex = -1;
|
|
481
465
|
}
|
|
482
466
|
else if (this.clickedMediaSources.length > 0) {
|
|
483
467
|
// select first media source
|
|
484
468
|
this.newSelected = this.clickedMediaSources[0];
|
|
485
|
-
logger_1.default.log(`${this.logPrefix}onContainerMousemove find clicked media source:`, this.newSelected);
|
|
486
469
|
this.emitOnSelect(this.newSelected);
|
|
487
470
|
this.clickedMediaSources.splice(0, this.clickedMediaSources.length);
|
|
488
471
|
// 支持 mousedown 选中媒体源和 mousemove 移动媒体源同时触发
|
|
@@ -499,7 +482,6 @@ class TRTCMediaMixingDesigner {
|
|
|
499
482
|
onContainerMouseup(event) {
|
|
500
483
|
document.removeEventListener("mousemove", this.onContainerMousemove, false);
|
|
501
484
|
document.removeEventListener("mouseup", this.onContainerMouseup, false);
|
|
502
|
-
logger_1.default.log(`${this.logPrefix}onContainerMouseup data:`, this.clickedMediaSources, this.oldSelectedIndex);
|
|
503
485
|
const target = event.target;
|
|
504
486
|
if (target && this.container) {
|
|
505
487
|
if (this.clickedMediaSources.length > 0) {
|
|
@@ -508,7 +490,6 @@ class TRTCMediaMixingDesigner {
|
|
|
508
490
|
// select next zOrder media source
|
|
509
491
|
const newSelectedIndex = (this.oldSelectedIndex + 1) % this.clickedMediaSources.length;
|
|
510
492
|
this.newSelected = this.clickedMediaSources[newSelectedIndex];
|
|
511
|
-
logger_1.default.log(`${this.logPrefix}onContainerMouseup find clicked media source:`, this.newSelected);
|
|
512
493
|
this.emitOnSelect(this.newSelected);
|
|
513
494
|
}
|
|
514
495
|
else {
|
|
@@ -519,7 +500,6 @@ class TRTCMediaMixingDesigner {
|
|
|
519
500
|
else {
|
|
520
501
|
// select first media source
|
|
521
502
|
this.newSelected = this.clickedMediaSources[0];
|
|
522
|
-
logger_1.default.log(`${this.logPrefix}onContainerMouseup find clicked media source:`, this.newSelected);
|
|
523
503
|
this.emitOnSelect(this.newSelected);
|
|
524
504
|
}
|
|
525
505
|
}
|
|
@@ -529,7 +509,6 @@ class TRTCMediaMixingDesigner {
|
|
|
529
509
|
}
|
|
530
510
|
else {
|
|
531
511
|
// un-select current media source
|
|
532
|
-
logger_1.default.log(`${this.logPrefix}onContainerMouseup click outside of mixing video image`);
|
|
533
512
|
this.emitOnSelect(null);
|
|
534
513
|
}
|
|
535
514
|
this.mousedownLeft = null;
|
|
@@ -541,7 +520,6 @@ class TRTCMediaMixingDesigner {
|
|
|
541
520
|
}
|
|
542
521
|
onRightButtonClicked(event) {
|
|
543
522
|
var _a;
|
|
544
|
-
logger_1.default.log(`${this.logPrefix}onRightButtonClicked:`, event.target, event.currentTarget, event.buttons);
|
|
545
523
|
event.preventDefault();
|
|
546
524
|
(_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit('onRightButtonClicked', Object.assign({}, this.mediaList[this.selectedMediaIndex]), {
|
|
547
525
|
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--) {
|
|
@@ -320,7 +320,7 @@ class TRTCMediaMixingManager {
|
|
|
320
320
|
mirrorType: trtc_define_1.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto,
|
|
321
321
|
};
|
|
322
322
|
if (this.autoControlServer) {
|
|
323
|
-
this.startMediaMixingServer()
|
|
323
|
+
this.startMediaMixingServer('', TRTCMediaMixingServerMode.Embedded)
|
|
324
324
|
.then(() => {
|
|
325
325
|
logger_1.default.info(`${this.logPrefix}startMediaMixingServer success.`);
|
|
326
326
|
})
|
|
@@ -494,7 +494,7 @@ class TRTCMediaMixingManager {
|
|
|
494
494
|
else {
|
|
495
495
|
realWindowID = windowID;
|
|
496
496
|
}
|
|
497
|
-
this.windowID = realWindowID;
|
|
497
|
+
this.windowID = (0, utils_1.isWindows)() ? realWindowID : 0;
|
|
498
498
|
if (this.windowID !== 0 && viewOrRegion !== null) {
|
|
499
499
|
yield this.previewInNativeWindow(viewOrRegion);
|
|
500
500
|
}
|
|
@@ -512,34 +512,36 @@ class TRTCMediaMixingManager {
|
|
|
512
512
|
* @returns {Promise<void>}
|
|
513
513
|
*/
|
|
514
514
|
addMediaSource(mediaSource) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const newMediaSource = (0, utils_1.safelyParse)(JSON.stringify(mediaSource));
|
|
524
|
-
if (newMediaSource.isSelected) {
|
|
525
|
-
const oldSelectedIndex = this.findSelectedMediaSource();
|
|
526
|
-
if (oldSelectedIndex !== -1) {
|
|
527
|
-
this.unselectMediaSource(oldSelectedIndex);
|
|
515
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
516
|
+
logger_1.default.log(`${this.logPrefix}addMediaSource:`, mediaSource);
|
|
517
|
+
const index = this.findMediaSourceIndex(mediaSource);
|
|
518
|
+
if (index !== -1) {
|
|
519
|
+
return Promise.reject({
|
|
520
|
+
code: types_1.TRTCMediaMixingErrorCode.InvalidParams,
|
|
521
|
+
message: "Media source already existed"
|
|
522
|
+
});
|
|
528
523
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
524
|
+
const newMediaSource = (0, utils_1.safelyParse)(JSON.stringify(mediaSource));
|
|
525
|
+
if (newMediaSource.isSelected) {
|
|
526
|
+
const oldSelectedIndex = this.findSelectedMediaSource();
|
|
527
|
+
if (oldSelectedIndex !== -1) {
|
|
528
|
+
yield this.unselectMediaSource(oldSelectedIndex);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return new Promise((resolve, reject) => {
|
|
532
|
+
var _a;
|
|
533
|
+
const key = `${promiseKeys.addMediaSource}-${newMediaSource.sourceType}-${newMediaSource.sourceId}`;
|
|
534
|
+
this.promiseStore.addPromise(key, resolve, reject);
|
|
535
|
+
this.nodeMediaMixingPlugin.addMediaSource(newMediaSource);
|
|
536
|
+
(_a = this.mediaMixingDesigner) === null || _a === void 0 ? void 0 : _a.addMedia({
|
|
537
|
+
id: `${newMediaSource.sourceType}__${newMediaSource.sourceId}`,
|
|
538
|
+
rect: newMediaSource.rect,
|
|
539
|
+
isSelected: newMediaSource.isSelected || false,
|
|
540
|
+
zOrder: newMediaSource.zOrder,
|
|
541
|
+
origin: newMediaSource
|
|
542
|
+
});
|
|
543
|
+
this.sourceList.push(newMediaSource);
|
|
541
544
|
});
|
|
542
|
-
this.sourceList.push(newMediaSource);
|
|
543
545
|
});
|
|
544
546
|
}
|
|
545
547
|
/**
|
|
@@ -612,7 +614,7 @@ class TRTCMediaMixingManager {
|
|
|
612
614
|
if (mediaSource.isSelected) {
|
|
613
615
|
const oldSelectedIndex = this.findSelectedMediaSource();
|
|
614
616
|
if (oldSelectedIndex !== -1 && oldSelectedIndex !== index) {
|
|
615
|
-
this.unselectMediaSource(oldSelectedIndex);
|
|
617
|
+
yield this.unselectMediaSource(oldSelectedIndex);
|
|
616
618
|
}
|
|
617
619
|
}
|
|
618
620
|
yield this.nodeMediaMixingPlugin.updateMediaSource(newMediaSource);
|
|
@@ -1468,7 +1470,6 @@ class TRTCMediaMixingManager {
|
|
|
1468
1470
|
else {
|
|
1469
1471
|
// neither native window nor web element, stop preview
|
|
1470
1472
|
this.previewInNone();
|
|
1471
|
-
this.destroyWebRenderer();
|
|
1472
1473
|
}
|
|
1473
1474
|
});
|
|
1474
1475
|
}
|
|
@@ -1476,6 +1477,7 @@ class TRTCMediaMixingManager {
|
|
|
1476
1477
|
this.destroyResizeObserver();
|
|
1477
1478
|
this.destroyLayoutManager();
|
|
1478
1479
|
this.destroyDesigner();
|
|
1480
|
+
this.destroyWebRenderer();
|
|
1479
1481
|
this.view = null;
|
|
1480
1482
|
this.nodeMediaMixingPlugin.setDisplayParams(this.windowID, { left: 0, right: 0, top: 0, bottom: 0 });
|
|
1481
1483
|
}
|
|
@@ -1531,11 +1533,13 @@ class TRTCMediaMixingManager {
|
|
|
1531
1533
|
this.nodeMediaMixingPlugin.setVideoFrameRenderBuffer(this.videoRenderBuffer.userId, this.videoRenderBuffer.buffer, this.videoRenderBuffer.streamType, this.videoRenderBuffer.width, this.videoRenderBuffer.height, this.videoRenderBuffer.pixelFormat, this.videoRenderBuffer.id);
|
|
1532
1534
|
}
|
|
1533
1535
|
destroyWebRendererBuffer() {
|
|
1534
|
-
this.videoRenderBuffer.
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1536
|
+
if (this.videoRenderBuffer.buffer !== null || this.videoRenderBuffer.id !== 0) {
|
|
1537
|
+
this.videoRenderBuffer.width = 0;
|
|
1538
|
+
this.videoRenderBuffer.height = 0;
|
|
1539
|
+
this.nodeMediaMixingPlugin.setVideoFrameRenderBuffer(this.videoRenderBuffer.userId, this.videoRenderBuffer.buffer, this.videoRenderBuffer.streamType, this.videoRenderBuffer.width, this.videoRenderBuffer.height, this.videoRenderBuffer.pixelFormat, this.videoRenderBuffer.id);
|
|
1540
|
+
this.videoRenderBuffer.buffer = null;
|
|
1541
|
+
this.videoRenderBuffer.id = 0;
|
|
1542
|
+
}
|
|
1539
1543
|
}
|
|
1540
1544
|
webRendererCallback(args) {
|
|
1541
1545
|
const [id, type, width, height, timestamp, rotation, valid, bufferId] = args;
|
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"));
|
|
@@ -5276,7 +5277,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
5276
5277
|
return rgbaData;
|
|
5277
5278
|
}
|
|
5278
5279
|
_isMacPlatform() {
|
|
5279
|
-
return
|
|
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
package/scripts/copy-sdk.js
CHANGED
|
@@ -56,6 +56,14 @@ if (process.platform === "win32") {
|
|
|
56
56
|
path.resolve(SDK_CPP_PATH, `src/remote-liteav/sdk/mac/Frameworks/${process.arch}/TXSoundTouch.framework`),
|
|
57
57
|
path.resolve(SDK_JS_PATH, `build/mac-framework/${process.arch}/TXSoundTouch.framework`)
|
|
58
58
|
);
|
|
59
|
+
copySync(
|
|
60
|
+
path.resolve(SDK_CPP_PATH, `src/remote-liteav/sdk/mac/Frameworks/${process.arch}/TXLiteAVSDK_TRTC_Mac.framework`),
|
|
61
|
+
path.resolve(SDK_JS_PATH, `build/mac-framework/${process.arch}/TXLiteAVSDK_TRTC_Mac.framework`)
|
|
62
|
+
);
|
|
63
|
+
copySync(
|
|
64
|
+
path.resolve(SDK_CPP_PATH, `src/remote-liteav/out/Release-macos/${process.arch}/liblive_kit_engine.dylib`),
|
|
65
|
+
path.resolve(SDK_JS_PATH, `build/mac-framework/${process.arch}/liblive_kit_engine.dylib`)
|
|
66
|
+
);
|
|
59
67
|
} else {
|
|
60
68
|
// linux
|
|
61
69
|
let soPrefix = ""
|