quickvo-sdk-js 1.6.71 → 1.6.73

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.
Files changed (45) hide show
  1. package/dist/chunk-BXUcB7os.js +58 -0
  2. package/dist/index.js +18438 -18577
  3. package/dist/index.umd.cjs +4 -4
  4. package/dist/lib-9TnBQie8.js +11083 -0
  5. package/dist/src/action/ActionSFU.d.ts +12 -23
  6. package/dist/src/action/Task.d.ts +3 -27
  7. package/dist/src/base/Base.d.ts +1 -1
  8. package/dist/src/base/modules/Notifys.d.ts +15 -5
  9. package/dist/src/base/modules/Peer.d.ts +17 -1
  10. package/dist/src/base/modules/cws/CallsWebSocket.d.ts +34 -22
  11. package/dist/src/base/modules/cws/CallsWebSocketEvent.d.ts +7 -8
  12. package/dist/src/base/modules/cws/PrWebSocket.d.ts +2 -0
  13. package/dist/src/base/modules/users/Users.d.ts +3 -7
  14. package/dist/src/base/modules/users/modules/RemotePeerTrackAnalysis.d.ts +5 -0
  15. package/dist/src/base/modules/users/modules/RemoteUser.d.ts +6 -0
  16. package/dist/src/base/modules/users/modules/RemoteUserP2P.d.ts +3 -5
  17. package/dist/src/base/modules/users/modules/UserBase.d.ts +14 -2
  18. package/dist/src/base/modules/webmDurationFixWorkerMain.d.ts +2 -0
  19. package/dist/src/enums/eventName.d.ts +6 -1
  20. package/dist/src/enums/mediaType.d.ts +3 -0
  21. package/dist/src/enums/notifyName.d.ts +3 -1
  22. package/dist/src/index.d.ts +0 -4
  23. package/dist/src/protos/gen/{modules/BaseData_pb.d.ts → BaseData_pb.d.ts} +2 -2
  24. package/dist/src/protos/gen/{modules/Room_pb.d.ts → Room_pb.d.ts} +16 -90
  25. package/dist/src/protos/gen/Rtc_pb.d.ts +154 -0
  26. package/dist/src/protos/index.d.ts +3 -4
  27. package/dist/src/protos/protoEvent.d.ts +76 -146
  28. package/dist/src/tools.d.ts +1 -1
  29. package/dist/src/types.d.ts +0 -12
  30. package/dist/src/workers/protos/WorkerCore.d.ts +8 -0
  31. package/dist/src/workers/protos/index.d.ts +10 -0
  32. package/dist/src/workers/protos/types.d.ts +8 -0
  33. package/package.json +6 -5
  34. package/dist/chunk-C3ZmwZ-K.js +0 -57
  35. package/dist/index.d.ts +0 -2
  36. package/dist/lib-Cen0reYH.js +0 -11194
  37. package/dist/src/QuickVO.d.ts +0 -85
  38. package/dist/src/base/modules/cws/quickvoCodecWorkerMain.d.ts +0 -6
  39. package/dist/src/base/modules/notifyPayloadMap.d.ts +0 -119
  40. package/dist/src/protos/gen/modules/Rtc_pb.d.ts +0 -70
  41. package/dist/src/protos/protoCodec.d.ts +0 -19
  42. package/dist/src/workers/cwsCodec/CwsCodecCore.d.ts +0 -7
  43. package/dist/src/workers/cwsCodec/CwsCodecWorker.d.ts +0 -15
  44. package/dist/src/workers/cwsCodec/type.d.ts +0 -33
  45. /package/dist/src/workers/{cwsCodec/cwsCodec.worker.d.ts → protos/protos.worker.d.ts} +0 -0
