trtc-cloud-js-sdk 2.12.2-beta.14 → 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.14",
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,69 +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
- * Guest ACK 回路进入停滞状态的原因
968
- */
969
940
  declare type WhiteboardSessionStalledReason = 'silence' | 'queue-full';
970
- /**
971
- * 白板事件名
972
- */
973
941
  declare enum TRTCWhiteboardEvent {
974
942
  /** 上行:本端笔迹/操作数据,需上层转发给远端 */
975
943
  onSendWhiteboardCommand = "onSendWhiteboardCommand",
976
- /** 白板会话就绪,可开始交互 */
977
944
  STARTED = "started",
978
- /** 白板会话终止 */
979
945
  STOPPED = "stopped",
980
- /** 白板会话过程中的异步异常 */
981
946
  ERROR = "error",
982
- /** Guest ACK 反馈回路进入停滞状态 */
983
947
  SESSION_STALLED = "session-stalled",
984
- /** Guest ACK 反馈回路从停滞中恢复 */
985
948
  SESSION_RESUMED = "session-resumed",
986
- /** 撤销栈可用性变更 */
987
949
  UNDO_STATE_CHANGED = "undo-state-changed",
988
- /** 重做栈可用性变更 */
989
950
  REDO_STATE_CHANGED = "redo-state-changed"
990
951
  }
991
- /**
992
- * 工具配置
993
- */
994
952
  interface WhiteboardToolConfig {
995
- /** 工具类型,默认 pen */
996
953
  type?: WhiteboardToolType;
997
- /** 画笔颜色,支持 '#RRGGBB' / '#AARRGGBB' / 0xAARRGGBB 整型 */
998
954
  color?: string | number;
999
- /** 线宽 */
1000
955
  line_width?: number;
1001
- /** 仅 type === 'laser' 生效,激光轨迹淡出时间(毫秒),默认 1000,范围 [100, 10000] */
1002
956
  laserFadeDuration?: number;
1003
957
  }
1004
958
  declare const WhiteboardToolConfig: any;
