trtc-cloud-js-sdk 2.12.2-beta.13 → 2.12.2-beta.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-cloud-js-sdk",
3
- "version": "2.12.2-beta.13",
3
+ "version": "2.12.2-beta.15",
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.2-beta.4"
22
+ "trtc-sdk-v5": "5.18.2-beta.5"
23
23
  }
24
24
  }
@@ -817,7 +817,6 @@ declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
817
817
  private sourceList;
818
818
  private trtcSourceMap;
819
819
  private mixVideoTrack;
820
- /** 记录混流输出的推流目标,stopPublish 时据此停止对应流 */
821
820
  private publishStreamType;
822
821
  private selectedSource;
823
822
  private logger;
@@ -859,11 +858,6 @@ declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
859
858
  * mediaMixingManager.bindPreviewArea( previewDOM);
860
859
  */
861
860
  bindPreviewArea(view: HTMLElement | null): Promise<void>;
862
- /**
863
- * 更新本地混流预览容器,不重启 VideoMixer 或替换混流输出 Track。
864
- * 用于 RoomKit 布局切换时,将现有预览迁移到新的 DOM 容器。
865
- * @param view {HTMLElement | null} - 新的本地混流预览容器
866
- */
867
861
  updatePreviewArea(view: HTMLElement | null): Promise<void>;
868
862
  private _getTRTCSourceKey;
869
863
  private _getTRTCFillMode;
@@ -894,8 +888,7 @@ declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
894
888
  /**
895
889
  * 开始推流
896
890
  * @param options {Object} - 推流参数,可选
897
- * @param options.streamType {TRTCVideoStreamType} - 混流输出推流目标,默认 `TRTCVideoStreamTypeBig`(主流)。
898
- * 传入 `TRTCVideoStreamTypeSub`(辅流)时,混流输出走屏幕分享辅流通道,远端按屏幕分享订阅(对齐 RoomKit「辅流 = 混流输出」模型)。
891
+ * @param options.streamType {TRTCVideoStreamType} - 混流输出推流目标,默认主流。
899
892
  * @returns {Promise<void>}
900
893
  */