@@ -9,6 +9,8 @@ export declare class ActionSFU {
9
9
  private _networkCalculating;
10
10
  /** 上次打印 generateTrackAnalysis 超时告警的时间,用于限流(每 30 秒最多一次) */
11
11
  private _lastTrackAnalysisWarnTime;
12
+ /** `genTurnAddress.expiresAt` 到期前 1 分钟:`_fetchGenTurnAddress` + `peer.setTurnConfiguration`(不 init PC) */
13
+ private _turnRefreshTimerId?;
12
14
  /** 避免 Math.max(...arr) 在极大数组上触达引擎参数长度限制 */
13
15
  private static _maxInNumberArray;
14
16
  private static _minInNumberArray;
@@ -22,10 +24,7 @@ export declare class ActionSFU {
22
24
  private _syncRoomInfoTask;
23
25
  private _restorePeerTask;
24
26
  private _quitRoomTask;
25
- /** 串行化 joinRoom,避免并发进房互相覆盖 config / 用户列表 / 连接状态 */
26
- private _joinRoomSerial;
27
- /** 合并同一宏任务内多次 _autoCheckSubscribe 触发 */
28
- private _autoCheckSubscribeCoalesce;
27
+ private _lastUpdateNetworkTime;
29
28
  constructor({ base }: {
30
29
  base: Base;
31
30
  });
@@ -76,14 +75,14 @@ export declare class ActionSFU {
76
75
  * @param usersMediaTypes: UserMediaTypes[] = [] 不传入订阅所有
77
76
  * @example quickvo.subscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
78
77
  */
79
- subscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<true>;
78
+ subscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<true | undefined>;
80
79
  /**
81
80
  * stopSubscribe
82
81
  * @param usersMediaTypes: UserMediaTypes[] = [] 不传入取消订阅所有
83
82
  * @example quickvo.stopSubscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
84
83
  * @returns Promise<boolean>
85
84
  */
86
- stopSubscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<true>;
85
+ stopSubscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<true | undefined>;
87
86
  /**
88
87
  * quitRoom
89
88
  * @example quickvo.quitRoom()
@@ -103,7 +102,7 @@ export declare class ActionSFU {
103
102
  setBehaviors: (usersBehaviors: Array<{
104
103
  id: string;
105
104
  behaviors: { [key in K_mediaType]?: boolean; };
106
- }>) => Promise<import('../protos/protoEvent').MessageRspCore<"preventUsersBehavior">>;
105
+ }>) => Promise<import('../protos/protoEvent').MessageRsp<"preventUsersBehavior">>;
107
106
  /**
108
107
  * toggleRoomSpeechLang
109
108
  * @param data { input: string; output: string; translateEnable?: boolean }
@@ -126,35 +125,21 @@ export declare class ActionSFU {
126
125
  * destroy
127
126
  */
128
127
  destroy: () => Promise<void>;
129
- private _scheduleAutoCheckSubscribe;
130
- private _waitPeerThenSubscribeTask;
131
128
  private _clearTask;
132
129
  private _clear;
133
130
  private _connectCws;
134
- /** joinRoom 专用:已 OPEN 则跳过;否则最多 3 次建连,单次超时 10s,均失败则 throw */
135
- private static _JOIN_ROOM_WS_ATTEMPTS;
136
- private static _JOIN_ROOM_WS_TIMEOUT_MS;
137
- private _ensureWebSocketBeforeJoinRoom;
138
- /**
139
- * SFU Peer 建连:最多 3 次 `_connectCF`;单次信令(genTurnAddress / publish)超时 10s;ICE 等待 10s(见 `_connectCF` 内 `peerConnected`)。
140
- * 用于进房与 disconnected→closed 后的 `_restorePeer`。
141
- */
142
- private static _RTC_RECOVERY_ATTEMPTS;
143
- private static _RTC_RECOVERY_CWS_TIMEOUT_MS;
144
- private _connectCFWithRecoveryRetries;
145
- private _ensureWebRtcForJoinRoom;
146
131
  private _initHeartbeat;
147
132
  /** 向服务端拉取 TURN/STUN 配置;失败或未返回有效 iceServers 时返回 undefined,由 Peer 回退默认 STUN */
148
133
  private _fetchGenTurnAddress;
134
+ private _refreshTurnViaSetConfiguration;
149
135
  private _connectCF;
150
136
  private _reportNetwork;
151
137
  private _createTracks;
152
138
  private _closeTrack;
153
139
  private _pubNotify;
140
+ private _submitRtcStats;
154
141
  private _renegotiate;
155
142
  private _ackMsg;
156
- private _acquireJoinRoomSerial;
157
- private _joinRoomExecute;
158
143
  private _autoCheckSubscribe;
159
144
  private _onRemoteUsersQuitRoom;
160
145
  private _notifySelfCallAction;
@@ -163,5 +148,9 @@ export declare class ActionSFU {
163
148
  private _hasAsyncTask;
164
149
  private _syncRoomInfo;
165
150
  private _restorePeer;
151
+ private _pubChannel;
152
+ private _closeChannel;
153
+ private _checkAndSubChannel;
154
+ private _emitSelfNetworkQualityChange;
166
155
  _restoreRoom: () => Promise<void>;
167
156
  }
@@ -1,40 +1,16 @@
1
- export type TaskExeOptions = {
2
- /**
3
- * 默认 true:防抖结束后执行 fn,用其返回值 resolve,异常则 reject。
4
- * false:仅调用 fn,由 fn 内部通过 task.resolve / task.reject 结束(如订阅队列回调)。
5
- */
6
- settle?: boolean;
7
- };
8
- /**
9
- * 异步任务与防抖:constructor(debounceMs) 防抖毫秒数,默认 0。
10
- * 多次 exe 会重置防抖;若需放弃上一轮可先判断 state === 'waiting' 再 clear()。
11
- */
12
1
  export declare class Task<R = true> {
13
2
  private readonly debounceMs;
14
3
  private timer?;
15
- /** 每次调度 / 清理 / 手动 settle 递增,用于丢弃过期的 setTimeout / microtask */
16
- private scheduleGen;
17
4
  state: 'ready' | 'waiting';
18
5
  promise?: Promise<R>;
19
6
  private _resolve?;
20
7
  private _reject?;
21
8
  private pendingFn?;
22
- private pendingSettle;
23
9
  constructor(debounceMs?: number);
24
- /** ready 进入 waiting 并创建 promise(不启动防抖);用于 debounce 前仍需 await 其它逻辑的场景 */
25
- begin(): Promise<R>;
26
- /**
27
- * 注册待执行函数:在防抖时间结束后执行。
28
- * 若当前为 ready,会先 begin;若已在 waiting,会复用同一 promise 并重置防抖(尾触发)。
29
- */
30
- exe(fn: () => unknown | Promise<unknown>, options?: TaskExeOptions): Promise<R>;
31
- /**
32
- * 典型用于 publish:先 begin 占位,再 await prepare(如补本地流),最后对 fn 做防抖调度。
33
- */
34
- beginPrepareThenExe(prepare: () => void | Promise<void>, fn: () => unknown | Promise<unknown>): Promise<R>;
10
+ begin: () => void;
11
+ exe: (fn: () => unknown | Promise<unknown>) => Promise<R>;
35
12
  private _runFlush;
36
- resolve: (value: R) => void;
13
+ resolve: (value: any) => void;
37
14
  reject: (error: unknown) => void;
38
- /** SDK 内部清理:取消待执行的防抖,并以 resolve 结束,避免对外 Promise rejection */
39
15
  clear: () => void;
40
16
  }
@@ -57,7 +57,7 @@ export declare class Base {
57
57
  mediaTypes: K_mediaType[];
58
58
  desc?: string;
59
59
  connectedTime?: string;
60
- }) => Promise<import('../protos/protoEvent').MessageRspCore<"reportP2PConnectEx">> | undefined;
60
+ }) => Promise<import('../protos/protoEvent').MessageRsp<"reportP2PConnectEx">> | undefined;
61
61
  _reportLog: (_type: Report_Log_Type, describe?: string) => void;
