trtc-electron-sdk 13.4.802-beta.3 → 13.4.802-beta.4
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/index.d.ts +1 -0
- package/liteav/MediaMixingDesigner/index.js +9 -1
- package/liteav/VideoRenderControl/LocalVideoRenderController.d.ts +1 -1
- package/liteav/VideoRenderControl/LocalVideoRenderController.js +2 -2
- package/liteav/extensions/MediaMixingManager/MediaMixingManager.d.ts +2 -0
- package/liteav/extensions/MediaMixingManager/MediaMixingManager.js +48 -7
- package/liteav/extensions/MediaMixingManager/types.d.ts +5 -1
- package/liteav/trtc.d.ts +15 -4
- package/liteav/trtc.js +21 -7
- package/liteav/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -272,12 +272,16 @@ class TRTCMediaMixingDesigner {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
updateOverlay() {
|
|
275
|
+
var _a;
|
|
275
276
|
if (this.moveAndResizeOverlay) {
|
|
276
277
|
let left = this.absoluteWorkingArea.left + this.previewLeft;
|
|
277
278
|
let top = this.absoluteWorkingArea.top + this.previewTop;
|
|
278
279
|
let width = 0;
|
|
279
280
|
let height = 0;
|
|
280
|
-
if (
|
|
281
|
+
// Even if a locked media source is forced into "selected" state (e.g. via
|
|
282
|
+
// an external list panel selection), the move/resize overlay must stay
|
|
283
|
+
// hidden so it cannot be dragged or resized from the canvas.
|
|
284
|
+
if (this.selectedMediaIndex >= 0 && !((_a = this.mediaList[this.selectedMediaIndex]) === null || _a === void 0 ? void 0 : _a.isLocked)) {
|
|
281
285
|
this.moveAndResizeOverlay.style.display = 'block';
|
|
282
286
|
const selectedPreviewRect = {
|
|
283
287
|
left: this.mediaList[this.selectedMediaIndex].rect.left * this.previewScale,
|
|
@@ -415,6 +419,10 @@ class TRTCMediaMixingDesigner {
|
|
|
415
419
|
for (let i = 0; i < this.mediaList.length; i++) {
|
|
416
420
|
const item = this.mediaList[i];
|
|
417
421
|
if (item.rect &&
|
|
422
|
+
// Locked media sources are excluded from hit test, so a click on a
|
|
423
|
+
// locked source falls through to the next (lower zOrder) hit, and
|
|
424
|
+
// it can never be selected/dragged/resized via canvas interaction.
|
|
425
|
+
!item.isLocked &&
|
|
418
426
|
xInImage >= item.rect.left &&
|
|
419
427
|
xInImage <= item.rect.right &&
|
|
420
428
|
yInImage >= item.rect.top &&
|
|
@@ -17,7 +17,7 @@ declare class LocalVideoRenderController {
|
|
|
17
17
|
startLocalPreview(views: Array<HTMLElement> | HTMLElement | null): void;
|
|
18
18
|
stopLocalPreview(): void;
|
|
19
19
|
updateLocalView(views: Array<HTMLElement> | HTMLElement | null): void;
|
|
20
|
-
startScreenCapture(
|
|
20
|
+
startScreenCapture(views?: Array<HTMLElement> | HTMLElement | null): void;
|
|
21
21
|
stopScreenCapture(): void;
|
|
22
22
|
setCustomRenderCallback(hasCallback: boolean): void;
|
|
23
23
|
setExternalRenderEnabled(enabled: boolean): void;
|
|
@@ -53,10 +53,10 @@ class LocalVideoRenderController {
|
|
|
53
53
|
throw error;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
startScreenCapture(
|
|
56
|
+
startScreenCapture(views = null) {
|
|
57
57
|
try {
|
|
58
58
|
this.isLocalSharingStarted = true;
|
|
59
|
-
this.hasLocalSharingView =
|
|
59
|
+
this.hasLocalSharingView = this.validateViews(views);
|
|
60
60
|
this.update();
|
|
61
61
|
}
|
|
62
62
|
catch (error) {
|
|
@@ -540,6 +540,8 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
540
540
|
* setter call.
|
|
541
541
|
*/
|
|
542
542
|
private _isSameCaptureParams;
|
|
543
|
+
private _omitIsPaused;
|
|
544
|
+
private _setVideoFilePaused;
|
|
543
545
|
private previewInNativeWindow;
|
|
544
546
|
private previewInWebElement;
|
|
545
547
|
private previewInNone;
|
|
@@ -8,12 +8,24 @@ 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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
24
|
};
|
|
14
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
26
|
exports.TRTCMediaMixingManager = exports.TRTCMediaMixingEvent = void 0;
|
|
16
27
|
const events_1 = require("events");
|
|
28
|
+
const lodash_isequal_1 = __importDefault(require("lodash.isequal"));
|
|
17
29
|
const trtc_define_1 = require("../../trtc_define");
|
|
18
30
|
const types_1 = require("./types");
|
|
19
31
|
const utils_1 = require("../../utils");
|
|
@@ -644,6 +656,7 @@ class TRTCMediaMixingManager {
|
|
|
644
656
|
id: `${newMediaSource.sourceType}__${newMediaSource.sourceId}`,
|
|
645
657
|
rect: newMediaSource.rect,
|
|
646
658
|
isSelected: newMediaSource.isSelected || false,
|
|
659
|
+
isLocked: newMediaSource.isLocked || false,
|
|
647
660
|
zOrder: newMediaSource.zOrder,
|
|
648
661
|
origin: newMediaSource
|
|
649
662
|
});
|
|
@@ -657,6 +670,8 @@ class TRTCMediaMixingManager {
|
|
|
657
670
|
return 11000;
|
|
658
671
|
case types_1.TRTCMediaSourceType.kVideoFile:
|
|
659
672
|
return 6000;
|
|
673
|
+
case types_1.TRTCMediaSourceType.kCamera:
|
|
674
|
+
return 8000; // camera maybe very slow
|
|
660
675
|
default:
|
|
661
676
|
return 5000;
|
|
662
677
|
}
|
|
@@ -706,6 +721,7 @@ class TRTCMediaMixingManager {
|
|
|
706
721
|
id: `${mediaSource.sourceType}__${mediaSource.sourceId}`,
|
|
707
722
|
rect: mediaSource.rect,
|
|
708
723
|
isSelected: mediaSource.isSelected || false,
|
|
724
|
+
isLocked: mediaSource.isLocked || false,
|
|
709
725
|
zOrder: mediaSource.zOrder,
|
|
710
726
|
origin: (0, utils_1.safelyParse)(JSON.stringify(mediaSource))
|
|
711
727
|
});
|
|
@@ -740,6 +756,7 @@ class TRTCMediaMixingManager {
|
|
|
740
756
|
id: `${mediaSource.sourceType}__${mediaSource.sourceId}`,
|
|
741
757
|
rect: mediaSource.rect,
|
|
742
758
|
isSelected: mediaSource.isSelected || false,
|
|
759
|
+
isLocked: mediaSource.isLocked || false,
|
|
743
760
|
zOrder: mediaSource.zOrder,
|
|
744
761
|
origin: (0, utils_1.safelyParse)(JSON.stringify(mediaSource))
|
|
745
762
|
});
|
|
@@ -1168,6 +1185,7 @@ class TRTCMediaMixingManager {
|
|
|
1168
1185
|
id: `${mediaSource.sourceType}__${mediaSource.sourceId}`,
|
|
1169
1186
|
rect: mediaSource.rect,
|
|
1170
1187
|
isSelected: mediaSource.isSelected || false,
|
|
1188
|
+
isLocked: mediaSource.isLocked || false,
|
|
1171
1189
|
zOrder: mediaSource.zOrder,
|
|
1172
1190
|
origin: mediaSource
|
|
1173
1191
|
});
|
|
@@ -1308,6 +1326,7 @@ class TRTCMediaMixingManager {
|
|
|
1308
1326
|
id: `${this.sourceList[index].sourceType}__${this.sourceList[index].sourceId}`,
|
|
1309
1327
|
rect: this.sourceList[index].rect,
|
|
1310
1328
|
isSelected: this.sourceList[index].isSelected || false,
|
|
1329
|
+
isLocked: this.sourceList[index].isLocked || false,
|
|
1311
1330
|
zOrder: this.sourceList[index].zOrder,
|
|
1312
1331
|
origin: (0, utils_1.safelyParse)(JSON.stringify(this.sourceList[index]))
|
|
1313
1332
|
});
|
|
@@ -1629,6 +1648,7 @@ class TRTCMediaMixingManager {
|
|
|
1629
1648
|
* setter is always invoked when params are present).
|
|
1630
1649
|
*/
|
|
1631
1650
|
_applyMediaSourceParams(mediaSource, oldMediaSource) {
|
|
1651
|
+
var _a;
|
|
1632
1652
|
switch (mediaSource.sourceType) {
|
|
1633
1653
|
case types_1.TRTCMediaSourceType.kCamera:
|
|
1634
1654
|
// Skip kCamera on the add path to avoid an extra camera restart;
|
|
@@ -1648,10 +1668,22 @@ class TRTCMediaMixingManager {
|
|
|
1648
1668
|
}
|
|
1649
1669
|
break;
|
|
1650
1670
|
case types_1.TRTCMediaSourceType.kVideoFile:
|
|
1651
|
-
if (mediaSource.localVideo
|
|
1652
|
-
this.
|
|
1671
|
+
if (mediaSource.localVideo) {
|
|
1672
|
+
const nextParam = this._omitIsPaused(mediaSource.localVideo);
|
|
1673
|
+
const prevParam = this._omitIsPaused(oldMediaSource === null || oldMediaSource === void 0 ? void 0 : oldMediaSource.localVideo);
|
|
1674
|
+
if (!this._isSameCaptureParams(nextParam, prevParam)) {
|
|
1675
|
+
this.setVideoFileParam(mediaSource.sourceId, mediaSource.localVideo);
|
|
1676
|
+
}
|
|
1677
|
+
const nextIsPaused = !!mediaSource.localVideo.isPaused;
|
|
1678
|
+
const prevIsPaused = !!((_a = oldMediaSource === null || oldMediaSource === void 0 ? void 0 : oldMediaSource.localVideo) === null || _a === void 0 ? void 0 : _a.isPaused);
|
|
1679
|
+
if (nextIsPaused !== prevIsPaused) {
|
|
1680
|
+
this._setVideoFilePaused(mediaSource.sourceId, nextIsPaused);
|
|
1681
|
+
}
|
|
1653
1682
|
}
|
|
1654
1683
|
break;
|
|
1684
|
+
default:
|
|
1685
|
+
logger_1.default.warn(`[TRTC] Unknown media source type: ${mediaSource.sourceType}`);
|
|
1686
|
+
break;
|
|
1655
1687
|
}
|
|
1656
1688
|
}
|
|
1657
1689
|
/**
|
|
@@ -1683,12 +1715,21 @@ class TRTCMediaMixingManager {
|
|
|
1683
1715
|
if (nextEmpty || prevEmpty) {
|
|
1684
1716
|
return false;
|
|
1685
1717
|
}
|
|
1686
|
-
|
|
1687
|
-
|
|
1718
|
+
return (0, lodash_isequal_1.default)(next, prev);
|
|
1719
|
+
}
|
|
1720
|
+
_omitIsPaused(param) {
|
|
1721
|
+
if (!param) {
|
|
1722
|
+
return undefined;
|
|
1688
1723
|
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1724
|
+
const { isPaused } = param, rest = __rest(param, ["isPaused"]);
|
|
1725
|
+
return rest;
|
|
1726
|
+
}
|
|
1727
|
+
_setVideoFilePaused(sourceId, isPaused) {
|
|
1728
|
+
if (isPaused) {
|
|
1729
|
+
this.nodeMediaMixingPlugin.pauseVideoFileSource(sourceId);
|
|
1730
|
+
}
|
|
1731
|
+
else {
|
|
1732
|
+
this.nodeMediaMixingPlugin.resumeVideoFileSource(sourceId);
|
|
1692
1733
|
}
|
|
1693
1734
|
}
|
|
1694
1735
|
previewInNativeWindow(viewOrRegion) {
|
|
@@ -46,6 +46,9 @@ export declare type TRTCOnlineVideoParam = {
|
|
|
46
46
|
export declare type TRTCVideoFileParam = {
|
|
47
47
|
playoutVolume: number;
|
|
48
48
|
};
|
|
49
|
+
export declare type TRTCMediaMixingLocalVideoParam = TRTCVideoFileParam & {
|
|
50
|
+
isPaused?: boolean;
|
|
51
|
+
};
|
|
49
52
|
export declare type TRTCMediaSource = {
|
|
50
53
|
sourceType: TRTCMediaSourceType;
|
|
51
54
|
sourceId: string;
|
|
@@ -53,12 +56,13 @@ export declare type TRTCMediaSource = {
|
|
|
53
56
|
enableGreenScreen?: boolean;
|
|
54
57
|
rect: Rect;
|
|
55
58
|
isSelected?: boolean;
|
|
59
|
+
isLocked?: boolean;
|
|
56
60
|
rotation?: TRTCVideoRotation;
|
|
57
61
|
fillMode?: TRTCVideoFillMode;
|
|
58
62
|
mirrorType?: TRTCVideoMirrorType;
|
|
59
63
|
camera?: TRTCCameraCaptureParams;
|
|
60
64
|
screen?: TRTCScreenCaptureProperty;
|
|
61
|
-
localVideo?:
|
|
65
|
+
localVideo?: TRTCMediaMixingLocalVideoParam;
|
|
62
66
|
onlineVideo?: TRTCOnlineVideoParam;
|
|
63
67
|
};
|
|
64
68
|
export declare type TRTCMediaMixingEncParam = {
|
package/liteav/trtc.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { TRTCConfig } from './Renderer/util';
|
|
4
4
|
import TRTCLocalMediaTranscoder from './LocalMediaTranscoder';
|
|
5
|
-
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCAudioFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCVoiceChangerType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions, TRTCPublishTarget, TRTCStreamEncoderParam, TRTCStreamMixingConfig } from './trtc_define';
|
|
5
|
+
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoEncParam, TRTCVideoFillMode, TRTCAudioFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCVoiceChangerType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions, TRTCPublishTarget, TRTCStreamEncoderParam, TRTCStreamMixingConfig } from './trtc_define';
|
|
6
6
|
import { ITRTCCloud, TRTCVideoRenderCallback } from './types';
|
|
7
7
|
import TRTCMediaMixingManager, { TRTCMediaMixingService } from './extensions/MediaMixingManager';
|
|
8
8
|
/**
|
|
@@ -2087,7 +2087,10 @@ declare class TRTCCloud extends EventEmitter implements ITRTCCloud {
|
|
|
2087
2087
|
* 一个用户同时最多只能上传一条主路(TRTCVideoStreamTypeBig)画面和一条辅路(TRTCVideoStreamTypeSub)画面,
|
|
2088
2088
|
* 默认情况下,屏幕分享使用辅路画面,如果使用主路画面,建议您提前停止摄像头采集(stopLocalPreview)避免相互冲突。
|
|
2089
2089
|
*
|
|
2090
|
-
* @param {HTMLElement}
|
|
2090
|
+
* @param {Array<HTMLElement>|HTMLElement|null} views - 承载预览画面的单个 HTML 块节点或者 HTML 块节点数组
|
|
2091
|
+
* - 传入单个 HTML 块节点:在该节点上预览屏幕分享画面。
|
|
2092
|
+
* - 传入 HTML 块节点数组:在多个节点上同时预览同一路屏幕分享画面(多路预览),适用于双屏/多窗口场景。
|
|
2093
|
+
* - 传入 `null`:不预览屏幕分享画面,但不影响屏幕分享的采集与上行;此时若设置了 [setLocalVideoRenderCallback()]{@link TRTCCloud#setLocalVideoRenderCallback} 自定义渲染回调,可通过回调获取屏幕分享的视频帧自行渲染。
|
|
2091
2094
|
* @param {TRTCVideoStreamType} type 屏幕分享使用的线路,可以设置为主路(TRTCVideoStreamTypeBig)或者辅路(TRTCVideoStreamTypeSub),默认使用辅路。
|
|
2092
2095
|
* @param {TRTCVideoEncParam} params 屏幕分享的画面编码参数,可以设置为 null,表示让 SDK 选择最佳的编码参数(分辨率、码率等)。即使在调用 startScreenCapture 时设置 type=TRTCVideoStreamTypeBig,依然可以使用此接口更新屏幕分享的编码参数。
|
|
2093
2096
|
*
|
|
@@ -2133,12 +2136,20 @@ declare class TRTCCloud extends EventEmitter implements ITRTCCloud {
|
|
|
2133
2136
|
* );
|
|
2134
2137
|
*
|
|
2135
2138
|
* rtcCloud.startScreenCapture(
|
|
2136
|
-
* view, // HTML Element
|
|
2139
|
+
* view, // 单个 HTML Element
|
|
2140
|
+
* TRTCVideoStreamType.TRTCVideoStreamTypeSub,
|
|
2141
|
+
* screenShareEncParam,
|
|
2142
|
+
* );
|
|
2143
|
+
*
|
|
2144
|
+
* @example
|
|
2145
|
+
* // 屏幕分享多路预览:同一路屏幕分享画面同时渲染到多个 HTML 元素上
|
|
2146
|
+
* rtcCloud.startScreenCapture(
|
|
2147
|
+
* [viewOnCurrentScreen, viewOnExtendedScreen], // HTML Element 数组
|
|
2137
2148
|
* TRTCVideoStreamType.TRTCVideoStreamTypeSub,
|
|
2138
2149
|
* screenShareEncParam,
|
|
2139
2150
|
* );
|
|
2140
2151
|
*/
|
|
2141
|
-
startScreenCapture(
|
|
2152
|
+
startScreenCapture(views?: Array<HTMLElement> | HTMLElement | null, type?: TRTCVideoStreamType, params?: TRTCVideoEncParam | undefined | null): void;
|
|
2142
2153
|
/**
|
|
2143
2154
|
* 暂停屏幕分享
|
|
2144
2155
|
*/
|
package/liteav/trtc.js
CHANGED
|
@@ -3636,7 +3636,10 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3636
3636
|
* 一个用户同时最多只能上传一条主路(TRTCVideoStreamTypeBig)画面和一条辅路(TRTCVideoStreamTypeSub)画面,
|
|
3637
3637
|
* 默认情况下,屏幕分享使用辅路画面,如果使用主路画面,建议您提前停止摄像头采集(stopLocalPreview)避免相互冲突。
|
|
3638
3638
|
*
|
|
3639
|
-
* @param {HTMLElement}
|
|
3639
|
+
* @param {Array<HTMLElement>|HTMLElement|null} views - 承载预览画面的单个 HTML 块节点或者 HTML 块节点数组
|
|
3640
|
+
* - 传入单个 HTML 块节点:在该节点上预览屏幕分享画面。
|
|
3641
|
+
* - 传入 HTML 块节点数组:在多个节点上同时预览同一路屏幕分享画面(多路预览),适用于双屏/多窗口场景。
|
|
3642
|
+
* - 传入 `null`:不预览屏幕分享画面,但不影响屏幕分享的采集与上行;此时若设置了 [setLocalVideoRenderCallback()]{@link TRTCCloud#setLocalVideoRenderCallback} 自定义渲染回调,可通过回调获取屏幕分享的视频帧自行渲染。
|
|
3640
3643
|
* @param {TRTCVideoStreamType} type 屏幕分享使用的线路,可以设置为主路(TRTCVideoStreamTypeBig)或者辅路(TRTCVideoStreamTypeSub),默认使用辅路。
|
|
3641
3644
|
* @param {TRTCVideoEncParam} params 屏幕分享的画面编码参数,可以设置为 null,表示让 SDK 选择最佳的编码参数(分辨率、码率等)。即使在调用 startScreenCapture 时设置 type=TRTCVideoStreamTypeBig,依然可以使用此接口更新屏幕分享的编码参数。
|
|
3642
3645
|
*
|
|
@@ -3682,12 +3685,20 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3682
3685
|
* );
|
|
3683
3686
|
*
|
|
3684
3687
|
* rtcCloud.startScreenCapture(
|
|
3685
|
-
* view, // HTML Element
|
|
3688
|
+
* view, // 单个 HTML Element
|
|
3689
|
+
* TRTCVideoStreamType.TRTCVideoStreamTypeSub,
|
|
3690
|
+
* screenShareEncParam,
|
|
3691
|
+
* );
|
|
3692
|
+
*
|
|
3693
|
+
* @example
|
|
3694
|
+
* // 屏幕分享多路预览:同一路屏幕分享画面同时渲染到多个 HTML 元素上
|
|
3695
|
+
* rtcCloud.startScreenCapture(
|
|
3696
|
+
* [viewOnCurrentScreen, viewOnExtendedScreen], // HTML Element 数组
|
|
3686
3697
|
* TRTCVideoStreamType.TRTCVideoStreamTypeSub,
|
|
3687
3698
|
* screenShareEncParam,
|
|
3688
3699
|
* );
|
|
3689
3700
|
*/
|
|
3690
|
-
startScreenCapture(
|
|
3701
|
+
startScreenCapture(views = null, type = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub, params = null) {
|
|
3691
3702
|
if ((type !== trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub && type !== trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig)) {
|
|
3692
3703
|
type = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub;
|
|
3693
3704
|
}
|
|
@@ -3700,12 +3711,15 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3700
3711
|
this.stopScreenCapture();
|
|
3701
3712
|
}
|
|
3702
3713
|
this.screenCaptureStreamType = type;
|
|
3703
|
-
if (
|
|
3704
|
-
if (
|
|
3714
|
+
if (views !== undefined) {
|
|
3715
|
+
if (views !== null) {
|
|
3705
3716
|
const key = this._getKey(LOCAL_USER_VIDEO_ID, type);
|
|
3706
|
-
this._initRenderer(key, [
|
|
3717
|
+
this._initRenderer(key, Array.isArray(views) ? views : [views]);
|
|
3707
3718
|
}
|
|
3708
|
-
this.localVideoRenderController.startScreenCapture(
|
|
3719
|
+
this.localVideoRenderController.startScreenCapture(views);
|
|
3720
|
+
}
|
|
3721
|
+
else {
|
|
3722
|
+
this.logger.error('startScreenCapture parameter views is undefined, it should be Array<HTMLElement>, HTMLElement or null');
|
|
3709
3723
|
}
|
|
3710
3724
|
if (params) {
|
|
3711
3725
|
this.rtcCloud.startScreenCapture(type, params);
|
package/liteav/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import TRTCMediaMixingManager, { TRTCMediaMixingService } from './extensions/MediaMixingManager';
|
|
2
|
-
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceType, TRTCLogLevel, TRTCAudioFrame, TRTCVideoFillMode, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCVoiceChangerType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions, TRTCPublishTarget, TRTCStreamEncoderParam, TRTCStreamMixingConfig, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoFrame, TRTCVideoPixelFormat, TRTCVideoBufferType } from './trtc_define';
|
|
2
|
+
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceType, TRTCLogLevel, TRTCAudioFrame, TRTCVideoFillMode, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCVoiceChangerType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions, TRTCPublishTarget, TRTCStreamEncoderParam, TRTCStreamMixingConfig, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoFrame, TRTCVideoPixelFormat, TRTCVideoBufferType, TRTCVideoEncParam } from './trtc_define';
|
|
3
3
|
import { TRTCVodPlayerEventMap } from './vod_player';
|
|
4
4
|
export interface TRTCVideoRenderCallback {
|
|
5
5
|
onRenderVideoFrame(userId: string, streamType: TRTCVideoStreamType, frame: TRTCVideoFrame): void;
|
|
@@ -112,7 +112,7 @@ export interface ITRTCCloud {
|
|
|
112
112
|
setWaterMark(streamType: TRTCVideoStreamType, srcData: ArrayBuffer | string | null, srcType: TRTCWaterMarkSrcType, nWidth: number, nHeight: number, xOffset: number, yOffset: number, fWidthRatio: number): void;
|
|
113
113
|
getScreenCaptureSources(thumbWidth: number, thumbHeight: number, iconWidth: number, iconHeight: number): Array<TRTCScreenCaptureSourceInfo>;
|
|
114
114
|
selectScreenCaptureTarget(source: TRTCScreenCaptureSourceInfo | number, captureRect: Rect | string, property: TRTCScreenCaptureProperty | string, deprecatedCaptureRect?: Rect, captureMouse?: boolean, highlightWindow?: boolean): void;
|
|
115
|
-
startScreenCapture(
|
|
115
|
+
startScreenCapture(views: Array<HTMLElement> | HTMLElement | null, type: TRTCVideoStreamType, params: TRTCVideoEncParam | undefined | null): void;
|
|
116
116
|
pauseScreenCapture(): void;
|
|
117
117
|
resumeScreenCapture(): void;
|
|
118
118
|
stopScreenCapture(): void;
|