901
894
  startPublish(options?: {
@@ -942,51 +935,27 @@ declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
942
935
  private unselectMediaSource;
943
936
  }
944
937
 
945
- /**
946
- * 互动白板类型定义
947
- *
948
- * 设计目标:Web 端对上层 RoomEngine 的对外契约与 Native 完全对齐。
949
- * - 下行(RoomEngine -> SDK):通过 `callExperimentalAPI` 透传 `OnRecvWhiteboardCommand` 指令
950
- * - 上行(SDK -> RoomEngine):通过 `WhiteboardDelegate.onSendWhiteboardCommand` 回调笔迹数据
951
- *
952
- * 为了与 Native 的 JSON 线上格式保持一致,字段命名沿用 Native 的 snake_case。
953
- */
954
- /**
955
- * 绘图工具类型
956
- * @enum {String}
957
- */
958
938
  declare type WhiteboardToolType = 'pen' | 'rect' | 'ellipse' | 'arrow' | 'laser' | 'eraserObject';
959
- /**
960
- * 白板操作指令
961
- * - undo / redo / clearall:下行(远端控制)
962
- * - clearself:上行 payload 中使用
963
- * @enum {String}
964
- */
965
939
  declare type WhiteboardOp = 'undo' | 'redo' | 'clearall' | 'clearself';
966
- /**
967
- * 白板事件名
968
- */
940
+ declare type WhiteboardSessionStalledReason = 'silence' | 'queue-full';
969
941
  declare enum TRTCWhiteboardEvent {
970
942
  /** 上行:本端笔迹/操作数据,需上层转发给远端 */
971
- onSendWhiteboardCommand = "onSendWhiteboardCommand"
943
+ onSendWhiteboardCommand = "onSendWhiteboardCommand",
944
+ STARTED = "started",
945
+ STOPPED = "stopped",
946
+ ERROR = "error",
947
+ SESSION_STALLED = "session-stalled",
948
+ SESSION_RESUMED = "session-resumed",
949
+ UNDO_STATE_CHANGED = "undo-state-changed",
950
+ REDO_STATE_CHANGED = "redo-state-changed"
972
951
  }
973
- /**
974
- * 工具配置
975
- */
976
952
  interface WhiteboardToolConfig {
977
- /** 工具类型,默认 pen */
978
953
  type?: WhiteboardToolType;
979
- /** 画笔颜色,支持 '#RRGGBB' / '#AARRGGBB' / 0xAARRGGBB 整型 */
980
954
  color?: string | number;
981
- /** 线宽 */
982
955
  line_width?: number;
983
- /** 仅 type === 'laser' 生效,激光轨迹淡出时间(毫秒),默认 1000,范围 [100, 10000] */
984
956
  laserFadeDuration?: number;
985
957
  }
986
958
  declare const WhiteboardToolConfig: any;
987
- /**
988
- * 画布尺寸
989
- */
990
959
  interface WhiteboardCanvasInfo {
991
960
  width: number;
992
961
  height: number;
@@ -1002,9 +971,7 @@ declare const WhiteboardCanvasInfo: any;
1002
971
  interface WhiteboardRecvCommand {
1003
972
  /** 1=启用, 0=关闭;关闭时其余字段忽略 */
1004
973
  enable: number;
1005
- /** 笔迹 id */
1006
974
  stroke_id?: string;
1007
- /** 操作指令 undo|redo|clearall */
1008
975
  op?: WhiteboardOp;
1009
976
  /** 操作/笔迹归属用户;存在时表示这是一条远端协同指令 */
1010
977
  owner_id?: string;
@@ -1017,24 +984,15 @@ interface WhiteboardRecvCommand {
1017
984
  view_handle?: number | string | HTMLElement;
1018
985
  /** 接收 Native 回调数据的实例句柄(Web 端忽略,仅为兼容 Native 透传) */
1019
986
  whiteboard_delegate_handle?: number;
1020
- /** 画布尺寸 */
1021
987
  canvas?: WhiteboardCanvasInfo;
1022
- /** 工具配置 */
1023
988
  tool?: WhiteboardToolConfig;
1024
- /** 白板交互配置 */
1025
989
  whiteboard?: {
1026
- /** canvas 是否响应触摸/鼠标交互事件 */
1027
990
  interactive?: boolean;
1028
991
  };
1029
- /** 远端笔迹:是否首包(仅 pen) */
1030
992
  is_first?: boolean;
1031
- /** 远端笔迹颜色(与上行 payload 对齐) */
1032
993
  color?: string | number;
1033
- /** 远端笔迹线宽(line_width 简写,与上行 payload 对齐) */
1034
994
  lw?: number;
1035
- /** 远端笔迹 x 坐标序列(base64 编码,与上行 payload 对齐) */
1036
995
  xs?: string;
1037
- /** 远端笔迹 y 坐标序列(base64 编码,与上行 payload 对齐) */
1038
996
  ys?: string;
1039
997
  }
1040
998
  declare const WhiteboardRecvCommand: any;
@@ -1042,39 +1000,35 @@ declare const WhiteboardRecvCommand: any;
1042
1000
  * 上行回调 payload —— 与 Native `OnSendWhiteboardCommand` 的 payload 对齐。
1043
1001
  */
1044
1002
  interface WhiteboardSendPayload {
1045
- /** stroke_id */
1046
1003
  id: string;
1047
- /** 仅 pen 的时候发,首包哨兵 */
1048
1004
  is_first?: boolean;
1049
- /** 工具类型 */
1050
1005
  tool?: WhiteboardToolType;
1051
- /** 颜色 */
1052
1006
  color?: string;
1053
- /** 线宽 */
1054
1007
  lw?: number;
1055
- /** x 坐标序列(base64 编码) */
1056
1008
  xs?: string;
1057
- /** y 坐标序列(base64 编码) */
1058
1009
  ys?: string;
1059
- /** 操作指令 undo|redo|clearself */
1060
1010
  op?: WhiteboardOp;
1061
1011
  }
1062
1012
  declare const WhiteboardSendPayload: any;
1063
- /**
1064
- * 白板上行数据回调通道 —— 与 Native `WhiteboardDelegate` 对齐。
1065
- */
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;
1066
1028
  interface WhiteboardDelegate {
1067
- /**
1068
- * Native/SDK 返回给上层 room 的信令数据
1069
- * @param isNeedAck 是否需要 ack
1070
- * @param payload JSON 字符串,结构见 {@link WhiteboardSendPayload}
1071
- */
1072
1029
  onSendWhiteboardCommand(isNeedAck: boolean, payload: string): void;
1073
1030
  }
1074
1031
  declare const WhiteboardDelegate: any;
1075
- /**
1076
- * 白板管理器对外接口
1077
- */
1078
1032
  interface ITRTCWhiteboardManager {
1079
1033
  /** 设置上行数据回调(与 Native WhiteboardDelegate 对齐) */
1080
1034
  setDelegate(delegate: WhiteboardDelegate | null): void;
@@ -1087,60 +1041,31 @@ interface ITRTCWhiteboardManager {
1087
1041
  }
1088
1042
  declare const ITRTCWhiteboardManager: any;
1089
1043
 
1090
- /**
1091
- * 互动白板管理器
1092
- *
1093
- * 对上层(RoomEngine)暴露与 Native 完全一致的契约:
1094
- * - 下行:{@link onRecvWhiteboardCommand}(由 `trtcCloud.callExperimentalAPI('OnRecvWhiteboardCommand', ...)` 路由进来)
1095
- * - 上行:{@link WhiteboardDelegate#onSendWhiteboardCommand}(或 `on('onSendWhiteboardCommand', cb)` 事件)
1096
- *
1097
- * 内部依赖 Web 端 `Whiteboard` 插件完成本地渲染并合流到 VideoMixer,因此使用前必须先启动 VideoMixer
1098
- * (通常通过 `trtcCloud.getMediaMixingManager().bindPreviewArea(view)`)。
1099
- */
1100
1044
  declare class TRTCWhiteboardManager implements ITRTCWhiteboardManager {
1101
1045
  static whiteboardManager: TRTCWhiteboardManager | null;
1102
1046
  private readonly logPrefix;
1103
1047
  private logger;
1104
1048
  private trtc;
1105
- private trtcCloud;
1106
1049
  private eventEmitter;
1107
1050
  private delegate;
1108
- /** 白板插件是否已启动 */
1051
+ private pluginEventHandlers;
1052
+ private boundPlugin;
1109
1053
  private started;
1110
- /** 绑定交互事件的 view */
1111
1054
  private view;
1112
1055
  constructor(options: {
1113
1056
  logger: any;
1114
1057
  trtc: any;
1115
- trtcCloud: any;
1116
1058
  });
1117
- /**
1118
- * 设置上行数据回调(与 Native WhiteboardDelegate 对齐)
1119
- * @param delegate 回调实例,传 null 取消
1120
- */
1121
1059
  setDelegate(delegate: WhiteboardDelegate | null): void;
1122
- /**
1123
- * 处理下行指令 —— 对应 Native `OnRecvWhiteboardCommand`。
1124
- *
1125
- * @param command {@link WhiteboardRecvCommand}
1126
- */
1127
1060
  onRecvWhiteboardCommand(command: WhiteboardRecvCommand): Promise<void>;
1128
- /**
1129
- * 启动白板插件
1130
- */
1131
1061
  private _start;
1132
- /**
1133
- * 更新白板配置(视图、工具、颜色、线宽、交互)
1134
- */
1135
1062
  private _update;
1136
- /**
1137
- * 停止白板插件
1138
- */
1139
1063
  private _stop;
1140
- /**
1141
- * 执行本端操作(undo/redo/clearall)
1142
- */
1143
1064
  private _applyLocalOp;
1065
+ private _bindPluginEvents;
1066
+ private _offPluginEvents;
1067
+ private _getWhiteboardPlugin;
1068
+ private _emitWhiteboardEvent;
1144
1069
  /**
1145
1070
  * 远端协同指令(带 owner_id)。
1146
1071
  *
@@ -1149,32 +1074,14 @@ declare class TRTCWhiteboardManager implements ITRTCWhiteboardManager {
1149
1074
  * 远端笔迹点数据。因此这里对远端笔迹数据(xs/ys)不做注入,仅记录日志,保持与 Native 契约形态一致。
1150
1075
  */
1151
1076
  private _applyRemoteCommand;
1152
- /**
1153
- * native tool 配置 -> Web 插件 tool 分组对象({ name, color, lineWidth })
1154
- */
1155
1077
  private _buildToolGroup;
1156
- /**
1157
- * native whiteboard.interactive -> Web 插件 config 分组对象({ interactive })
1158
- */
1159
1078
  private _buildConfigGroup;
1160
- /**
1161
- * native canvas -> Web 插件 canvasInfo 分组对象({ width, height })
1162
- */
1163
1079
  private _buildCanvasInfo;
1164
- /**
1165
- * native op(undo|redo|clearall|clearself) -> Web 插件 operation(undo|redo|clear)
1166
- */
1167
1080
  private _opToOperation;
1168
1081
  /**
1169
1082
  * 颜色归一化:支持 '#RRGGBB' / '#AARRGGBB' / 0xAARRGGBB 整型 -> CSS 颜色字符串
1170
1083
  */
1171
1084
  private _normalizeColor;
1172
- /**
1173
- * 解析 view 句柄。
1174
- * - HTMLElement:直接使用
1175
- * - string:作为元素 id 查找
1176
- * - number(Native int64 句柄):Web 端无法使用,回退到 VideoMixer 默认 view
1177
- */
1178
1085
  private _resolveView;
1179
1086
  on(event: string, func: (...args: any[]) => void): void;
1180
1087
  off(event: string, func: (...args: any[]) => void): void;
@@ -2303,32 +2210,10 @@ declare class TRTC_Cloud extends EventEmitter {
2303
2210
  getMediaMixingManager(): TRTCMediaMixingManager;
2304
2211
  /**
2305
2212
  * 获取互动白板管理器
2306
- *
2307
- * 白板依赖 VideoMixer,使用前请先通过 `getMediaMixingManager().bindPreviewArea(view)` 启动 VideoMixer。
2308
- * 对上层(RoomEngine)的契约与 Native 对齐:
2309
- * - 下行:`callExperimentalAPI(JSON.stringify({ api: 'OnRecvWhiteboardCommand', params: {...} }))`
2310
- * - 上行:`getWhiteboardManager().setDelegate({ onSendWhiteboardCommand })`
2311
- * 或 `getWhiteboardManager().on('onSendWhiteboardCommand', (isNeedAck, payload) => {})`
2312
- *
2313
- * @example
2314
- * import TRTCCloud from 'trtc-cloud-js-sdk';
2315
- *
2316
- * const trtcCloud = TRTCCloud.getTRTCShareInstance();
2317
- * const whiteboardManager = trtcCloud.getWhiteboardManager();
2318
- * whiteboardManager.setDelegate({
2319
- * onSendWhiteboardCommand(isNeedAck, payload) {
2320
- * // 转发给远端
2321
- * },
2322
- * });
2323
- * trtcCloud.callExperimentalAPI(JSON.stringify({
2324
- * api: 'OnRecvWhiteboardCommand',
2325
- * params: { enable: 1, tool: { type: 'pen', color: '#ff0000', line_width: 3 } },
2326
- * }));
2327
- *
2328
2213
  * @returns {TRTCWhiteboardManager}
2329
2214
  */
2330
2215
  getWhiteboardManager(): TRTCWhiteboardManager;
2331
2216
  getAITranscriberManager(): AITranscriberManager;
2332
2217
  }
2333
2218
 
2334
- 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, WhiteboardOp, WhiteboardRecvCommand, WhiteboardSendPayload, WhiteboardToolConfig, WhiteboardToolType, TRTC_Cloud as default };
2219
+ 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 };