1005
- /**
1006
- * 画布尺寸
1007
- */
1008
959
  interface WhiteboardCanvasInfo {
1009
960
  width: number;
1010
961
  height: number;
@@ -1020,9 +971,7 @@ declare const WhiteboardCanvasInfo: any;
1020
971
  interface WhiteboardRecvCommand {
1021
972
  /** 1=启用, 0=关闭;关闭时其余字段忽略 */
1022
973
  enable: number;
1023
- /** 笔迹 id */
1024
974
  stroke_id?: string;
1025
- /** 操作指令 undo|redo|clearall */
1026
975
  op?: WhiteboardOp;
1027
976
  /** 操作/笔迹归属用户;存在时表示这是一条远端协同指令 */
1028
977
  owner_id?: string;
@@ -1035,24 +984,15 @@ interface WhiteboardRecvCommand {
1035
984
  view_handle?: number | string | HTMLElement;
1036
985
  /** 接收 Native 回调数据的实例句柄(Web 端忽略,仅为兼容 Native 透传) */
1037
986
  whiteboard_delegate_handle?: number;
1038
- /** 画布尺寸 */
1039
987
  canvas?: WhiteboardCanvasInfo;
1040
- /** 工具配置 */
1041
988
  tool?: WhiteboardToolConfig;
1042
- /** 白板交互配置 */
1043
989
  whiteboard?: {
1044
- /** canvas 是否响应触摸/鼠标交互事件 */
1045
990
  interactive?: boolean;
1046
991
  };
1047
- /** 远端笔迹:是否首包(仅 pen) */
1048
992
  is_first?: boolean;
1049
- /** 远端笔迹颜色(与上行 payload 对齐) */
1050
993
  color?: string | number;
1051
- /** 远端笔迹线宽(line_width 简写,与上行 payload 对齐) */
1052
994
  lw?: number;
1053
- /** 远端笔迹 x 坐标序列(base64 编码,与上行 payload 对齐) */
1054
995
  xs?: string;
1055
- /** 远端笔迹 y 坐标序列(base64 编码,与上行 payload 对齐) */
1056
996
  ys?: string;
1057
997
  }
1058
998
  declare const WhiteboardRecvCommand: any;
@@ -1060,69 +1000,35 @@ declare const WhiteboardRecvCommand: any;
1060
1000
  * 上行回调 payload —— 与 Native `OnSendWhiteboardCommand` 的 payload 对齐。
1061
1001
  */
1062
1002
  interface WhiteboardSendPayload {
1063
- /** stroke_id */
1064
1003
  id: string;
1065
- /** 仅 pen 的时候发,首包哨兵 */
1066
1004
  is_first?: boolean;
1067
- /** 工具类型 */
1068
1005
  tool?: WhiteboardToolType;
1069
- /** 颜色 */
1070
1006
  color?: string;
1071
- /** 线宽 */
1072
1007
  lw?: number;
1073
- /** x 坐标序列(base64 编码) */
1074
1008
  xs?: string;
1075
- /** y 坐标序列(base64 编码) */
1076
1009
  ys?: string;
1077
- /** 操作指令 undo|redo|clearself */
1078
1010
  op?: WhiteboardOp;
1079
1011
  }
1080
1012
  declare const WhiteboardSendPayload: any;
1081
- /**
1082
- * session-stalled 事件 payload
1083
- */
1084
1013
  interface WhiteboardSessionStalledInfo {
1085
- /** 目标 Host 用户 */
1086
1014
  targetUser: string;
1087
- /** 待 ACK 队列中保留、等待 SESSION_START 批量重发的数量 */
1088
1015
  pendingCount: number;
1089
- /** 停滞原因:Host 静默或队列保护 */
1090
1016
  reason: WhiteboardSessionStalledReason;
1091
1017
  }
1092
1018
  declare const WhiteboardSessionStalledInfo: any;
1093
- /**
1094
- * session-resumed 事件 payload
1095
- */
1096
1019
  interface WhiteboardSessionResumedInfo {
1097
- /** 目标 Host 用户 */
1098
1020
  targetUser: string;
1099
- /** 从停滞状态恢复后重发的数量 */
1100
1021
  resentCount: number;
1101
1022
  }
1102
1023
  declare const WhiteboardSessionResumedInfo: any;
1103
- /**
1104
- * undo/redo 可用性变更事件 payload
1105
- */
1106
1024
  interface WhiteboardHistoryStateChangedInfo {
1107
- /** 当前是否可执行 undo/redo */
1108
1025
  available: boolean;
1109
1026
  }
1110
1027
  declare const WhiteboardHistoryStateChangedInfo: any;
1111
- /**
1112
- * 白板上行数据回调通道 —— 与 Native `WhiteboardDelegate` 对齐。
1113
- */
1114
1028
  interface WhiteboardDelegate {
1115
- /**
1116
- * Native/SDK 返回给上层 room 的信令数据
1117
- * @param isNeedAck 是否需要 ack
1118
- * @param payload JSON 字符串,结构见 {@link WhiteboardSendPayload}
1119
- */
1120
1029
  onSendWhiteboardCommand(isNeedAck: boolean, payload: string): void;
1121
1030
  }
1122
1031
  declare const WhiteboardDelegate: any;
1123
- /**
1124
- * 白板管理器对外接口
1125
- */
1126
1032
  interface ITRTCWhiteboardManager {
1127
1033
  /** 设置上行数据回调(与 Native WhiteboardDelegate 对齐) */
1128
1034
  setDelegate(delegate: WhiteboardDelegate | null): void;
@@ -1135,61 +1041,26 @@ interface ITRTCWhiteboardManager {
1135
1041
  }
1136
1042
  declare const ITRTCWhiteboardManager: any;
1137
1043
 
1138
- /**
1139
- * 互动白板管理器
1140
- *
1141
- * 对上层(RoomEngine)暴露与 Native 完全一致的契约:
1142
- * - 下行:{@link onRecvWhiteboardCommand}(由 `trtcCloud.callExperimentalAPI('OnRecvWhiteboardCommand', ...)` 路由进来)
1143
- * - 上行:{@link WhiteboardDelegate#onSendWhiteboardCommand}(或 `on('onSendWhiteboardCommand', cb)` 事件)
1144
- *
1145
- * 内部依赖 Web 端 `Whiteboard` 插件完成本地渲染并合流到 VideoMixer,因此使用前必须先启动 VideoMixer
1146
- * (通常通过 `trtcCloud.getMediaMixingManager().bindPreviewArea(view)`)。
1147
- */
1148
1044
  declare class TRTCWhiteboardManager implements ITRTCWhiteboardManager {
1149
1045
  static whiteboardManager: TRTCWhiteboardManager | null;
1150
1046
  private readonly logPrefix;
1151
1047
  private logger;
1152
1048
  private trtc;
1153
- private trtcCloud;
1154
1049
  private eventEmitter;
1155
1050
  private delegate;
1156
1051
  private pluginEventHandlers;
1157
1052
  private boundPlugin;
1158
- /** 白板插件是否已启动 */
1159
1053
  private started;
1160
- /** 绑定交互事件的 view */
1161
1054
  private view;
1162
1055
  constructor(options: {
1163
1056
  logger: any;
1164
1057
  trtc: any;
1165
- trtcCloud: any;
1166
1058
  });
1167
- /**
1168
- * 设置上行数据回调(与 Native WhiteboardDelegate 对齐)
1169
- * @param delegate 回调实例,传 null 取消
1170
- */
1171
1059
  setDelegate(delegate: WhiteboardDelegate | null): void;
1172
- /**
1173
- * 处理下行指令 —— 对应 Native `OnRecvWhiteboardCommand`。
1174
- *
1175
- * @param command {@link WhiteboardRecvCommand}
1176
- */
1177
1060
  onRecvWhiteboardCommand(command: WhiteboardRecvCommand): Promise<void>;
1178
- /**
1179
- * 启动白板插件
1180
- */
1181
1061
  private _start;
1182
- /**
1183
- * 更新白板配置(视图、工具、颜色、线宽、交互)
1184
- */
1185
1062
  private _update;
1186
- /**
1187
- * 停止白板插件
1188
- */
1189
1063
  private _stop;
1190
- /**
1191
- * 执行本端操作(undo/redo/clearall)
1192
- */
1193
1064
  private _applyLocalOp;
1194
1065
  private _bindPluginEvents;
1195
1066
  private _offPluginEvents;
@@ -1203,32 +1074,14 @@ declare class TRTCWhiteboardManager implements ITRTCWhiteboardManager {
1203
1074
  * 远端笔迹点数据。因此这里对远端笔迹数据(xs/ys)不做注入,仅记录日志,保持与 Native 契约形态一致。
1204
1075
  */
1205
1076
  private _applyRemoteCommand;
1206
- /**
1207
- * native tool 配置 -> Web 插件 tool 分组对象({ name, color, lineWidth })
1208
- */
1209
1077
  private _buildToolGroup;
1210
- /**
1211
- * native whiteboard.interactive -> Web 插件 config 分组对象({ interactive })
1212
- */
1213
1078
  private _buildConfigGroup;
1214
- /**
1215
- * native canvas -> Web 插件 canvasInfo 分组对象({ width, height })
1216
- */
1217
1079
  private _buildCanvasInfo;
1218
- /**
1219
- * native op(undo|redo|clearall|clearself) -> Web 插件 operation(undo|redo|clear)
1220
- */
1221
1080
  private _opToOperation;
1222
1081
  /**
1223
1082
  * 颜色归一化:支持 '#RRGGBB' / '#AARRGGBB' / 0xAARRGGBB 整型 -> CSS 颜色字符串
1224
1083
  */
1225
1084
  private _normalizeColor;
1226
- /**
1227
- * 解析 view 句柄。
1228
- * - HTMLElement:直接使用
1229
- * - string:作为元素 id 查找
1230
- * - number(Native int64 句柄):Web 端无法使用,回退到 VideoMixer 默认 view
1231
- */
1232
1085
  private _resolveView;
1233
1086
  on(event: string, func: (...args: any[]) => void): void;
1234
1087
  off(event: string, func: (...args: any[]) => void): void;
@@ -2357,28 +2210,6 @@ declare class TRTC_Cloud extends EventEmitter {
2357
2210
  getMediaMixingManager(): TRTCMediaMixingManager;
2358
2211
  /**
2359
2212
  * 获取互动白板管理器
2360
- *
2361
- * 白板依赖 VideoMixer,使用前请先通过 `getMediaMixingManager().bindPreviewArea(view)` 启动 VideoMixer。
2362
- * 对上层(RoomEngine)的契约与 Native 对齐:
2363
- * - 下行:`callExperimentalAPI(JSON.stringify({ api: 'OnRecvWhiteboardCommand', params: {...} }))`
2364
- * - 上行:`getWhiteboardManager().setDelegate({ onSendWhiteboardCommand })`
2365
- * 或 `getWhiteboardManager().on('onSendWhiteboardCommand', (isNeedAck, payload) => {})`
2366
- *
2367
- * @example
2368
- * import TRTCCloud from 'trtc-cloud-js-sdk';
2369
- *
2370
- * const trtcCloud = TRTCCloud.getTRTCShareInstance();
2371
- * const whiteboardManager = trtcCloud.getWhiteboardManager();
2372
- * whiteboardManager.setDelegate({
2373
- * onSendWhiteboardCommand(isNeedAck, payload) {
2374
- * // 转发给远端
2375
- * },
2376
- * });
2377
- * trtcCloud.callExperimentalAPI(JSON.stringify({
2378
- * api: 'OnRecvWhiteboardCommand',
2379
- * params: { enable: 1, tool: { type: 'pen', color: '#ff0000', line_width: 3 } },
2380
- * }));
2381
- *
2382
2213
  * @returns {TRTCWhiteboardManager}
2383
2214
  */
2384
2215
  getWhiteboardManager(): TRTCWhiteboardManager;