trtc-electron-sdk 13.4.802-beta.3 → 13.5.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.
@@ -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(view?: HTMLElement | null): void;
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(view = null) {
56
+ startScreenCapture(views = null) {
57
57
  try {
58
58
  this.isLocalSharingStarted = true;
59
- this.hasLocalSharingView = view !== null && view !== undefined;
59
+ this.hasLocalSharingView = this.validateViews(views);
60
60
  this.update();
61
61
  }
62
62
  catch (error) {
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} view - 承载预览画面的 DOM
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(view?: HTMLElement | null, type?: TRTCVideoStreamType, params?: any): void;
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} view - 承载预览画面的 DOM
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(view = null, type = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub, params = null) {
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 (view !== undefined) {
3704
- if (view !== null) {
3714
+ if (views !== undefined) {
3715
+ if (views !== null) {
3705
3716
  const key = this._getKey(LOCAL_USER_VIDEO_ID, type);
3706
- this._initRenderer(key, [view]);
3717
+ this._initRenderer(key, Array.isArray(views) ? views : [views]);
3707
3718
  }
3708
- this.localVideoRenderController.startScreenCapture(view);
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(view?: HTMLElement | null, type?: TRTCVideoStreamType, params?: any): void;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "13.4.802-beta.3",
3
+ "version": "13.5.802-beta.0",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",