62
62
  }
63
63
  export {};
@@ -1,12 +1,21 @@
1
- import { K_quickvoNotifyName, NotifyPayloadMap, QuickvoNotify } from './notifyPayloadMap';
2
- export type { K_quickvoNotifyName, NotifyPayloadMap, QuickvoNotify, NotifyEmitPayloadFor, NotifyEmitPayloadUnion } from './notifyPayloadMap';
3
- export { defineQuickvoNotify } from './notifyPayloadMap';
1
+ import { K_notifyName as _K_notifyName } from '../../enums';
2
+ type K_notifyName = _K_notifyName | 'onRoomState' | 'onPeerState' | 'onLog' | 'onDevicechange' | 'onRoomUsers' | 'onRoomNetwork';
3
+ export interface MessageNotifys {
4
+ code: number;
5
+ desc: string;
6
+ data: any;
7
+ }
8
+ interface QuickvoNotify {
9
+ event: K_notifyName;
10
+ callback: Function;
11
+ sn?: string;
12
+ }
4
13
  export declare class Notifys {
5
- queue: Map<K_quickvoNotifyName, QuickvoNotify[]>;
14
+ queue: Map<K_notifyName, QuickvoNotify[]>;
6
15
  /**
7
16
  * 派发广播事件(第二参类型随 event 变化)
8
17
  */
9
- emit: <E extends K_quickvoNotifyName>(event: E, result: NotifyPayloadMap[E]) => void;
18
+ emit: <E extends K_notifyName>(event: E, result: MessageNotifys) => void;
10
19
  /**
11
20
  * 添加广播
12
21
  * @param notify
@@ -14,3 +23,4 @@ export declare class Notifys {
14
23
  */
15
24
  add: (notify: QuickvoNotify) => string;
16
25
  }
26
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { K_mediaType } from '../../enums/mediaType';
2
- import { TurnUrlsResponse } from '../../protos/gen/modules/Room_pb';
2
+ import { TurnUrlsResponse } from '../../protos/gen/Room_pb';
3
3
  import { Config } from './Config';
4
4
  import { Users } from './users/Users';
5
5
  import { PrResolves } from './PrResolves';
