trtc-electron-sdk 13.3.801 → 13.3.802-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/liteav/extensions/MediaMixingManager/MediaMixingManager.d.ts +68 -0
- package/liteav/extensions/MediaMixingManager/MediaMixingManager.js +145 -0
- package/liteav/extensions/MediaMixingManager/types.d.ts +11 -10
- package/liteav/vod_player.d.ts +0 -1
- package/liteav/vod_player.js +9 -37
- package/package.json +1 -1
|
@@ -95,6 +95,13 @@ export declare enum TRTCMediaMixingEvent {
|
|
|
95
95
|
* @param {Number} size.height 媒体源最新高度
|
|
96
96
|
*/
|
|
97
97
|
onMediaSourceSizeChanged = "onMediaSourceSizeChanged",
|
|
98
|
+
/**
|
|
99
|
+
* @description 本地混流服务丢失事件
|
|
100
|
+
* @deprecated
|
|
101
|
+
* @private
|
|
102
|
+
*
|
|
103
|
+
* @event TRTCMediaMixingEvent#onMediaMixingServerLost
|
|
104
|
+
*/
|
|
98
105
|
onMediaMixingServerLost = "onMediaMixingServerLost"
|
|
99
106
|
}
|
|
100
107
|
declare enum TRTCMediaMixingServerMode {
|
|
@@ -264,12 +271,15 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
264
271
|
*/
|
|
265
272
|
updateMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
266
273
|
/**
|
|
274
|
+
* @deprecated
|
|
275
|
+
*
|
|
267
276
|
* 设置摄像头采集参数
|
|
268
277
|
* @param cameraID {string} - 摄像头 ID
|
|
269
278
|
* @param params {TRTCCameraCaptureParams} - 摄像头采集参数
|
|
270
279
|
*/
|
|
271
280
|
setCameraCaptureParam(cameraID: string, params: TRTCCameraCaptureParams): void;
|
|
272
281
|
/**
|
|
282
|
+
* @deprecated
|
|
273
283
|
* 设置手机投屏参数
|
|
274
284
|
* @private
|
|
275
285
|
* @param phoneMirrorSourceId {string} - 手机投屏媒体源 ID
|
|
@@ -277,18 +287,24 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
277
287
|
*/
|
|
278
288
|
setPhoneMirrorParam(phoneMirrorSourceId: string, param: TRTCPhoneMirrorParam): void;
|
|
279
289
|
/**
|
|
290
|
+
* @deprecated
|
|
291
|
+
*
|
|
280
292
|
* 设置屏幕采集参数
|
|
281
293
|
* @param screenOrWindowID {String} - 屏幕 ID 或 窗口 ID
|
|
282
294
|
* @param property {TRTCScreenCaptureProperty} - 屏幕采集属性
|
|
283
295
|
*/
|
|
284
296
|
setScreenCaptureProperty(screenOrWindowID: string, property: TRTCScreenCaptureProperty): void;
|
|
285
297
|
/**
|
|
298
|
+
* @deprecated
|
|
299
|
+
*
|
|
286
300
|
* 设置在线视频源播放参数
|
|
287
301
|
* @param url {string} - 在线视频源 URL
|
|
288
302
|
* @param param {TRTCOnlineVideoParam} - 在线视频源播放参数
|
|
289
303
|
*/
|
|
290
304
|
setOnlineVideoParam(url: string, param: TRTCOnlineVideoParam): void;
|
|
291
305
|
/**
|
|
306
|
+
* @deprecated
|
|
307
|
+
*
|
|
292
308
|
* 设置视频文件播放参数
|
|
293
309
|
* @param videoFilePath {string} - 视频文件路径
|
|
294
310
|
* @param param {TRTCVideoFileParam} - 视频文件播放参数
|
|
@@ -458,6 +474,58 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
458
474
|
private onCallExperimentalAPIFinish;
|
|
459
475
|
private recoverMediaMixingServer;
|
|
460
476
|
private onDevicePixelRatioChange;
|
|
477
|
+
/**
|
|
478
|
+
* @private
|
|
479
|
+
* Apply camera capture params BEFORE native addMediaSource.
|
|
480
|
+
*
|
|
481
|
+
* Calling setCameraCaptureParam after the camera has already been added
|
|
482
|
+
* triggers an extra camera restart (the camera first starts with default
|
|
483
|
+
* params and then restarts with the new ones). To avoid this we set
|
|
484
|
+
* camera params up-front for the add path. For all other source types
|
|
485
|
+
* the corresponding setters are dispatched in the post-add callback
|
|
486
|
+
* (`onMediaSourceAdded` -> `_applyMediaSourceParams`).
|
|
487
|
+
*/
|
|
488
|
+
private _applyCameraParamsBeforeAdd;
|
|
489
|
+
/**
|
|
490
|
+
* @private
|
|
491
|
+
* Apply capture params from TRTCMediaSource to the native plugin.
|
|
492
|
+
*
|
|
493
|
+
* This method is called after media source is added or updated. To avoid
|
|
494
|
+
* costly side-effects of native setters (e.g. setCameraCaptureParam will
|
|
495
|
+
* restart the camera), the setter is invoked only when params are actually
|
|
496
|
+
* provided AND differ from the previous value carried by `oldMediaSource`.
|
|
497
|
+
*
|
|
498
|
+
* Camera handling differs by phase:
|
|
499
|
+
* - Add path (oldMediaSource is undefined): camera params have been set
|
|
500
|
+
* before native addMediaSource via `_applyCameraParamsBeforeAdd`, so
|
|
501
|
+
* this method skips kCamera to avoid duplicate setter invocation.
|
|
502
|
+
* - Update path (oldMediaSource is provided): kCamera goes through the
|
|
503
|
+
* same diff check as other types and is dispatched only when changed.
|
|
504
|
+
*
|
|
505
|
+
* @param mediaSource - The new media source carrying capture params.
|
|
506
|
+
* @param oldMediaSource - The previous media source (omit for the add path
|
|
507
|
+
* where no previous params exist; in that case the
|
|
508
|
+
* setter is always invoked when params are present).
|
|
509
|
+
*/
|
|
510
|
+
private _applyMediaSourceParams;
|
|
511
|
+
/**
|
|
512
|
+
* @private
|
|
513
|
+
* Shallow-but-stable equality check on capture param objects via JSON.
|
|
514
|
+
*
|
|
515
|
+
* Returns true when both sides represent the "same" params, false otherwise.
|
|
516
|
+
* Semantics:
|
|
517
|
+
* - both empty (undefined / null) → true (no change requested)
|
|
518
|
+
* - exactly one side empty → false (first-time apply or transition)
|
|
519
|
+
* - both non-empty → byte-equal after JSON.stringify
|
|
520
|
+
*
|
|
521
|
+
* Note: JSON.stringify is sensitive to key ordering. Capture param objects
|
|
522
|
+
* carried by `TRTCMediaSource` are constructed by the SDK via
|
|
523
|
+
* `JSON.parse(JSON.stringify(...))` flow, so key order is stable in
|
|
524
|
+
* practice; for caller-supplied literal objects with unstable key order,
|
|
525
|
+
* the comparison may yield a false-negative and trigger an unnecessary
|
|
526
|
+
* setter call.
|
|
527
|
+
*/
|
|
528
|
+
private _isSameCaptureParams;
|
|
461
529
|
private previewInNativeWindow;
|
|
462
530
|
private previewInWebElement;
|
|
463
531
|
private previewInNone;
|
|
@@ -258,6 +258,13 @@ var TRTCMediaMixingEvent;
|
|
|
258
258
|
* @param {Number} size.height 媒体源最新高度
|
|
259
259
|
*/
|
|
260
260
|
TRTCMediaMixingEvent["onMediaSourceSizeChanged"] = "onMediaSourceSizeChanged";
|
|
261
|
+
/**
|
|
262
|
+
* @description 本地混流服务丢失事件
|
|
263
|
+
* @deprecated
|
|
264
|
+
* @private
|
|
265
|
+
*
|
|
266
|
+
* @event TRTCMediaMixingEvent#onMediaMixingServerLost
|
|
267
|
+
*/
|
|
261
268
|
TRTCMediaMixingEvent["onMediaMixingServerLost"] = "onMediaMixingServerLost";
|
|
262
269
|
})(TRTCMediaMixingEvent = exports.TRTCMediaMixingEvent || (exports.TRTCMediaMixingEvent = {}));
|
|
263
270
|
const promiseKeys = {
|
|
@@ -598,6 +605,10 @@ class TRTCMediaMixingManager {
|
|
|
598
605
|
}
|
|
599
606
|
}, timeoutMs);
|
|
600
607
|
this.addMediaSourceTimers.set(key, timer);
|
|
608
|
+
// Apply camera capture params BEFORE native addMediaSource to avoid an
|
|
609
|
+
// extra camera restart on first add. Other source types are handled in
|
|
610
|
+
// the onMediaSourceAdded callback once the C++ layer reports success.
|
|
611
|
+
this._applyCameraParamsBeforeAdd(newMediaSource);
|
|
601
612
|
this.nodeMediaMixingPlugin.addMediaSource(newMediaSource);
|
|
602
613
|
(_a = this.mediaMixingDesigner) === null || _a === void 0 ? void 0 : _a.addMedia({
|
|
603
614
|
id: `${newMediaSource.sourceType}__${newMediaSource.sourceId}`,
|
|
@@ -701,6 +712,7 @@ class TRTCMediaMixingManager {
|
|
|
701
712
|
}
|
|
702
713
|
}
|
|
703
714
|
yield this.nodeMediaMixingPlugin.updateMediaSource(newMediaSource);
|
|
715
|
+
this._applyMediaSourceParams(newMediaSource, this.sourceList[index]);
|
|
704
716
|
(_a = this.mediaMixingDesigner) === null || _a === void 0 ? void 0 : _a.updateMedia({
|
|
705
717
|
id: `${mediaSource.sourceType}__${mediaSource.sourceId}`,
|
|
706
718
|
rect: mediaSource.rect,
|
|
@@ -712,6 +724,8 @@ class TRTCMediaMixingManager {
|
|
|
712
724
|
});
|
|
713
725
|
}
|
|
714
726
|
/**
|
|
727
|
+
* @deprecated
|
|
728
|
+
*
|
|
715
729
|
* 设置摄像头采集参数
|
|
716
730
|
* @param cameraID {string} - 摄像头 ID
|
|
717
731
|
* @param params {TRTCCameraCaptureParams} - 摄像头采集参数
|
|
@@ -730,6 +744,7 @@ class TRTCMediaMixingManager {
|
|
|
730
744
|
}
|
|
731
745
|
}
|
|
732
746
|
/**
|
|
747
|
+
* @deprecated
|
|
733
748
|
* 设置手机投屏参数
|
|
734
749
|
* @private
|
|
735
750
|
* @param phoneMirrorSourceId {string} - 手机投屏媒体源 ID
|
|
@@ -739,6 +754,8 @@ class TRTCMediaMixingManager {
|
|
|
739
754
|
this.nodeMediaMixingPlugin.setPhoneMirrorParam(phoneMirrorSourceId, param);
|
|
740
755
|
}
|
|
741
756
|
/**
|
|
757
|
+
* @deprecated
|
|
758
|
+
*
|
|
742
759
|
* 设置屏幕采集参数
|
|
743
760
|
* @param screenOrWindowID {String} - 屏幕 ID 或 窗口 ID
|
|
744
761
|
* @param property {TRTCScreenCaptureProperty} - 屏幕采集属性
|
|
@@ -747,6 +764,8 @@ class TRTCMediaMixingManager {
|
|
|
747
764
|
this.nodeMediaMixingPlugin.setScreenCaptureProperty(screenOrWindowID, property);
|
|
748
765
|
}
|
|
749
766
|
/**
|
|
767
|
+
* @deprecated
|
|
768
|
+
*
|
|
750
769
|
* 设置在线视频源播放参数
|
|
751
770
|
* @param url {string} - 在线视频源 URL
|
|
752
771
|
* @param param {TRTCOnlineVideoParam} - 在线视频源播放参数
|
|
@@ -755,6 +774,8 @@ class TRTCMediaMixingManager {
|
|
|
755
774
|
this.nodeMediaMixingPlugin.setOnlineVideoParam(url, param);
|
|
756
775
|
}
|
|
757
776
|
/**
|
|
777
|
+
* @deprecated
|
|
778
|
+
*
|
|
758
779
|
* 设置视频文件播放参数
|
|
759
780
|
* @param videoFilePath {string} - 视频文件路径
|
|
760
781
|
* @param param {TRTCVideoFileParam} - 视频文件播放参数
|
|
@@ -1294,6 +1315,13 @@ class TRTCMediaMixingManager {
|
|
|
1294
1315
|
}
|
|
1295
1316
|
let flag = false;
|
|
1296
1317
|
if (data.errCode === 0) {
|
|
1318
|
+
const addedIndex = this.findMediaSourceIndex({
|
|
1319
|
+
sourceId: data.sourceId,
|
|
1320
|
+
sourceType: data.sourceType,
|
|
1321
|
+
});
|
|
1322
|
+
if (addedIndex !== -1) {
|
|
1323
|
+
this._applyMediaSourceParams(this.sourceList[addedIndex]);
|
|
1324
|
+
}
|
|
1297
1325
|
flag = this.promiseStore.resolvePromise(promiseKey, undefined);
|
|
1298
1326
|
}
|
|
1299
1327
|
else {
|
|
@@ -1456,6 +1484,7 @@ class TRTCMediaMixingManager {
|
|
|
1456
1484
|
this.setStreamLayout(this.paramsStore.streamLayout);
|
|
1457
1485
|
}
|
|
1458
1486
|
this.sourceList.forEach((item) => {
|
|
1487
|
+
this._applyCameraParamsBeforeAdd(item);
|
|
1459
1488
|
this.nodeMediaMixingPlugin.addMediaSource(item);
|
|
1460
1489
|
});
|
|
1461
1490
|
if (((_b = this.trtcParamsStore) === null || _b === void 0 ? void 0 : _b.enterRoomParams) && ((_c = this.trtcParamsStore) === null || _c === void 0 ? void 0 : _c.enterRoomScene)) {
|
|
@@ -1497,7 +1526,108 @@ class TRTCMediaMixingManager {
|
|
|
1497
1526
|
logger_1.default.debug(`${this.logPrefix}onDevicePixelRatioChange:`, window.devicePixelRatio);
|
|
1498
1527
|
this.setDisplayRect();
|
|
1499
1528
|
}
|
|
1529
|
+
/**
|
|
1530
|
+
* @private
|
|
1531
|
+
* Apply camera capture params BEFORE native addMediaSource.
|
|
1532
|
+
*
|
|
1533
|
+
* Calling setCameraCaptureParam after the camera has already been added
|
|
1534
|
+
* triggers an extra camera restart (the camera first starts with default
|
|
1535
|
+
* params and then restarts with the new ones). To avoid this we set
|
|
1536
|
+
* camera params up-front for the add path. For all other source types
|
|
1537
|
+
* the corresponding setters are dispatched in the post-add callback
|
|
1538
|
+
* (`onMediaSourceAdded` -> `_applyMediaSourceParams`).
|
|
1539
|
+
*/
|
|
1540
|
+
_applyCameraParamsBeforeAdd(mediaSource) {
|
|
1541
|
+
if (mediaSource.sourceType === types_1.TRTCMediaSourceType.kCamera && mediaSource.camera) {
|
|
1542
|
+
this.setCameraCaptureParam(mediaSource.sourceId, mediaSource.camera);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* @private
|
|
1547
|
+
* Apply capture params from TRTCMediaSource to the native plugin.
|
|
1548
|
+
*
|
|
1549
|
+
* This method is called after media source is added or updated. To avoid
|
|
1550
|
+
* costly side-effects of native setters (e.g. setCameraCaptureParam will
|
|
1551
|
+
* restart the camera), the setter is invoked only when params are actually
|
|
1552
|
+
* provided AND differ from the previous value carried by `oldMediaSource`.
|
|
1553
|
+
*
|
|
1554
|
+
* Camera handling differs by phase:
|
|
1555
|
+
* - Add path (oldMediaSource is undefined): camera params have been set
|
|
1556
|
+
* before native addMediaSource via `_applyCameraParamsBeforeAdd`, so
|
|
1557
|
+
* this method skips kCamera to avoid duplicate setter invocation.
|
|
1558
|
+
* - Update path (oldMediaSource is provided): kCamera goes through the
|
|
1559
|
+
* same diff check as other types and is dispatched only when changed.
|
|
1560
|
+
*
|
|
1561
|
+
* @param mediaSource - The new media source carrying capture params.
|
|
1562
|
+
* @param oldMediaSource - The previous media source (omit for the add path
|
|
1563
|
+
* where no previous params exist; in that case the
|
|
1564
|
+
* setter is always invoked when params are present).
|
|
1565
|
+
*/
|
|
1566
|
+
_applyMediaSourceParams(mediaSource, oldMediaSource) {
|
|
1567
|
+
switch (mediaSource.sourceType) {
|
|
1568
|
+
case types_1.TRTCMediaSourceType.kCamera:
|
|
1569
|
+
// Skip kCamera on the add path to avoid an extra camera restart;
|
|
1570
|
+
// it has been handled by `_applyCameraParamsBeforeAdd` already.
|
|
1571
|
+
if (oldMediaSource && mediaSource.camera && !this._isSameCaptureParams(mediaSource.camera, oldMediaSource.camera)) {
|
|
1572
|
+
this.setCameraCaptureParam(mediaSource.sourceId, mediaSource.camera);
|
|
1573
|
+
}
|
|
1574
|
+
break;
|
|
1575
|
+
case types_1.TRTCMediaSourceType.kScreen:
|
|
1576
|
+
if (mediaSource.screen && !this._isSameCaptureParams(mediaSource.screen, oldMediaSource === null || oldMediaSource === void 0 ? void 0 : oldMediaSource.screen)) {
|
|
1577
|
+
this.setScreenCaptureProperty(mediaSource.sourceId, mediaSource.screen);
|
|
1578
|
+
}
|
|
1579
|
+
break;
|
|
1580
|
+
case types_1.TRTCMediaSourceType.kOnlineVideo:
|
|
1581
|
+
if (mediaSource.onlineVideo && !this._isSameCaptureParams(mediaSource.onlineVideo, oldMediaSource === null || oldMediaSource === void 0 ? void 0 : oldMediaSource.onlineVideo)) {
|
|
1582
|
+
this.setOnlineVideoParam(mediaSource.sourceId, mediaSource.onlineVideo);
|
|
1583
|
+
}
|
|
1584
|
+
break;
|
|
1585
|
+
case types_1.TRTCMediaSourceType.kVideoFile:
|
|
1586
|
+
if (mediaSource.localVideo && !this._isSameCaptureParams(mediaSource.localVideo, oldMediaSource === null || oldMediaSource === void 0 ? void 0 : oldMediaSource.localVideo)) {
|
|
1587
|
+
this.setVideoFileParam(mediaSource.sourceId, mediaSource.localVideo);
|
|
1588
|
+
}
|
|
1589
|
+
break;
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* @private
|
|
1594
|
+
* Shallow-but-stable equality check on capture param objects via JSON.
|
|
1595
|
+
*
|
|
1596
|
+
* Returns true when both sides represent the "same" params, false otherwise.
|
|
1597
|
+
* Semantics:
|
|
1598
|
+
* - both empty (undefined / null) → true (no change requested)
|
|
1599
|
+
* - exactly one side empty → false (first-time apply or transition)
|
|
1600
|
+
* - both non-empty → byte-equal after JSON.stringify
|
|
1601
|
+
*
|
|
1602
|
+
* Note: JSON.stringify is sensitive to key ordering. Capture param objects
|
|
1603
|
+
* carried by `TRTCMediaSource` are constructed by the SDK via
|
|
1604
|
+
* `JSON.parse(JSON.stringify(...))` flow, so key order is stable in
|
|
1605
|
+
* practice; for caller-supplied literal objects with unstable key order,
|
|
1606
|
+
* the comparison may yield a false-negative and trigger an unnecessary
|
|
1607
|
+
* setter call.
|
|
1608
|
+
*/
|
|
1609
|
+
_isSameCaptureParams(next, prev) {
|
|
1610
|
+
if (next === prev) {
|
|
1611
|
+
return true;
|
|
1612
|
+
}
|
|
1613
|
+
const nextEmpty = next === undefined || next === null;
|
|
1614
|
+
const prevEmpty = prev === undefined || prev === null;
|
|
1615
|
+
if (nextEmpty && prevEmpty) {
|
|
1616
|
+
return true;
|
|
1617
|
+
}
|
|
1618
|
+
if (nextEmpty || prevEmpty) {
|
|
1619
|
+
return false;
|
|
1620
|
+
}
|
|
1621
|
+
try {
|
|
1622
|
+
return JSON.stringify(next) === JSON.stringify(prev);
|
|
1623
|
+
}
|
|
1624
|
+
catch (err) {
|
|
1625
|
+
logger_1.default.warn(`${this.logPrefix}_isSameCaptureParams: stringify failed, treat as different.`, err);
|
|
1626
|
+
return false;
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1500
1629
|
previewInNativeWindow(viewOrRegion) {
|
|
1630
|
+
var _a;
|
|
1501
1631
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1502
1632
|
if (this.serverMode === TRTCMediaMixingServerMode.Embedded && (this.serverStatus === TRTCMediaMixingServerStatus.Started || this.serverStatus === TRTCMediaMixingServerStatus.Starting)) {
|
|
1503
1633
|
try {
|
|
@@ -1530,9 +1660,15 @@ class TRTCMediaMixingManager {
|
|
|
1530
1660
|
this.destroyDesigner();
|
|
1531
1661
|
this.nodeMediaMixingPlugin.setDisplayParams(this.windowID, viewOrRegion);
|
|
1532
1662
|
}
|
|
1663
|
+
if (!((_a = this.paramsStore) === null || _a === void 0 ? void 0 : _a.streamLayout)) {
|
|
1664
|
+
this.setStreamLayout({
|
|
1665
|
+
layoutMode: types_1.TRTCStreamLayoutMode.None,
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1533
1668
|
});
|
|
1534
1669
|
}
|
|
1535
1670
|
previewInWebElement(viewOrRegion) {
|
|
1671
|
+
var _a;
|
|
1536
1672
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1537
1673
|
if (this.serverMode === TRTCMediaMixingServerMode.Independent && (this.serverStatus === TRTCMediaMixingServerStatus.Started || this.serverStatus === TRTCMediaMixingServerStatus.Starting)) {
|
|
1538
1674
|
try {
|
|
@@ -1559,6 +1695,11 @@ class TRTCMediaMixingManager {
|
|
|
1559
1695
|
this.createDesigner();
|
|
1560
1696
|
}
|
|
1561
1697
|
}
|
|
1698
|
+
if (!((_a = this.paramsStore) === null || _a === void 0 ? void 0 : _a.streamLayout)) {
|
|
1699
|
+
this.setStreamLayout({
|
|
1700
|
+
layoutMode: types_1.TRTCStreamLayoutMode.None,
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1562
1703
|
}
|
|
1563
1704
|
else {
|
|
1564
1705
|
// neither native window nor web element, stop preview
|
|
@@ -1567,12 +1708,16 @@ class TRTCMediaMixingManager {
|
|
|
1567
1708
|
});
|
|
1568
1709
|
}
|
|
1569
1710
|
previewInNone() {
|
|
1711
|
+
var _a;
|
|
1570
1712
|
this.destroyResizeObserver();
|
|
1571
1713
|
this.destroyLayoutManager();
|
|
1572
1714
|
this.destroyDesigner();
|
|
1573
1715
|
this.destroyWebRenderer();
|
|
1574
1716
|
this.view = null;
|
|
1575
1717
|
this.nodeMediaMixingPlugin.setDisplayParams(this.windowID, { left: 0, right: 0, top: 0, bottom: 0 });
|
|
1718
|
+
if ((_a = this.paramsStore) === null || _a === void 0 ? void 0 : _a.streamLayout) {
|
|
1719
|
+
this.paramsStore.streamLayout = null;
|
|
1720
|
+
}
|
|
1576
1721
|
}
|
|
1577
1722
|
createWebRenderer(view) {
|
|
1578
1723
|
if (this.view === view) {
|
|
@@ -39,6 +39,13 @@ export declare type TRTCPhoneMirrorParam = {
|
|
|
39
39
|
frameRate: number;
|
|
40
40
|
bitrateKbps: number;
|
|
41
41
|
};
|
|
42
|
+
export declare type TRTCOnlineVideoParam = {
|
|
43
|
+
networkCacheSizeKB: number;
|
|
44
|
+
playoutVolume: number;
|
|
45
|
+
};
|
|
46
|
+
export declare type TRTCVideoFileParam = {
|
|
47
|
+
playoutVolume: number;
|
|
48
|
+
};
|
|
42
49
|
export declare type TRTCMediaSource = {
|
|
43
50
|
sourceType: TRTCMediaSourceType;
|
|
44
51
|
sourceId: string;
|
|
@@ -49,6 +56,10 @@ export declare type TRTCMediaSource = {
|
|
|
49
56
|
rotation?: TRTCVideoRotation;
|
|
50
57
|
fillMode?: TRTCVideoFillMode;
|
|
51
58
|
mirrorType?: TRTCVideoMirrorType;
|
|
59
|
+
camera?: TRTCCameraCaptureParams;
|
|
60
|
+
screen?: TRTCScreenCaptureProperty;
|
|
61
|
+
localVideo?: TRTCVideoFileParam;
|
|
62
|
+
onlineVideo?: TRTCOnlineVideoParam;
|
|
52
63
|
};
|
|
53
64
|
export declare type TRTCMediaMixingEncParam = {
|
|
54
65
|
videoEncoderParams: TRTCVideoEncParam;
|
|
@@ -83,20 +94,10 @@ export declare type TRTCStreamLayout = {
|
|
|
83
94
|
};
|
|
84
95
|
streams?: Array<TRTCStreamInfo>;
|
|
85
96
|
};
|
|
86
|
-
export declare type TRTCOnlineVideoParam = {
|
|
87
|
-
networkCacheSizeKB: number;
|
|
88
|
-
playoutVolume: number;
|
|
89
|
-
};
|
|
90
|
-
export declare type TRTCVideoFileParam = {
|
|
91
|
-
playoutVolume: number;
|
|
92
|
-
};
|
|
93
97
|
export interface ITRTCMediaMixingManager {
|
|
94
98
|
addMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
95
99
|
removeMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
96
100
|
updateMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
97
|
-
setCameraCaptureParam(cameraID: string, param: TRTCCameraCaptureParams): void;
|
|
98
|
-
setPhoneMirrorParam(phoneMirrorSourceId: string, param: TRTCPhoneMirrorParam): void;
|
|
99
|
-
setScreenCaptureProperty(screenWindowID: string, property: TRTCScreenCaptureProperty): void;
|
|
100
101
|
startPublish(): Promise<void>;
|
|
101
102
|
stopPublish(): Promise<void>;
|
|
102
103
|
updatePublishParams(params: TRTCMediaMixingEncParam): Promise<void>;
|
package/liteav/vod_player.d.ts
CHANGED
package/liteav/vod_player.js
CHANGED
|
@@ -109,7 +109,6 @@ class TRTCVodPlayer {
|
|
|
109
109
|
this._dataRenderCallback = this._dataRenderCallback.bind(this);
|
|
110
110
|
this.nativeVodPlayer = new NodeTRTCEngine.NodeVodPlayer(mediaFilePath, repeat);
|
|
111
111
|
this.mediaFilePath = mediaFilePath;
|
|
112
|
-
this.isStarted = false;
|
|
113
112
|
this.isDestroyed = false;
|
|
114
113
|
this.isRenderPrepared = false;
|
|
115
114
|
this._setBufferRetryCount = 0;
|
|
@@ -232,10 +231,6 @@ class TRTCVodPlayer {
|
|
|
232
231
|
this.logger.warn('preload: player already destroyed');
|
|
233
232
|
return;
|
|
234
233
|
}
|
|
235
|
-
if (this.isStarted) {
|
|
236
|
-
this.logger.warn('preload: already started, ignored');
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
234
|
this.logger.info(`preload mediaFile: ${this.mediaFilePath}`);
|
|
240
235
|
this._prepareRender();
|
|
241
236
|
(_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.preload();
|
|
@@ -251,20 +246,16 @@ class TRTCVodPlayer {
|
|
|
251
246
|
* @note 可以先调用 {@link preload} 预加载完成后再调用 start,也可以跳过 preload 直接调用 start。
|
|
252
247
|
*/
|
|
253
248
|
start() {
|
|
254
|
-
var _a;
|
|
249
|
+
var _a, _b;
|
|
255
250
|
if (this.isDestroyed) {
|
|
256
251
|
this.logger.warn('start: player already destroyed');
|
|
257
252
|
return;
|
|
258
253
|
}
|
|
259
254
|
this.logger.info(`start mediaFile: ${this.mediaFilePath}`);
|
|
260
|
-
if (this.isStarted) {
|
|
261
|
-
this.logger.warn('start: already started, ignored');
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
255
|
this._prepareRender();
|
|
265
256
|
this.attachTRTC();
|
|
266
257
|
(_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.start();
|
|
267
|
-
this.
|
|
258
|
+
(_b = this.nativeVodPlayer) === null || _b === void 0 ? void 0 : _b.resume();
|
|
268
259
|
}
|
|
269
260
|
/**
|
|
270
261
|
* 停止播放
|
|
@@ -276,14 +267,8 @@ class TRTCVodPlayer {
|
|
|
276
267
|
return;
|
|
277
268
|
}
|
|
278
269
|
this.logger.info('stop');
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
if (this.isStarted) {
|
|
283
|
-
this.isStarted = false;
|
|
284
|
-
(_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.stop();
|
|
285
|
-
this.detachTRTC();
|
|
286
|
-
}
|
|
270
|
+
(_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.stop();
|
|
271
|
+
this.detachTRTC();
|
|
287
272
|
this._teardownRender();
|
|
288
273
|
}
|
|
289
274
|
/**
|
|
@@ -297,10 +282,6 @@ class TRTCVodPlayer {
|
|
|
297
282
|
this.logger.warn('pause: player already destroyed');
|
|
298
283
|
return;
|
|
299
284
|
}
|
|
300
|
-
if (!this.isStarted) {
|
|
301
|
-
this.logger.warn('pause: player not started, ignored');
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
285
|
this.logger.info('pause');
|
|
305
286
|
(_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.pause();
|
|
306
287
|
}
|
|
@@ -310,17 +291,14 @@ class TRTCVodPlayer {
|
|
|
310
291
|
* @note 仅在 {@link start} 之后调用才有效;未播放时调用会被忽略并打 warn 日志。
|
|
311
292
|
*/
|
|
312
293
|
resume() {
|
|
313
|
-
var _a;
|
|
294
|
+
var _a, _b;
|
|
314
295
|
if (this.isDestroyed) {
|
|
315
296
|
this.logger.warn('resume: player already destroyed');
|
|
316
297
|
return;
|
|
317
298
|
}
|
|
318
|
-
if (!this.isStarted) {
|
|
319
|
-
this.logger.warn('resume: player not started, ignored');
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
299
|
this.logger.info('resume');
|
|
323
|
-
(_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.
|
|
300
|
+
(_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.start();
|
|
301
|
+
(_b = this.nativeVodPlayer) === null || _b === void 0 ? void 0 : _b.resume();
|
|
324
302
|
}
|
|
325
303
|
/**
|
|
326
304
|
* 跳转到指定播放位置(seek)
|
|
@@ -335,7 +313,7 @@ class TRTCVodPlayer {
|
|
|
335
313
|
this.logger.warn('seek: player already destroyed');
|
|
336
314
|
return;
|
|
337
315
|
}
|
|
338
|
-
if (!this.
|
|
316
|
+
if (!this.isRenderPrepared) {
|
|
339
317
|
this.logger.warn(`seek: player not preloaded or started, ignored (msPos=${msPos})`);
|
|
340
318
|
return;
|
|
341
319
|
}
|
|
@@ -370,7 +348,7 @@ class TRTCVodPlayer {
|
|
|
370
348
|
this.logger.warn('switchSource: newMediaFile is empty, ignored');
|
|
371
349
|
return;
|
|
372
350
|
}
|
|
373
|
-
if (!this.
|
|
351
|
+
if (!this.isRenderPrepared) {
|
|
374
352
|
this.logger.warn(`switchSource: player not preloaded or started, ignored (newMediaFile=${newMediaFile})`);
|
|
375
353
|
return;
|
|
376
354
|
}
|
|
@@ -698,14 +676,8 @@ class TRTCVodPlayer {
|
|
|
698
676
|
var _a;
|
|
699
677
|
(_a = this.nativeVodPlayer) === null || _a === void 0 ? void 0 : _a.setEventCallback((args) => {
|
|
700
678
|
const event = args[0];
|
|
701
|
-
if ((event === TRTCVodPlayerEvent.onVodPlayerStopped || event === TRTCVodPlayerEvent.onVodPlayerError) && this.isStarted) {
|
|
702
|
-
this.isStarted = false;
|
|
703
|
-
}
|
|
704
679
|
switch (event) {
|
|
705
680
|
case TRTCVodPlayerEvent.onVodPlayerStarted:
|
|
706
|
-
if (!this.isStarted) {
|
|
707
|
-
this.isStarted = true;
|
|
708
|
-
}
|
|
709
681
|
this.fire(TRTCVodPlayerEvent.onVodPlayerStarted, args[1].msLength);
|
|
710
682
|
break;
|
|
711
683
|
case TRTCVodPlayerEvent.onVodPlayerLoaded: {
|