trtc-cloud-js-sdk 2.12.2-beta.2 → 2.12.2-beta.21
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/package.json +2 -2
- package/trtc-cloud-js-sdk.d.ts +183 -8
- package/trtc-cloud-js-sdk.esm.js +1 -1
- package/trtc-cloud-js-sdk.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trtc-cloud-js-sdk",
|
|
3
|
-
"version": "2.12.2-beta.
|
|
3
|
+
"version": "2.12.2-beta.21",
|
|
4
4
|
"description": "Tencent Cloud RTC SDK for Web And Electron",
|
|
5
5
|
"main": "trtc-cloud-js-sdk.js",
|
|
6
6
|
"module": "trtc-cloud-js-sdk.esm.js",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"author": "Tencent Cloud Client R&D Center",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"trtc-sdk-v5": "5.18.
|
|
22
|
+
"trtc-sdk-v5": "5.18.2-beta.5"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/trtc-cloud-js-sdk.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import EventEmitter from 'eventemitter3';
|
|
|
2
2
|
import { VirtualBackground } from 'trtc-sdk-v5/plugins/video-effect/virtual-background';
|
|
3
3
|
import { BasicBeauty } from 'trtc-sdk-v5/plugins/video-effect/basic-beauty';
|
|
4
4
|
import VideoMixer from 'trtc-sdk-v5/plugins/video-effect/video-mixer';
|
|
5
|
+
import Whiteboard from 'trtc-sdk-v5/plugins/whiteboard';
|
|
5
6
|
|
|
6
7
|
declare enum TRTCVideoResolution {
|
|
7
8
|
TRTCVideoResolution_120_120 = 1,
|
|
@@ -780,11 +781,14 @@ interface ITRTCMediaMixingManager {
|
|
|
780
781
|
addMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
781
782
|
removeMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
782
783
|
updateMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
783
|
-
startPublish(
|
|
784
|
+
startPublish(options?: {
|
|
785
|
+
streamType?: TRTCVideoStreamType;
|
|
786
|
+
}): Promise<void>;
|
|
784
787
|
stopPublish(): Promise<void>;
|
|
785
788
|
updatePublishParams(params: TRTCMediaMixingEncParam): Promise<void>;
|
|
786
|
-
bindPreviewArea(view: HTMLElement | null): void
|
|
787
|
-
|
|
789
|
+
bindPreviewArea(view: HTMLElement | null): Promise<void>;
|
|
790
|
+
updatePreviewArea(view: HTMLElement | null): Promise<void>;
|
|
791
|
+
destroy(): Promise<void>;
|
|
788
792
|
on(event: string, func: (...args: any[]) => void): void;
|
|
789
793
|
off(event: string, func: (...args: any[]) => void): void;
|
|
790
794
|
}
|
|
@@ -813,6 +817,7 @@ declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
813
817
|
private sourceList;
|
|
814
818
|
private trtcSourceMap;
|
|
815
819
|
private mixVideoTrack;
|
|
820
|
+
private publishStreamType;
|
|
816
821
|
private selectedSource;
|
|
817
822
|
private logger;
|
|
818
823
|
private trtc;
|
|
@@ -853,6 +858,7 @@ declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
853
858
|
* mediaMixingManager.bindPreviewArea( previewDOM);
|
|
854
859
|
*/
|
|
855
860
|
bindPreviewArea(view: HTMLElement | null): Promise<void>;
|
|
861
|
+
updatePreviewArea(view: HTMLElement | null): Promise<void>;
|
|
856
862
|
private _getTRTCSourceKey;
|
|
857
863
|
private _getTRTCFillMode;
|
|
858
864
|
private _getTRTCVideoProfile;
|
|
@@ -881,9 +887,13 @@ declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
881
887
|
updateMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
882
888
|
/**
|
|
883
889
|
* 开始推流
|
|
890
|
+
* @param options {Object} - 推流参数,可选
|
|
891
|
+
* @param options.streamType {TRTCVideoStreamType} - 混流输出推流目标,默认主流。
|
|
884
892
|
* @returns {Promise<void>}
|
|
885
893
|
*/
|
|
886
|
-
startPublish(
|
|
894
|
+
startPublish(options?: {
|
|
895
|
+
streamType?: TRTCVideoStreamType;
|
|
896
|
+
}): Promise<void>;
|
|
887
897
|
/**
|
|
888
898
|
* 停止推流
|
|
889
899
|
* @returns {Promise<void>}
|
|
@@ -925,6 +935,162 @@ declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
925
935
|
private unselectMediaSource;
|
|
926
936
|
}
|
|
927
937
|
|
|
938
|
+
declare type WhiteboardToolType = 'pen' | 'rect' | 'ellipse' | 'arrow' | 'laser' | 'eraserObject';
|
|
939
|
+
declare type WhiteboardOp = 'undo' | 'redo' | 'clearall' | 'clearself';
|
|
940
|
+
declare type WhiteboardSessionStalledReason = 'silence' | 'queue-full';
|
|
941
|
+
declare enum TRTCWhiteboardEvent {
|
|
942
|
+
/** 上行:本端笔迹/操作数据,需上层转发给远端 */
|
|
943
|
+
onSendWhiteboardCommand = "onSendWhiteboardCommand",
|
|
944
|
+
STARTED = "started",
|
|
945
|
+
STOPPED = "stopped",
|
|
946
|
+
ERROR = "error",
|
|
947
|
+
STALLED = "stalled",
|
|
948
|
+
RESUMED = "resumed",
|
|
949
|
+
UNDO_STATE_CHANGED = "undo-state-changed",
|
|
950
|
+
REDO_STATE_CHANGED = "redo-state-changed"
|
|
951
|
+
}
|
|
952
|
+
interface WhiteboardToolConfig {
|
|
953
|
+
type?: WhiteboardToolType;
|
|
954
|
+
color?: string | number;
|
|
955
|
+
line_width?: number;
|
|
956
|
+
laserFadeDuration?: number;
|
|
957
|
+
}
|
|
958
|
+
declare const WhiteboardToolConfig: any;
|
|
959
|
+
interface WhiteboardCanvasInfo {
|
|
960
|
+
width: number;
|
|
961
|
+
height: number;
|
|
962
|
+
}
|
|
963
|
+
declare const WhiteboardCanvasInfo: any;
|
|
964
|
+
/**
|
|
965
|
+
* 下行指令参数 —— 与 Native `OnRecvWhiteboardCommand` 的 `params` 对齐。
|
|
966
|
+
*
|
|
967
|
+
* 该指令承担两类职责:
|
|
968
|
+
* 1. 配置/生命周期:`enable`、`canvas`、`tool`、`whiteboard.interactive`、`view_handle`
|
|
969
|
+
* 2. 远端协同:`owner_id`、`stroke_id`、`op`,以及远端笔迹点数据(`xs`/`ys`/`tool`/`color`/`lw`)
|
|
970
|
+
*/
|
|
971
|
+
interface WhiteboardRecvCommand {
|
|
972
|
+
/** 1=启用, 0=关闭;关闭时其余字段忽略 */
|
|
973
|
+
enable: number;
|
|
974
|
+
stroke_id?: string;
|
|
975
|
+
op?: WhiteboardOp;
|
|
976
|
+
/** 操作/笔迹归属用户;存在时表示这是一条远端协同指令 */
|
|
977
|
+
owner_id?: string;
|
|
978
|
+
/**
|
|
979
|
+
* 视图句柄。
|
|
980
|
+
* - Native:int64 句柄
|
|
981
|
+
* - Web:传入绑定事件的 DOM 元素或其 id(HTMLElement | string)。
|
|
982
|
+
* 白板启动后再次传入时,会将现有画布和交互迁移到新的视图。
|
|
983
|
+
*/
|
|
984
|
+
view_handle?: number | string | HTMLElement;
|
|
985
|
+
/** 接收 Native 回调数据的实例句柄(Web 端忽略,仅为兼容 Native 透传) */
|
|
986
|
+
whiteboard_delegate_handle?: number;
|
|
987
|
+
canvas?: WhiteboardCanvasInfo;
|
|
988
|
+
tool?: WhiteboardToolConfig;
|
|
989
|
+
whiteboard?: {
|
|
990
|
+
interactive?: boolean;
|
|
991
|
+
};
|
|
992
|
+
is_first?: boolean;
|
|
993
|
+
color?: string | number;
|
|
994
|
+
lw?: number;
|
|
995
|
+
xs?: string;
|
|
996
|
+
ys?: string;
|
|
997
|
+
}
|
|
998
|
+
declare const WhiteboardRecvCommand: any;
|
|
999
|
+
/**
|
|
1000
|
+
* 上行回调 payload —— 与 Native `OnSendWhiteboardCommand` 的 payload 对齐。
|
|
1001
|
+
*/
|
|
1002
|
+
interface WhiteboardSendPayload {
|
|
1003
|
+
id: string;
|
|
1004
|
+
is_first?: boolean;
|
|
1005
|
+
tool?: WhiteboardToolType;
|
|
1006
|
+
color?: string;
|
|
1007
|
+
lw?: number;
|
|
1008
|
+
xs?: string;
|
|
1009
|
+
ys?: string;
|
|
1010
|
+
op?: WhiteboardOp;
|
|
1011
|
+
}
|
|
1012
|
+
declare const WhiteboardSendPayload: any;
|
|
1013
|
+
interface WhiteboardSessionStalledInfo {
|
|
1014
|
+
targetUser: string;
|
|
1015
|
+
pendingCount: number;
|
|
1016
|
+
reason: WhiteboardSessionStalledReason;
|
|
1017
|
+
}
|
|
1018
|
+
declare const WhiteboardSessionStalledInfo: any;
|
|
1019
|
+
interface WhiteboardSessionResumedInfo {
|
|
1020
|
+
targetUser: string;
|
|
1021
|
+
resentCount: number;
|
|
1022
|
+
}
|
|
1023
|
+
declare const WhiteboardSessionResumedInfo: any;
|
|
1024
|
+
interface WhiteboardHistoryStateChangedInfo {
|
|
1025
|
+
available: boolean;
|
|
1026
|
+
}
|
|
1027
|
+
declare const WhiteboardHistoryStateChangedInfo: any;
|
|
1028
|
+
interface WhiteboardDelegate {
|
|
1029
|
+
onSendWhiteboardCommand(isNeedAck: boolean, payload: string): void;
|
|
1030
|
+
}
|
|
1031
|
+
declare const WhiteboardDelegate: any;
|
|
1032
|
+
interface ITRTCWhiteboardManager {
|
|
1033
|
+
/** 设置上行数据回调(与 Native WhiteboardDelegate 对齐) */
|
|
1034
|
+
setDelegate(delegate: WhiteboardDelegate | null): void;
|
|
1035
|
+
/** 处理下行指令(对应 callExperimentalAPI 的 OnRecvWhiteboardCommand) */
|
|
1036
|
+
onRecvWhiteboardCommand(command: WhiteboardRecvCommand): Promise<void>;
|
|
1037
|
+
/** 销毁,释放插件与监听 */
|
|
1038
|
+
destroy(): Promise<void>;
|
|
1039
|
+
on(event: string, func: (...args: any[]) => void): void;
|
|
1040
|
+
off(event: string, func: (...args: any[]) => void): void;
|
|
1041
|
+
}
|
|
1042
|
+
declare const ITRTCWhiteboardManager: any;
|
|
1043
|
+
|
|
1044
|
+
declare class TRTCWhiteboardManager implements ITRTCWhiteboardManager {
|
|
1045
|
+
static whiteboardManager: TRTCWhiteboardManager | null;
|
|
1046
|
+
private readonly logPrefix;
|
|
1047
|
+
private logger;
|
|
1048
|
+
private trtc;
|
|
1049
|
+
private eventEmitter;
|
|
1050
|
+
private delegate;
|
|
1051
|
+
private pluginEventHandlers;
|
|
1052
|
+
private boundPlugin;
|
|
1053
|
+
private started;
|
|
1054
|
+
private view;
|
|
1055
|
+
constructor(options: {
|
|
1056
|
+
logger: any;
|
|
1057
|
+
trtc: any;
|
|
1058
|
+
});
|
|
1059
|
+
setDelegate(delegate: WhiteboardDelegate | null): void;
|
|
1060
|
+
onRecvWhiteboardCommand(command: WhiteboardRecvCommand): Promise<void>;
|
|
1061
|
+
private _start;
|
|
1062
|
+
private _update;
|
|
1063
|
+
private _stop;
|
|
1064
|
+
private _applyLocalOp;
|
|
1065
|
+
private _bindPluginEvents;
|
|
1066
|
+
private _offPluginEvents;
|
|
1067
|
+
private _resetPluginEventBinding;
|
|
1068
|
+
private _getWhiteboardPlugin;
|
|
1069
|
+
private _emitWhiteboardEvent;
|
|
1070
|
+
/**
|
|
1071
|
+
* 远端协同指令(带 owner_id)。
|
|
1072
|
+
*
|
|
1073
|
+
* 说明:Web `Whiteboard` 插件的跨端笔迹同步由插件内部通过 TRTC customMessage + SEI 自动完成
|
|
1074
|
+
* (guest 在本地预览 canvas 绘制并同步给 host,host 合流进推流),无需上层 RoomEngine 转发
|
|
1075
|
+
* 远端笔迹点数据。因此这里对远端笔迹数据(xs/ys)不做注入,仅记录日志,保持与 Native 契约形态一致。
|
|
1076
|
+
*/
|
|
1077
|
+
private _applyRemoteCommand;
|
|
1078
|
+
private _buildToolGroup;
|
|
1079
|
+
private _buildConfigGroup;
|
|
1080
|
+
private _buildCanvasInfo;
|
|
1081
|
+
private _opToOperation;
|
|
1082
|
+
/**
|
|
1083
|
+
* 颜色归一化:支持 '#RRGGBB' / '#AARRGGBB' / 0xAARRGGBB 整型 -> CSS 颜色字符串
|
|
1084
|
+
*/
|
|
1085
|
+
private _normalizeColor;
|
|
1086
|
+
private _resolveView;
|
|
1087
|
+
on(event: string, func: (...args: any[]) => void): void;
|
|
1088
|
+
off(event: string, func: (...args: any[]) => void): void;
|
|
1089
|
+
destroy(): Promise<void>;
|
|
1090
|
+
private log;
|
|
1091
|
+
private logError;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
928
1094
|
/**
|
|
929
1095
|
* 转录参数
|
|
930
1096
|
*/
|
|
@@ -1058,6 +1224,7 @@ declare class AITranscriberManager implements IAITranscriberManager {
|
|
|
1058
1224
|
destroy(): void;
|
|
1059
1225
|
}
|
|
1060
1226
|
|
|
1227
|
+
declare const loggerManager: any;
|
|
1061
1228
|
declare class TRTC_Cloud extends EventEmitter {
|
|
1062
1229
|
static shareInstance: TRTC_Cloud | null;
|
|
1063
1230
|
static subCloudMap: Map<TRTC_Cloud, TRTC_Cloud>;
|
|
@@ -1127,7 +1294,7 @@ declare class TRTC_Cloud extends EventEmitter {
|
|
|
1127
1294
|
private _hasJoinedRoom;
|
|
1128
1295
|
private _isExitingRoom;
|
|
1129
1296
|
constructor(config?: ITRTCCloudConfig);
|
|
1130
|
-
static getPlugin(pluginName: string): typeof VirtualBackground | typeof BasicBeauty | typeof VideoMixer | null;
|
|
1297
|
+
static getPlugin(pluginName: string): typeof VirtualBackground | typeof BasicBeauty | typeof VideoMixer | typeof Whiteboard | null;
|
|
1131
1298
|
/**
|
|
1132
1299
|
* 创建 TRTCCloud 对象单例
|
|
1133
1300
|
* @param {ITRTCCloudConfig} config 构造函数初始化
|
|
@@ -1673,10 +1840,13 @@ declare class TRTC_Cloud extends EventEmitter {
|
|
|
1673
1840
|
* await trtcCloud.stopScreenShare();
|
|
1674
1841
|
*/
|
|
1675
1842
|
stopScreenShare(): Promise<void>;
|
|
1676
|
-
_startPublishVideoTrack({ videoTrack }: {
|
|
1843
|
+
_startPublishVideoTrack({ videoTrack, streamType }: {
|
|
1677
1844
|
videoTrack: MediaStreamTrack;
|
|
1845
|
+
streamType?: TRTCVideoStreamType;
|
|
1846
|
+
}): Promise<void>;
|
|
1847
|
+
_stopPublishVideoTrack({ streamType }?: {
|
|
1848
|
+
streamType?: TRTCVideoStreamType;
|
|
1678
1849
|
}): Promise<void>;
|
|
1679
|
-
_stopPublishVideoTrack(): Promise<void>;
|
|
1680
1850
|
startScreenCapture(): void;
|
|
1681
1851
|
pauseScreenCapture(): void;
|
|
1682
1852
|
resumeScreenCapture(): void;
|
|
@@ -2040,7 +2210,12 @@ declare class TRTC_Cloud extends EventEmitter {
|
|
|
2040
2210
|
* @returns {TRTCMediaMixingManager | null}
|
|
2041
2211
|
*/
|
|
2042
2212
|
getMediaMixingManager(): TRTCMediaMixingManager;
|
|
2213
|
+
/**
|
|
2214
|
+
* 获取互动白板管理器
|
|
2215
|
+
* @returns {TRTCWhiteboardManager}
|
|
2216
|
+
*/
|
|
2217
|
+
getWhiteboardManager(): TRTCWhiteboardManager;
|
|
2043
2218
|
getAITranscriberManager(): AITranscriberManager;
|
|
2044
2219
|
}
|
|
2045
2220
|
|
|
2046
|
-
export { AITranscriberListener, AudioMuteType, IAITranscriberManager, ITRTCMediaMixingEvent, ITRTCMediaMixingManager, InteractionOption, Rect, TRTCAppScene, TRTCAudioQuality, TRTCAudioSceneEx, TRTCBeautyStyle, TRTCCameraCaptureMode, TRTCCameraCaptureParams, TRTCDeviceInfo, TRTCDeviceState, TRTCDeviceType, TRTCImageBuffer, TRTCLocalStatistics, TRTCLogLevel, TRTCMediaMixingEncParam, TRTCMediaMixingErrorCode, TRTCMediaMixingEvent, TRTCMediaSource, TRTCMediaSourceType, TRTCMixInputType, TRTCMixUser, TRTCNetworkQosParam, TRTCParams, TRTCPublishCDNParam, TRTCQosControlMode, TRTCQuality, TRTCQualityInfo, TRTCRemoteStatistics, TRTCRenderParams, TRTCRoleType, TRTCScreenCaptureProperty, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureSourceType, TRTCStatistics, TRTCTranscodingConfig, TRTCTranscodingConfigMode, TRTCVideoEncParam, TRTCVideoFillMode, TRTCVideoMirrorType, TRTCVideoQosPreference, TRTCVideoResolution, TRTCVideoResolutionMode, TRTCVideoRotation, TRTCVideoStreamType, TRTCVolumeInfo, TranscriberMessage, TranscriberParams, TRTC_Cloud as default };
|
|
2221
|
+
export { AITranscriberListener, AudioMuteType, IAITranscriberManager, ITRTCMediaMixingEvent, ITRTCMediaMixingManager, ITRTCWhiteboardManager, InteractionOption, Rect, TRTCAppScene, TRTCAudioQuality, TRTCAudioSceneEx, TRTCBeautyStyle, TRTCCameraCaptureMode, TRTCCameraCaptureParams, TRTCDeviceInfo, TRTCDeviceState, TRTCDeviceType, TRTCImageBuffer, TRTCLocalStatistics, TRTCLogLevel, TRTCMediaMixingEncParam, TRTCMediaMixingErrorCode, TRTCMediaMixingEvent, TRTCMediaSource, TRTCMediaSourceType, TRTCMixInputType, TRTCMixUser, TRTCNetworkQosParam, TRTCParams, TRTCPublishCDNParam, TRTCQosControlMode, TRTCQuality, TRTCQualityInfo, TRTCRemoteStatistics, TRTCRenderParams, TRTCRoleType, TRTCScreenCaptureProperty, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureSourceType, TRTCStatistics, TRTCTranscodingConfig, TRTCTranscodingConfigMode, TRTCVideoEncParam, TRTCVideoFillMode, TRTCVideoMirrorType, TRTCVideoQosPreference, TRTCVideoResolution, TRTCVideoResolutionMode, TRTCVideoRotation, TRTCVideoStreamType, TRTCVolumeInfo, TRTCWhiteboardEvent, TranscriberMessage, TranscriberParams, WhiteboardCanvasInfo, WhiteboardDelegate, WhiteboardHistoryStateChangedInfo, WhiteboardOp, WhiteboardRecvCommand, WhiteboardSendPayload, WhiteboardSessionResumedInfo, WhiteboardSessionStalledInfo, WhiteboardSessionStalledReason, WhiteboardToolConfig, WhiteboardToolType, TRTC_Cloud as default, loggerManager };
|