@@ -23,6 +23,8 @@ export declare class Peer {
23
23
  simulcast: 'f' | 'h' | 'q';
24
24
  /** 当前 SFU 连接使用的 TURN 配置过期时间(毫秒,来自 genTurnAddress.expiresAt) */
25
25
  turnExpiresAtMs?: number;
26
+ channels: Map<string, RTCDataChannel>;
27
+ _channelDebug: boolean;
26
28
  on: On;
27
29
  waitings: {
28
30
  peerConnected: () => Promise<unknown>;
@@ -42,6 +44,20 @@ export declare class Peer {
42
44
  */
43
45
  setRTCRtpSenderParameters: (parameters: Partial<RTCRtpSendParameters>, mediaTypes?: K_mediaType[]) => Promise<void>;
44
46
  init: (turnRsp?: TurnUrlsResponse) => Promise<void>;
47
+ /**
48
+ * TURN 凭证将过期时:不销毁 PC,仅 `setConfiguration` 更新 ICE(与 init 同源),并尽量 `restartIce` 以用新 relay。
49
+ */
50
+ setTurnConfiguration: (turnRsp?: TurnUrlsResponse) => void;
51
+ localChannelSend: (data: any) => Promise<void>;
52
+ addLocalUserChannel: (id?: number) => void;
53
+ addRemoteUserChannel: (userId: string, id?: number) => void;
54
+ clearChannels: (ids?: string[]) => {
55
+ userId: string;
56
+ channels: {
57
+ id?: number;
58
+ dataChannelName: string;
59
+ }[];
60
+ }[];
45
61
  close: () => void;
46
62
  addSenders: (mediaTypes: K_mediaType[]) => Promise<("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[]>;
47
63
  syncSenderStreamTrack: (mediaTypes: K_mediaType[]) => Promise<void>;
@@ -1,35 +1,47 @@
1
1
  import { K_eventName } from '../../../enums/eventName';
2
- import { CallsWebSocketOn } from '../../../protos/protoEvent';
3
2
  import { Options, CallsWebSocketEvent } from './CallsWebSocketEvent';
4
3
  import { Config } from '../Config';
5
4
  import { PrWebSocket } from './PrWebSocket';
6
- export type { CallsWebSocketOn };
7
- /**
8
- * 从 IndexedDB 读取 `#quickvo.logs` 并触发浏览器下载 JSON 文件(控制台可执行 `getQVLogs()`)。
9
- */
10
- export declare function getQVLogs(): Promise<void>;
11
- export interface CallsWebSocketOptions {
12
- /**
13
- * websocket服务地址
14
- */
15
- url?: string;
16
- /**
17
- * 超时时间
18
- */
19
- timeout?: number;
20
- /**
21
- * 开启后会在控制台显示相关操作日志 默认为false
22
- */
23
- debug?: boolean;
24
- }
5
+ import { WorkerProtos } from '../../../workers/protos';
6
+ import { MessageNotifys } from '../../../protos/protoEvent';
25
7
  type EventsItems = Map<number, CallsWebSocketEvent<any>>;
26
8
  type Events = Map<K_eventName, EventsItems>;
9
+ interface On {
10
+ state?: (state: 'connecting' | 'connected' | 'reconnecting' | 'closed') => void;
11
+ log?: (e: unknown) => void;
12
+ onJoinRoom?: (e: MessageNotifys<'onJoinRoom'>) => void;
13
+ onJoinRoomBatch?: (e: MessageNotifys<'onJoinRoomBatch'>) => void;
14
+ onQuitRoom?: (e: MessageNotifys<'onQuitRoom'>) => void;
15
+ onQuitRoomBatch?: (e: MessageNotifys<'onQuitRoomBatch'>) => void;
16
+ onPublish?: (e: MessageNotifys<'onPublish'>) => void;
17
+ onDataChannelPublish?: (e: MessageNotifys<'onDataChannelPublish'>) => void;
18
+ onCloseTrack?: (e: MessageNotifys<'onCloseTrack'>) => void;
19
+ onTrackInactive?: (e: MessageNotifys<'onTrackInactive'>) => void;
20
+ onUpdatePermissions?: (e: MessageNotifys<'onUpdatePermissions'>) => void;
21
+ onUpdatePermissionsBatch?: (e: MessageNotifys<'onUpdatePermissionsBatch'>) => void;
22
+ onUpdateBehavior?: (e: MessageNotifys<'onUpdateBehavior'>) => void;
23
+ onRoomActionChange?: (e: MessageNotifys<'onRoomActionChange'>) => void;
24
+ onMeetSpecialRolesChange?: (e: MessageNotifys<'onMeetSpecialRolesChange'>) => void;
25
+ onUpdateCall?: (e: MessageNotifys<'onUpdateCall'>) => void;
26
+ onRoomUserSpeech?: (e: MessageNotifys<'onRoomUserSpeech'>) => void;
27
+ onBeforeTokenExpire?: (e: MessageNotifys<'onBeforeTokenExpire'>) => void;
28
+ onTokenExpired?: (e: MessageNotifys<'onTokenExpired'>) => void;
29
+ onCDNPlayUrlAdd?: (e: MessageNotifys<'onCDNPlayUrlAdd'>) => void;
30
+ onNetQuality?: (e: MessageNotifys<'onNetQuality'>) => void;
31
+ onOffer?: (e: MessageNotifys<'onOffer'>) => void;
32
+ onAnswer?: (e: MessageNotifys<'onAnswer'>) => void;
33
+ onCandidate?: (e: MessageNotifys<'onCandidate'>) => void;
34
+ onAttemptP2PEx?: (e: MessageNotifys<'onAttemptP2PEx'>) => void;
35
+ onRtcStats?: (e: MessageNotifys<'onRtcStats'>) => void;
36
+ onDisconnectedP2P?: (e: MessageNotifys<'onDisconnectedP2P'>) => void;
37
+ }
27
38
  export declare class CallsWebSocket {
28
39
  config: Config;
29
40
  timeout: number;
30
41
  prws: PrWebSocket;
42
+ workerProtos: WorkerProtos;
31
43
  events: Events;
32
- on: CallsWebSocketOn;
44
+ on: On;
33
45
  /** 日志写入节流:先入内存缓冲,定时批量写 IndexedDB(structured clone 可保留 BigInt) */
34
46
  private _logBuffer;
35
47
  private _logFlushTimer;
@@ -45,8 +57,8 @@ export declare class CallsWebSocket {
45
57
  createRequest: <T extends K_eventName>(eventName: T, options?: Options) => CallsWebSocketEvent<T>;
46
58
  hasEvent: (eventName: K_eventName) => boolean;
47
59
  clearEvents: () => void;
48
- private _dispatchCwsDecodedMessage;
49
60
  retryEvents: () => Promise<void>;
50
61
  private _updateLogs;
51
62
  private _flushLogs;
52
63
  }
64
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { K_eventName } from '../../../enums/eventName';
2
- import { MessageReq, MessageRsp, MessageRspCore } from '../../../protos/protoEvent';
2
+ import { MessageReq, MessageRsp } from '../../../protos/protoEvent';
3
3
  import { PrWebSocket } from './PrWebSocket';
4
4
  export interface Options {
5
5
  /**
6
- * 超时时间 默认10s
6
+ * 超时时间 默认30s
7
7
  */
8
8
  timeout?: number;
9
9
  /**
@@ -14,23 +14,22 @@ export interface Options {
14
14
  export declare class CallsWebSocketEvent<T extends K_eventName> {
15
15
  eventName: K_eventName;
16
16
  prws: PrWebSocket;
17
- message?: MessageReq<T>;
17
+ message?: any;
18
18
  needRetry: boolean;
19
19
  sn: number;
20
- _resolve: (_value: MessageRspCore<T>) => void;
20
+ _resolve: (_value: MessageRsp<T>) => void;
21
21
  _reject: (_reason?: unknown) => void;
22
- sendBefore?: (_message: MessageReq<T>) => void;
23
- sendAfter?: () => void;
22
+ sender?: (_message: any) => void;
24
23
  options: {
25
24
  timeout: number;
26
25
  onBack: boolean;
27
26
  };
28
27
  timer: number;
29
28
  constructor(eventName: T, prws: PrWebSocket, options?: Options);
30
- resolve: (_value: MessageRspCore<T> & Partial<Pick<MessageRsp<T>, "time">>) => void;
29
+ resolve: (_value: MessageRsp<T>) => void;
31
30
  reject: (_reason?: unknown) => void;
32
31
  retry: () => void;
33
- send: (req_message: Pick<MessageReq<T>, "data" | "compress" | "version">) => Promise<MessageRspCore<T>>;
32
+ send: (req_message: Partial<MessageReq<T>> & Pick<MessageReq<T>, "data">) => Promise<MessageRsp<T>>;
34
33
  private sendMsg;
35
34
  private _createTimer;
36
35
  destroy: () => void;
@@ -20,6 +20,8 @@ export declare class PrWebSocket {
20
20
  activeTimeStamp: number;
21
21
  on: On;
22
22
  getUrl: () => string;
23
+ /** 递增后可使尚未触发的 connect 超时回调不再对当前 socket 调用 close(避免误关下一次建连) */
24
+ private _connectGen;
23
25
  constructor();
24
26
  connect: () => Promise<number>;
25
27
  /**
@@ -1,6 +1,6 @@
1
1
  import { K_mediaType } from '../../../enums/mediaType';
2
2
  import { UserMediaTypes, UserTrack } from '../../../types';
3
- import { User as ProtoUser } from '../../../protos/gen/modules/Room_pb';
3
+ import { User as ProtoUser } from '../../../protos/gen/Room_pb';
4
4
  import { Config } from '../Config';
5
5
  import { LocalMedias } from '../LocalMedias';
6
6
  import { Notifys } from '../Notifys';
@@ -159,7 +159,7 @@ export declare class Users {
159
159
  }[];
160
160
  p2p_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
161
161
  }[];
162
- emitUsersChange: () => void;
162
+ emitUsersChange: (force?: boolean) => void;
163
163
  /**
164
164
  * getMaxVolumeUser
165
165
  */
@@ -205,10 +205,6 @@ export declare class Users {
205
205
  createRemoteUser: (userId: string) => RemoteUser;
206
206
  checkRemoteUser: (userId: string) => boolean;
207
207
  removeRemoteUser: (userId: string) => void;
208
- /**
209
- * onPublish:更新已存在的远端用户轨道与通话状态(列表外用户返回 false,由上层忽略)
210
- */
211
- applyRemoteUserPublishNotify: (user: Pick<ProtoUser, "id"> & Partial<Pick<ProtoUser, "callAction" | "tracks">>) => boolean;
212
208
  /**
213
209
  * 远端退出房间:剥离用户并汇总需 SFU 侧 stopReceivers / closeTrack 的 mid 与轨道
214
210
  */
@@ -224,7 +220,7 @@ export declare class Users {
224
220
  mids: string[];
225
221
  }[];
226
222
  updateUsersIsAdmin: (adminIds?: string[]) => void;
227
- initUsers: (users: ProtoUser[], clear: boolean) => void;
223
+ initUsers: (users: ProtoUser[]) => void;
228
224
  clearRemoteUsers: () => void;
229
225
  createRemoteUserP2P: (userId: string) => RemoteUserP2P;
230
226
  syncRemoteUserP2PSenderStreamTrack: (mediaTypes: K_mediaType[]) => Promise<void>;
@@ -13,6 +13,11 @@ export declare class RemotePeerTrackAnalysis {
13
13
  * 使用已筛选的 stats 子集更新网络信息
14
14
  */
15
15
  applyFromReports: (reports: ReportInfo[]) => TrackReport;
16
+ /**
17
+ * 本端 SFU inbound 丢包与对端 DataChannel 上报的上行丢包(RtcStatsData)取较小值,再重算 quality,
18
+ * 用于弱化「他端→SFU」问题对本端下行判定的影响。
19
+ */
20
+ blendDownlinkLostWithPeerUplink: (peerPacketsLostRate: number | undefined) => void;
16
21
  /**
17
22
  * 生成网络信息(单轨 getStats,兼容旧调用)
18
23
  */
@@ -1,5 +1,6 @@
1
1
  import { UserBase } from './UserBase';
2
2
  import { K_mediaType } from '../../../../enums/mediaType';
3
+ import { RtcStatsData } from '../../../../protos/gen/Rtc_pb';
3
4
  import { LocalMedias } from '../../LocalMedias';
4
5
  import { RemoteUserP2P } from './RemoteUserP2P';
5
6
  import { Config } from '../../Config';
@@ -36,6 +37,8 @@ export declare class RemoteUser extends UserBase {
36
37
  [key in K_mediaType]?: HTMLAudioElement;
37
38
  };
38
39
  p2p?: RemoteUserP2P;
40
+ /** 对端经 SFU DataChannel 广播的 RtcStatsData(上行轨统计),用于本端计算其 SFU 下行时与 inbound 丢包取 min */
41
+ peerRtcStats?: RtcStatsData;
39
42
  constructor({ config, localMedias }: {
40
43
  config: Config;
41
44
  localMedias: LocalMedias;
@@ -45,6 +48,9 @@ export declare class RemoteUser extends UserBase {
45
48
  subscribed_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
46
49
  };
47
50
  setSubscribed: (mediaTypes: K_mediaType[], subscribed: boolean) => void;
51
+ /** 缓存对端 `localChannelSend(RtcStatsData)` 载荷;`userId` 须与本 RemoteUser.id 一致 */
52
+ setPeerRtcStats: (data: RtcStatsData) => void;
53
+ private getPeerUplinkLostRateForMediaType;
48
54
  getTrackReports: (origin: "sfu" | "p2p", direction: "sends" | "recvs", mediaType: K_mediaType) => import('../../../..').TrackReport | undefined;
49
55
  generateTrackAnalysis: (peer: Peer, sfuStats: RTCStatsReport, p2pStats: RTCStatsReport | null) => Promise<void>;
50
56
  useRemoteStream: (mediaTypes: K_mediaType[], peer: Peer) => void;
@@ -1,8 +1,6 @@
1
1
  import { PrResolves } from '../../PrResolves';
2
- import { SendMessageFormat } from '../../../../protos/protoEvent';
3
- import { RtcTrack } from '../../../../protos/gen/modules/Rtc_pb';
4
- import { Track } from '../../../../protos/gen/modules/Room_pb';
5
- import { K_eventName } from '../../../../enums/eventName';
2
+ import { RtcTrack } from '../../../../protos/gen/Rtc_pb';
3
+ import { Track } from '../../../../protos/gen/Room_pb';
6
4
  import { K_mediaType } from '../../../../enums/mediaType';
7
5
  import { Config } from '../../Config';
8
6
  export interface MediaTypeTransceiver {
@@ -45,7 +43,7 @@ export declare class RemoteUserP2P {
45
43
  config: Config;
46
44
  remoteUserId: string;
47
45
  });
48
- remoteChannelSend: <T extends K_eventName>(message: Pick<SendMessageFormat<T>, "event" | "data"> & Partial<Omit<SendMessageFormat<T>, "event" | "data">>) => Promise<void>;
46
+ remoteChannelSend: (tracks: RtcTrack[]) => Promise<void>;
49
47
  init: () => void;
50
48
  getSenderTrack: (mediaType: K_mediaType) => MediaStreamTrack | null | undefined;
51
49
  getRecvierTrack: (mediaType: K_mediaType) => MediaStreamTrack | undefined;
@@ -28,6 +28,13 @@ export declare class UserBase {
28
28
  tracks: {
29
29
  [key in K_mediaType]?: UserTrack;
30
30
  };
31
+ /**
32
+ * 数据通道
33
+ */
34
+ channels: Array<{
35
+ id?: number;
36
+ dataChannelName: string;
37
+ }>;
31
38
  /**
32
39
  * 网络情况
33
40
  */
@@ -70,9 +77,10 @@ export declare class UserBase {
70
77
  streams: {
71
78
  [key in K_mediaType]: MediaStream;
72
79
  };
73
- constructor({ config, localMedias }: {
80
+ constructor({ config, localMedias, notEmpty }: {
74
81
  config: Config;
75
82
  localMedias: LocalMedias;
83
+ notEmpty: boolean;
76
84
  });
77
85
  setMute: (mediaTypes: K_mediaType[], mute: boolean) => void;
78
86
  updateCallAction: (callAction: number) => void;
@@ -86,7 +94,11 @@ export declare class UserBase {
86
94
  type?: number;
87
95
  trackName?: string;
88
96
  mid?: string;
89
- }>, clear?: boolean) => void;
97
+ }>) => void;
98
+ updateChannels: (channels: Array<{
99
+ id?: number;
100
+ dataChannelName: string;
101
+ }>) => void;
90
102
  getTrack: (mediaType: K_mediaType) => UserTrack | undefined;
91
103
  getTracks: (mediaTypes: K_mediaType[]) => UserTrack[];
92
104
  removeTracks: (mediaTypes: K_mediaType[]) => UserTrack[];
@@ -4,3 +4,5 @@
4
4
  export declare function fixWebmDurationInWorker(buffer: ArrayBuffer, mimeType: string): Promise<Blob>;
5
5
  /** 终止 WebM 修复 Worker;`QuickVO.destroy` 时应调用。 */
6
6
  export declare function destroyWebmFixWorker(): void;
7
+ /** 新 SDK 实例允许再次使用 WebM Worker(与模块级单例对齐)。 */
8
+ export declare function resetWebmFixWorkerAfterNewClient(): void;
@@ -11,6 +11,9 @@ export declare const enum_eventName: {
11
11
  readonly joinRoomEx: "加入房间(提前建连)";
12
12
  readonly pubNotify: "广播已发布的轨道";
13
13
  readonly subscribe: "订阅流";
14
+ readonly pubChannel: "发布DataChannel";
15
+ readonly subChannel: "订阅DataChannel";
16
+ readonly closeChannel: "关闭DataChannel";
14
17
  readonly renegotiate: "协商流";
15
18
  readonly closeTrack: "关闭轨道";
16
19
  readonly preventUsersBehavior: "阻止用户行为";
@@ -29,6 +32,8 @@ export declare const enum_eventName: {
29
32
  readonly debugger: "调试";
30
33
  readonly ai: "WorkerAi调试";
31
34
  readonly UpdateTrackActive: "p2p轨道状态";
35
+ readonly rtcStats: "客户端rtc网络质量";
36
+ readonly RtcStats: "客户端rtc网络质量";
32
37
  };
33
38
  export type T_eventName = typeof enum_eventName;
34
39
  export type K_eventName = keyof T_eventName;
@@ -38,4 +43,4 @@ export declare const eventName_options: {
38
43
  label: any;
39
44
  }[];
40
45
  export declare const eventName_keys: (keyof typeof enum_eventName)[];
41
- export declare const eventName_vals: ("关闭轨道" | "心跳" | "慢心跳" | "确认收到消息" | "上报网络类型" | "连接CF" | "获取TURN地址" | "发布流" | "加入房间" | "加入房间(提前建连)" | "广播已发布的轨道" | "订阅流" | "协商流" | "阻止用户行为" | "更新网络状态" | "更新通话状态" | "切换大小流" | "切换房间语音识别" | "同步房间" | "更新房间SDKTOKEN" | "发送P2P-offer" | "回应P2P-answer" | "发送P2P候选信息-candidate" | "上报P2P连接结果" | "退出房间" | "退出房间不断开连接" | "调试" | "WorkerAi调试" | "p2p轨道状态")[];
46
+ export declare const eventName_vals: ("心跳" | "慢心跳" | "确认收到消息" | "上报网络类型" | "连接CF" | "获取TURN地址" | "发布流" | "加入房间" | "加入房间(提前建连)" | "广播已发布的轨道" | "订阅流" | "发布DataChannel" | "订阅DataChannel" | "关闭DataChannel" | "协商流" | "关闭轨道" | "阻止用户行为" | "更新网络状态" | "更新通话状态" | "切换大小流" | "切换房间语音识别" | "同步房间" | "更新房间SDKTOKEN" | "发送P2P-offer" | "回应P2P-answer" | "发送P2P候选信息-candidate" | "上报P2P连接结果" | "退出房间" | "退出房间不断开连接" | "调试" | "WorkerAi调试" | "p2p轨道状态" | "客户端rtc网络质量")[];
@@ -1,3 +1,4 @@
1
+ import { TrackType } from '../protos/gen/Room_pb';
1
2
  export declare const enum_mediaType: {
2
3
  readonly mc_audio: "麦克风-默认轨道";
3
4
  readonly mc_video: "摄像头-默认轨道";
@@ -13,3 +14,5 @@ export declare const mediaType_options: {
13
14
  }[];
14
15
  export declare const mediaType_keys: (keyof typeof enum_mediaType)[];
15
16
  export declare const mediaType_vals: ("麦克风-默认轨道" | "摄像头-默认轨道" | "屏幕共享-视频轨道" | "屏幕共享-音频轨道")[];
17
+ /** 与 Room.proto `TrackType` 一致,供 RtcStatsData / protobuf 使用 */
18
+ export declare function mediaTypeToProtoTrackType(mediaType: K_mediaType): TrackType;
@@ -1,6 +1,8 @@
1
1
  export declare const enum_notifyName: {
2
2
  readonly onNetQuality: "网络质量回调";
3
+ readonly onRtcStats: "远端用户网络信息广播";
3
4
  readonly updateSeverTime: "服务端时间更新";
5
+ readonly onDataChannelPublish: "用户房间DataChannel发布或变更";
4
6
  readonly onJoinRoom: "加入房间回调";
5
7
  readonly onJoinRoomBatch: "加入房间批量回调";
6
8
  readonly onQuitRoom: "退出房间回调";
@@ -33,4 +35,4 @@ export declare const notifyName_options: {
33
35
  label: any;
34
36
  }[];
35
37
  export declare const notifyName_keys: (keyof typeof enum_notifyName)[];
36
- export declare const notifyName_vals: ("网络质量回调" | "服务端时间更新" | "加入房间回调" | "加入房间批量回调" | "退出房间回调" | "退出房间批量回调" | "监听到流发布" | "关闭轨道" | "更新通讯状态" | "通知轨道失效" | "房间内的全体禁言状态发生变化" | "房间内的管理员发生变化" | "建立P2P连接" | "收到P2P-offer" | "收到P2P-answer" | "收到P2P候选信息-candidate" | "断开P2P" | "更新推流权限通知" | "批量更新推流权限通知" | "Token即将过期" | "Token已过期" | "销毁房间" | "行为允许权限变更" | "cdn播放地址变化" | "用户讲话")[];
38
+ export declare const notifyName_vals: ("关闭轨道" | "网络质量回调" | "远端用户网络信息广播" | "服务端时间更新" | "用户房间DataChannel发布或变更" | "加入房间回调" | "加入房间批量回调" | "退出房间回调" | "退出房间批量回调" | "监听到流发布" | "更新通讯状态" | "通知轨道失效" | "房间内的全体禁言状态发生变化" | "房间内的管理员发生变化" | "建立P2P连接" | "收到P2P-offer" | "收到P2P-answer" | "收到P2P候选信息-candidate" | "断开P2P" | "更新推流权限通知" | "批量更新推流权限通知" | "Token即将过期" | "Token已过期" | "销毁房间" | "行为允许权限变更" | "cdn播放地址变化" | "用户讲话")[];
@@ -1,8 +1,4 @@
1
1
  export * from './QuickVO';
2
2
  export * from './types';
3
3
  export * from './enums/index';
4
- /** 与 Room.proto IceConnectType 一致,由 buf 自 Room_pb 生成 */
5
- export { IceConnectType } from './protos/gen/modules/Room_pb';
6
4
  export * as tools from './tools';
7
- /** cws 广播 on 回调:按事件名推断 payload */
8
- export { defineCwsOn, type CallsWebSocketOn, type CwsNotifyPayloadFor, type CwsNotifyPayloadUnion, } from './protos/protoEvent';
@@ -1,9 +1,9 @@
1
1
  import { GenFile, GenMessage } from '@bufbuild/protobuf/codegenv2';
2
2
  import { Message } from '@bufbuild/protobuf';
3
3
  /**
4
- * Describes the file modules/BaseData.proto.
4
+ * Describes the file BaseData.proto.
5
5
  */
6
- export declare const file_modules_BaseData: GenFile;
6
+ export declare const file_BaseData: GenFile;
7
7
  /**
8
8
  * 请求
9
9
  *