quickvo-sdk-js 1.6.63 → 1.6.71
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/dist/chunk-C3ZmwZ-K.js +57 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.js +25571 -28002
- package/dist/index.umd.cjs +4 -3
- package/dist/lib-Cen0reYH.js +11194 -0
- package/dist/src/QuickVO.d.ts +15 -25
- package/dist/src/action/ActionSFU.d.ts +52 -27
- package/dist/src/action/Task.d.ts +40 -0
- package/dist/src/base/Base.d.ts +5 -1
- package/dist/src/base/modules/Config.d.ts +14 -17
- package/dist/src/base/modules/Notifys.d.ts +7 -32
- package/dist/src/base/modules/Peer.d.ts +17 -7
- package/dist/src/base/modules/cws/CallsWebSocket.d.ts +12 -11
- package/dist/src/base/modules/cws/CallsWebSocketEvent.d.ts +6 -6
- package/dist/src/base/modules/cws/PrWebSocket.d.ts +7 -6
- package/dist/src/base/modules/cws/callLogStorage.d.ts +18 -0
- package/dist/src/base/modules/cws/quickvoCodecWorkerMain.d.ts +6 -0
- package/dist/src/base/modules/notifyPayloadMap.d.ts +119 -0
- package/dist/src/base/modules/users/Users.d.ts +58 -40
- package/dist/src/base/modules/users/modules/LocalTrackAnalysis.d.ts +6 -2
- package/dist/src/base/modules/users/modules/LocalUser.d.ts +8 -1
- package/dist/src/base/modules/users/modules/RemotePeerTrackAnalysis.d.ts +5 -1
- package/dist/src/base/modules/users/modules/RemoteUser.d.ts +9 -19
- package/dist/src/base/modules/users/modules/RemoteUserP2P.d.ts +15 -3
- package/dist/src/base/modules/users/modules/UserBase.d.ts +35 -96
- package/dist/src/base/modules/users/webrtcRtcStatsByTrack.d.ts +9 -0
- package/dist/src/base/modules/webmDurationFixWorkerMain.d.ts +6 -0
- package/dist/src/enums/eventName.d.ts +3 -1
- package/dist/src/enums/notifyName.d.ts +2 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/protos/gen/modules/BaseData_pb.d.ts +94 -0
- package/dist/src/protos/gen/modules/Room_pb.d.ts +2200 -0
- package/dist/src/protos/gen/modules/Rtc_pb.d.ts +70 -0
- package/dist/src/protos/index.d.ts +4 -1
- package/dist/src/protos/protoCodec.d.ts +19 -0
- package/dist/src/protos/protoEvent.d.ts +133 -62
- package/dist/src/protos/protoPako.d.ts +4 -0
- package/dist/src/tools.d.ts +29 -1
- package/dist/src/types.d.ts +42 -68
- package/dist/src/workers/cwsCodec/CwsCodecCore.d.ts +7 -0
- package/dist/src/workers/cwsCodec/CwsCodecWorker.d.ts +15 -0
- package/dist/src/workers/cwsCodec/cwsCodec.worker.d.ts +1 -0
- package/dist/src/workers/cwsCodec/type.d.ts +33 -0
- package/dist/src/workers/webmFix/WebmFixCore.d.ts +3 -0
- package/dist/src/workers/webmFix/WebmFixWorker.d.ts +13 -0
- package/dist/src/workers/webmFix/type.d.ts +22 -0
- package/dist/src/workers/webmFix/webmDurationFixInterop.d.ts +5 -0
- package/dist/src/workers/webmFix/webmFix.worker.d.ts +1 -0
- package/package.json +9 -6
- package/dist/src/action/PublisherController.d.ts +0 -16
- package/dist/src/action/subscriberController.d.ts +0 -15
- package/dist/src/protos/compiled.d.ts +0 -8254
- package/dist/vite.svg +0 -1
package/dist/src/QuickVO.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { QuickOptions } from './types';
|
|
|
2
2
|
export declare class QuickVO {
|
|
3
3
|
static version: string;
|
|
4
4
|
private _base;
|
|
5
|
+
/** 监听注册顺序:Base → ActionBase → ActionSFU → ActionP2P;同名 cws.on.* 以后构造者为准(房间/进房等由 ActionSFU 注册) */
|
|
5
6
|
private _ACTION_BASE;
|
|
6
7
|
private _ACTION_SFU;
|
|
7
8
|
private _ACTION_P2P;
|
|
@@ -11,11 +12,7 @@ export declare class QuickVO {
|
|
|
11
12
|
rnnoise?: import('./base/Base').PrRnnoise;
|
|
12
13
|
}) => void;
|
|
13
14
|
setCallStrategy: (callStrategy: import('./enums').K_callStrategy, mediaTypes?: import('./enums').K_mediaType[]) => Promise<void>;
|
|
14
|
-
addNotify: (notify:
|
|
15
|
-
sn?: string;
|
|
16
|
-
event: "onJoinRoom" | "onQuitRoom" | "onPublish" | "onRoomActionChange" | "onBeforeTokenExpire" | "onTokenExpired" | "onDestroyRoom" | "onCDNPlayUrlAdd" | "onRoomUserSpeech" | "onLog" | "onRoomUsers" | "onRoomNetwork" | "onDevicechange" | "onPeerState" | "onRoomState";
|
|
17
|
-
callback?: (e: any) => void;
|
|
18
|
-
}) => string;
|
|
15
|
+
addNotify: (notify: import('./base/modules/notifyPayloadMap').QuickvoNotify) => string;
|
|
19
16
|
setOptions: (options: Partial<QuickOptions & import('./types').RoomOptions>) => void;
|
|
20
17
|
getLocalStream: (mediaType: import('./enums').K_mediaType) => MediaStream;
|
|
21
18
|
getLocalStreams: () => {
|
|
@@ -51,20 +48,19 @@ export declare class QuickVO {
|
|
|
51
48
|
mc_audio: string;
|
|
52
49
|
mc_video: string;
|
|
53
50
|
}>;
|
|
54
|
-
setLocalStream: (mediaTypes: import('./enums').K_mediaType[], active: boolean) => Promise<
|
|
55
|
-
setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<
|
|
51
|
+
setLocalStream: (mediaTypes: import('./enums').K_mediaType[], active: boolean) => Promise<void>;
|
|
52
|
+
setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<void>;
|
|
56
53
|
setMediaTrackConstraints: (mediaType: import('./enums').K_mediaType, constraints: MediaTrackConstraints) => Promise<void>;
|
|
57
|
-
earlyConnect: (
|
|
58
|
-
joinRoom: (roomOptions: import('./types').RoomOptions) => Promise<
|
|
59
|
-
publish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<
|
|
60
|
-
stopPublish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setBanBehaviors: (usersBehaviors: Array<{
|
|
54
|
+
earlyConnect: () => Promise<true | undefined>;
|
|
55
|
+
joinRoom: (roomOptions: import('./types').RoomOptions) => Promise<string>;
|
|
56
|
+
publish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<true>;
|
|
57
|
+
stopPublish: (mediaTypes: import('./enums').K_mediaType[]) => Promise<true>;
|
|
58
|
+
subscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<true>;
|
|
59
|
+
stopSubscribe: (usersMediaTypes?: import('./types').UserMediaTypes[]) => Promise<true>;
|
|
60
|
+
setBehaviors: (usersBehaviors: Array<{
|
|
65
61
|
id: string;
|
|
66
|
-
|
|
67
|
-
}>) => Promise<
|
|
62
|
+
behaviors: { [key in import('./enums').K_mediaType]?: boolean; };
|
|
63
|
+
}>) => Promise<import('./protos/protoEvent').MessageRspCore<"preventUsersBehavior">>;
|
|
68
64
|
updateSimulcast: (simulcast: "f" | "h" | "q") => Promise<void>;
|
|
69
65
|
toggleRoomSpeechLang: (data: {
|
|
70
66
|
input: string;
|
|
@@ -73,7 +69,7 @@ export declare class QuickVO {
|
|
|
73
69
|
}) => void;
|
|
74
70
|
updateToken: (sdkToken: string) => void;
|
|
75
71
|
quitRoom: () => Promise<string>;
|
|
76
|
-
quitRoomEx: () => string
|
|
72
|
+
quitRoomEx: () => Promise<string>;
|
|
77
73
|
destroy: () => void;
|
|
78
74
|
addRequestAnimationFrame: (key: string, func: FrameRequestCallback, options?: {
|
|
79
75
|
fps?: number;
|
|
@@ -81,13 +77,7 @@ export declare class QuickVO {
|
|
|
81
77
|
clearRequestAnimationFrame: (keys?: string[]) => void;
|
|
82
78
|
getLocalUserTrackReports: (mediaType: import('./enums').K_mediaType) => import('./types').TrackReport;
|
|
83
79
|
getRemoteUserTrackReports: (userId: string, origin: "sfu" | "p2p", direction: "sends" | "recvs", mediaType: import('./enums').K_mediaType) => import('./types').TrackReport | undefined;
|
|
84
|
-
getRoomAction: () =>
|
|
85
|
-
mc_audio: boolean;
|
|
86
|
-
mc_video: boolean;
|
|
87
|
-
ss_video: boolean;
|
|
88
|
-
ss_audio: boolean;
|
|
89
|
-
};
|
|
90
|
-
createRoomAction: (permissions: { [mediaType in import('./enums').K_mediaType]?: boolean; }) => number;
|
|
80
|
+
getRoomAction: () => number;
|
|
91
81
|
_openP2P: (remoteUserId: string, mediaTypes: import('./enums').K_mediaType[], isRemotePush: boolean) => Promise<void>;
|
|
92
82
|
_restoreRoom: () => Promise<void>;
|
|
93
83
|
_debugger: () => Promise<void>;
|
|
@@ -5,15 +5,27 @@ export declare class ActionSFU {
|
|
|
5
5
|
base: Base;
|
|
6
6
|
private _onOnline?;
|
|
7
7
|
private _reconnectTimerId?;
|
|
8
|
-
private _isRestorePeer;
|
|
9
8
|
/** 网络计算是否进行中,用于避免与 interval 重叠执行 */
|
|
10
9
|
private _networkCalculating;
|
|
11
10
|
/** 上次打印 generateTrackAnalysis 超时告警的时间,用于限流(每 30 秒最多一次) */
|
|
12
11
|
private _lastTrackAnalysisWarnTime;
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
12
|
+
/** 避免 Math.max(...arr) 在极大数组上触达引擎参数长度限制 */
|
|
13
|
+
private static _maxInNumberArray;
|
|
14
|
+
private static _minInNumberArray;
|
|
15
|
+
private _earlyConnectTask;
|
|
16
|
+
private _cwsConnectTask;
|
|
17
|
+
private _connectCFTask;
|
|
18
|
+
private _publishTask;
|
|
19
|
+
private _stopPublishTask;
|
|
20
|
+
private _subscribeTask;
|
|
21
|
+
private _stopSubscribeTask;
|
|
22
|
+
private _syncRoomInfoTask;
|
|
23
|
+
private _restorePeerTask;
|
|
24
|
+
private _quitRoomTask;
|
|
25
|
+
/** 串行化 joinRoom,避免并发进房互相覆盖 config / 用户列表 / 连接状态 */
|
|
26
|
+
private _joinRoomSerial;
|
|
27
|
+
/** 合并同一宏任务内多次 _autoCheckSubscribe 触发 */
|
|
28
|
+
private _autoCheckSubscribeCoalesce;
|
|
17
29
|
constructor({ base }: {
|
|
18
30
|
base: Base;
|
|
19
31
|
});
|
|
@@ -22,13 +34,13 @@ export declare class ActionSFU {
|
|
|
22
34
|
* @param mediaTypes K_mediaType[]
|
|
23
35
|
* @param active boolean
|
|
24
36
|
*/
|
|
25
|
-
setLocalStream: (mediaTypes: K_mediaType[], active: boolean) => Promise<
|
|
37
|
+
setLocalStream: (mediaTypes: K_mediaType[], active: boolean) => Promise<void>;
|
|
26
38
|
/**
|
|
27
39
|
* setMediaDeviceKind
|
|
28
40
|
* @param mediaDeviceKind "audioinput" | "audiooutput" | "videoinput"
|
|
29
41
|
* @param deviceId string | undefined
|
|
30
42
|
*/
|
|
31
|
-
setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<
|
|
43
|
+
setMediaDeviceKind: (mediaDeviceKind: MediaDeviceKind, deviceId: string | undefined) => Promise<void>;
|
|
32
44
|
/**
|
|
33
45
|
* setMediaTrackConstraints
|
|
34
46
|
* @param mediaType K_mediaType
|
|
@@ -39,46 +51,39 @@ export declare class ActionSFU {
|
|
|
39
51
|
* earlyConnect
|
|
40
52
|
* @param mediaTypes ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[]
|
|
41
53
|
*/
|
|
42
|
-
earlyConnect: (
|
|
54
|
+
earlyConnect: () => Promise<true | undefined>;
|
|
43
55
|
/**
|
|
44
56
|
* joinRoom
|
|
45
57
|
* @param roomOptions RoomOptions
|
|
46
58
|
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' , newPublishAutoSubscribe: true })
|
|
47
59
|
* @returns Promise<boolean>
|
|
48
60
|
*/
|
|
49
|
-
joinRoom: (roomOptions: RoomOptions) => Promise<
|
|
61
|
+
joinRoom: (roomOptions: RoomOptions) => Promise<string>;
|
|
50
62
|
/**
|
|
51
63
|
* publish
|
|
52
64
|
* @param mediaTypes MediaType[]
|
|
53
65
|
* @example quickvo.publish(['mc_audio', 'mc_video'])
|
|
54
66
|
*/
|
|
55
|
-
publish: (mediaTypes: K_mediaType[]) => Promise<
|
|
67
|
+
publish: (mediaTypes: K_mediaType[]) => Promise<true>;
|
|
56
68
|
/**
|
|
57
69
|
* stopPublish
|
|
58
70
|
* @param trackNames string[] = []
|
|
59
71
|
* @example quickvo.stopPublish(['mc_audio'])
|
|
60
72
|
*/
|
|
61
|
-
stopPublish: (mediaTypes: K_mediaType[]) => Promise<
|
|
62
|
-
/**
|
|
63
|
-
* pauseTracks
|
|
64
|
-
* @param mediaTypes MediaType[]
|
|
65
|
-
* @param pause boolean
|
|
66
|
-
* @example quickvo.pauseTracks(['mc_audio'], true)
|
|
67
|
-
*/
|
|
68
|
-
pauseTracks: (mediaTypes: K_mediaType[], pause: boolean) => Promise<boolean>;
|
|
73
|
+
stopPublish: (mediaTypes: K_mediaType[]) => Promise<true>;
|
|
69
74
|
/**
|
|
70
75
|
* subscribe
|
|
71
76
|
* @param usersMediaTypes: UserMediaTypes[] = [] 不传入订阅所有
|
|
72
77
|
* @example quickvo.subscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
|
|
73
78
|
*/
|
|
74
|
-
subscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<
|
|
79
|
+
subscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<true>;
|
|
75
80
|
/**
|
|
76
81
|
* stopSubscribe
|
|
77
82
|
* @param usersMediaTypes: UserMediaTypes[] = [] 不传入取消订阅所有
|
|
78
83
|
* @example quickvo.stopSubscribe([{ userId: '123', mediaTypes: ['mc_audio', 'mc_video'] }])
|
|
79
84
|
* @returns Promise<boolean>
|
|
80
85
|
*/
|
|
81
|
-
stopSubscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<
|
|
86
|
+
stopSubscribe: (usersMediaTypes?: UserMediaTypes[]) => Promise<true>;
|
|
82
87
|
/**
|
|
83
88
|
* quitRoom
|
|
84
89
|
* @example quickvo.quitRoom()
|
|
@@ -90,15 +95,15 @@ export declare class ActionSFU {
|
|
|
90
95
|
* @example quickvo.quitRoomEx()
|
|
91
96
|
* @returns Promise<boolean>
|
|
92
97
|
*/
|
|
93
|
-
quitRoomEx: () => string
|
|
98
|
+
quitRoomEx: () => Promise<string>;
|
|
94
99
|
/**
|
|
95
100
|
* setBanBehaviors
|
|
96
101
|
* @param usersBehaviors Array<{ id: string; banBehaviors: { [key in K_mediaType]?: boolean } }>
|
|
97
102
|
*/
|
|
98
|
-
|
|
103
|
+
setBehaviors: (usersBehaviors: Array<{
|
|
99
104
|
id: string;
|
|
100
|
-
|
|
101
|
-
}>) => Promise<
|
|
105
|
+
behaviors: { [key in K_mediaType]?: boolean; };
|
|
106
|
+
}>) => Promise<import('../protos/protoEvent').MessageRspCore<"preventUsersBehavior">>;
|
|
102
107
|
/**
|
|
103
108
|
* toggleRoomSpeechLang
|
|
104
109
|
* @param data { input: string; output: string; translateEnable?: boolean }
|
|
@@ -120,23 +125,43 @@ export declare class ActionSFU {
|
|
|
120
125
|
/**
|
|
121
126
|
* destroy
|
|
122
127
|
*/
|
|
123
|
-
destroy: () => void
|
|
128
|
+
destroy: () => Promise<void>;
|
|
129
|
+
private _scheduleAutoCheckSubscribe;
|
|
130
|
+
private _waitPeerThenSubscribeTask;
|
|
131
|
+
private _clearTask;
|
|
124
132
|
private _clear;
|
|
125
133
|
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;
|
|
126
146
|
private _initHeartbeat;
|
|
147
|
+
/** 向服务端拉取 TURN/STUN 配置;失败或未返回有效 iceServers 时返回 undefined,由 Peer 回退默认 STUN */
|
|
148
|
+
private _fetchGenTurnAddress;
|
|
127
149
|
private _connectCF;
|
|
128
150
|
private _reportNetwork;
|
|
129
|
-
private
|
|
151
|
+
private _createTracks;
|
|
130
152
|
private _closeTrack;
|
|
131
153
|
private _pubNotify;
|
|
132
154
|
private _renegotiate;
|
|
133
155
|
private _ackMsg;
|
|
156
|
+
private _acquireJoinRoomSerial;
|
|
157
|
+
private _joinRoomExecute;
|
|
158
|
+
private _autoCheckSubscribe;
|
|
159
|
+
private _onRemoteUsersQuitRoom;
|
|
134
160
|
private _notifySelfCallAction;
|
|
135
161
|
private _calculateNetwork;
|
|
136
162
|
private _checkAndSelectUserStreamOrigin;
|
|
137
163
|
private _hasAsyncTask;
|
|
138
164
|
private _syncRoomInfo;
|
|
139
165
|
private _restorePeer;
|
|
140
|
-
private _onRemoteUsersQuitRoom;
|
|
141
166
|
_restoreRoom: () => Promise<void>;
|
|
142
167
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
export declare class Task<R = true> {
|
|
13
|
+
private readonly debounceMs;
|
|
14
|
+
private timer?;
|
|
15
|
+
/** 每次调度 / 清理 / 手动 settle 递增,用于丢弃过期的 setTimeout / microtask */
|
|
16
|
+
private scheduleGen;
|
|
17
|
+
state: 'ready' | 'waiting';
|
|
18
|
+
promise?: Promise<R>;
|
|
19
|
+
private _resolve?;
|
|
20
|
+
private _reject?;
|
|
21
|
+
private pendingFn?;
|
|
22
|
+
private pendingSettle;
|
|
23
|
+
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>;
|
|
35
|
+
private _runFlush;
|
|
36
|
+
resolve: (value: R) => void;
|
|
37
|
+
reject: (error: unknown) => void;
|
|
38
|
+
/** SDK 内部清理:取消待执行的防抖,并以 resolve 结束,避免对外 Promise rejection */
|
|
39
|
+
clear: () => void;
|
|
40
|
+
}
|
package/dist/src/base/Base.d.ts
CHANGED
|
@@ -41,6 +41,10 @@ export declare class Base {
|
|
|
41
41
|
}) => void;
|
|
42
42
|
setRoomState: (state: K_roomState) => void;
|
|
43
43
|
setPeerState: (state: RTCPeerConnectionState) => void;
|
|
44
|
+
/**
|
|
45
|
+
* CWS 房间维度的通知是否与当前 config.roomId 一致(防串房误处理)
|
|
46
|
+
*/
|
|
47
|
+
guardNotifyRoomId: (roomId: string | undefined, e: unknown) => boolean;
|
|
44
48
|
setCallStrategy: (callStrategy: K_callStrategy, mediaTypes?: K_mediaType[]) => Promise<void>;
|
|
45
49
|
_checkUserStreamOrigin: ({ p2pAverageQuality, sfuAverageQuality }: {
|
|
46
50
|
p2pAverageQuality: number;
|
|
@@ -53,7 +57,7 @@ export declare class Base {
|
|
|
53
57
|
mediaTypes: K_mediaType[];
|
|
54
58
|
desc?: string;
|
|
55
59
|
connectedTime?: string;
|
|
56
|
-
}) => Promise<
|
|
60
|
+
}) => Promise<import('../protos/protoEvent').MessageRspCore<"reportP2PConnectEx">> | undefined;
|
|
57
61
|
_reportLog: (_type: Report_Log_Type, describe?: string) => void;
|
|
58
62
|
}
|
|
59
63
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QuickOptions, RoomOptions } from '../../types';
|
|
2
2
|
import { K_roomState } from '../../enums/roomState';
|
|
3
3
|
import { K_mediaType } from '../../enums';
|
|
4
|
+
import { K_callStrategy } from '../../enums/callStrategy';
|
|
4
5
|
export declare class Config {
|
|
5
6
|
/**
|
|
6
7
|
* 信令服务地址
|
|
@@ -39,13 +40,9 @@ export declare class Config {
|
|
|
39
40
|
*/
|
|
40
41
|
callType: number;
|
|
41
42
|
/**
|
|
42
|
-
* 整体房间行为状态 0
|
|
43
|
+
* 整体房间行为状态 0为默认不禁止
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
-
banActionStr: string;
|
|
46
|
-
banActionMap: {
|
|
47
|
-
[key in K_mediaType]: boolean;
|
|
48
|
-
};
|
|
45
|
+
roomAction: number;
|
|
49
46
|
/**
|
|
50
47
|
* 是否开启语音翻译
|
|
51
48
|
*/
|
|
@@ -63,9 +60,15 @@ export declare class Config {
|
|
|
63
60
|
*/
|
|
64
61
|
useP2P: boolean;
|
|
65
62
|
/**
|
|
66
|
-
*
|
|
63
|
+
* 通话策略(QuickOptions.setOptions 传入时落库,实际编码参数由 Base.setCallStrategy 应用)
|
|
67
64
|
*/
|
|
68
|
-
|
|
65
|
+
callStrategy?: K_callStrategy;
|
|
66
|
+
/**
|
|
67
|
+
* 是否自动订阅
|
|
68
|
+
*/
|
|
69
|
+
autoSubscribe: {
|
|
70
|
+
[key in K_mediaType]: boolean;
|
|
71
|
+
};
|
|
69
72
|
/**
|
|
70
73
|
* 房间状态
|
|
71
74
|
*/
|
|
@@ -130,16 +133,10 @@ export declare class Config {
|
|
|
130
133
|
video: RTCRtpCodec[];
|
|
131
134
|
};
|
|
132
135
|
constructor();
|
|
133
|
-
updateRoomAction: (
|
|
134
|
-
|
|
135
|
-
getRoomAction: () => {
|
|
136
|
-
mc_audio: boolean;
|
|
137
|
-
mc_video: boolean;
|
|
138
|
-
ss_video: boolean;
|
|
139
|
-
ss_audio: boolean;
|
|
140
|
-
};
|
|
136
|
+
updateRoomAction: (roomAction: number) => void;
|
|
137
|
+
getRoomAction: () => number;
|
|
141
138
|
/**
|
|
142
|
-
* setOptions
|
|
139
|
+
* setOptions(显式字段赋值,避免任意 key 污染 Config)
|
|
143
140
|
*/
|
|
144
141
|
setOptions: (options: Partial<QuickOptions & RoomOptions>) => void;
|
|
145
142
|
createWsUrl: () => string;
|
|
@@ -1,41 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
type Notify = {
|
|
6
|
-
/**
|
|
7
|
-
* 事件随机码
|
|
8
|
-
*/
|
|
9
|
-
sn?: string;
|
|
10
|
-
/**
|
|
11
|
-
* 事件名称 支持同一事件名称在多个地方注册
|
|
12
|
-
*/
|
|
13
|
-
event: NotifyName;
|
|
14
|
-
/**
|
|
15
|
-
* 自定义回调函数
|
|
16
|
-
*/
|
|
17
|
-
callback?: (e: any) => void;
|
|
18
|
-
};
|
|
19
|
-
interface Result {
|
|
20
|
-
code: number;
|
|
21
|
-
data: any;
|
|
22
|
-
desc: string;
|
|
23
|
-
sn?: string;
|
|
24
|
-
}
|
|
1
|
+
import { K_quickvoNotifyName, NotifyPayloadMap, QuickvoNotify } from './notifyPayloadMap';
|
|
2
|
+
export type { K_quickvoNotifyName, NotifyPayloadMap, QuickvoNotify, NotifyEmitPayloadFor, NotifyEmitPayloadUnion } from './notifyPayloadMap';
|
|
3
|
+
export { defineQuickvoNotify } from './notifyPayloadMap';
|
|
25
4
|
export declare class Notifys {
|
|
26
|
-
queue: Map<
|
|
5
|
+
queue: Map<K_quickvoNotifyName, QuickvoNotify[]>;
|
|
27
6
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @param event 事件名称
|
|
30
|
-
* @param result 事件响应值
|
|
7
|
+
* 派发广播事件(第二参类型随 event 变化)
|
|
31
8
|
*/
|
|
32
|
-
emit: (event:
|
|
9
|
+
emit: <E extends K_quickvoNotifyName>(event: E, result: NotifyPayloadMap[E]) => void;
|
|
33
10
|
/**
|
|
34
11
|
* 添加广播
|
|
35
12
|
* @param notify
|
|
36
|
-
* @param _private
|
|
37
13
|
* @returns sn
|
|
38
14
|
*/
|
|
39
|
-
add: (notify:
|
|
15
|
+
add: (notify: QuickvoNotify) => string;
|
|
40
16
|
}
|
|
41
|
-
export {};
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import { K_mediaType } from '../../enums/mediaType';
|
|
2
|
-
import {
|
|
2
|
+
import { TurnUrlsResponse } from '../../protos/gen/modules/Room_pb';
|
|
3
3
|
import { Config } from './Config';
|
|
4
4
|
import { Users } from './users/Users';
|
|
5
5
|
import { PrResolves } from './PrResolves';
|
|
6
6
|
interface On {
|
|
7
|
-
state?: (_state:
|
|
7
|
+
state?: (_state: RTCPeerConnectionState) => void;
|
|
8
8
|
}
|
|
9
9
|
export declare class Peer {
|
|
10
10
|
config: Config;
|
|
11
11
|
users: Users;
|
|
12
12
|
prResolves: PrResolves<"peerConnected">;
|
|
13
13
|
pc: RTCPeerConnection;
|
|
14
|
+
initTime: number;
|
|
14
15
|
transceiverMap: Map<"mc_audio" | "mc_video" | "ss_video" | "ss_audio", RTCRtpTransceiver>;
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 已广播的轨道
|
|
18
|
+
*/
|
|
19
|
+
broadcasted: {
|
|
20
|
+
[key in K_mediaType]?: Boolean;
|
|
21
|
+
};
|
|
17
22
|
private iceConnectionTimer;
|
|
18
23
|
simulcast: 'f' | 'h' | 'q';
|
|
24
|
+
/** 当前 SFU 连接使用的 TURN 配置过期时间(毫秒,来自 genTurnAddress.expiresAt) */
|
|
25
|
+
turnExpiresAtMs?: number;
|
|
19
26
|
on: On;
|
|
20
27
|
waitings: {
|
|
21
28
|
peerConnected: () => Promise<unknown>;
|
|
@@ -24,20 +31,23 @@ export declare class Peer {
|
|
|
24
31
|
config: Config;
|
|
25
32
|
users: Users;
|
|
26
33
|
});
|
|
34
|
+
/** 将服务端 genTurnAddress(TurnUrlsResponse)转为 RTCConfiguration;无有效数据时回退到公共 STUN */
|
|
35
|
+
private static rtcConfigurationFromTurnRsp;
|
|
36
|
+
setBroadcasted: (mediaTypes: K_mediaType[], active: boolean) => void;
|
|
37
|
+
getNoBroadcasted: (mediaTypes: K_mediaType[]) => ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
|
|
38
|
+
checkValid: () => boolean;
|
|
27
39
|
/**
|
|
28
40
|
* setRTCRtpSenderParameters
|
|
29
41
|
* @param parameters RTCRtpSendParameters
|
|
30
42
|
*/
|
|
31
43
|
setRTCRtpSenderParameters: (parameters: Partial<RTCRtpSendParameters>, mediaTypes?: K_mediaType[]) => Promise<void>;
|
|
32
|
-
init: () => Promise<void>;
|
|
44
|
+
init: (turnRsp?: TurnUrlsResponse) => Promise<void>;
|
|
33
45
|
close: () => void;
|
|
34
46
|
addSenders: (mediaTypes: K_mediaType[]) => Promise<("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[]>;
|
|
35
47
|
syncSenderStreamTrack: (mediaTypes: K_mediaType[]) => Promise<void>;
|
|
36
48
|
stopSenders: (mediaTypes: K_mediaType[]) => void;
|
|
37
|
-
checkSendersCreatedTime: () => ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
|
|
38
49
|
hasSender: (mediaType: K_mediaType) => boolean;
|
|
39
50
|
replaceSenderTrack: (mediaType: K_mediaType, track: MediaStreamTrack) => Promise<void>;
|
|
40
|
-
getSenderUserTracks: (mediaTypes?: K_mediaType[]) => UserTrack[];
|
|
41
51
|
getTransceiver: (mid: string | null) => RTCRtpTransceiver | undefined;
|
|
42
52
|
getSenderTrack: (mediaType: K_mediaType) => MediaStreamTrack | null | undefined;
|
|
43
53
|
getRecvierTrack: (mid: string | null) => MediaStreamTrack | undefined;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { K_notifyName } from '../../../enums/notifyName';
|
|
2
1
|
import { K_eventName } from '../../../enums/eventName';
|
|
3
|
-
import {
|
|
2
|
+
import { CallsWebSocketOn } from '../../../protos/protoEvent';
|
|
3
|
+
import { Options, CallsWebSocketEvent } from './CallsWebSocketEvent';
|
|
4
4
|
import { Config } from '../Config';
|
|
5
5
|
import { PrWebSocket } from './PrWebSocket';
|
|
6
|
+
export type { CallsWebSocketOn };
|
|
7
|
+
/**
|
|
8
|
+
* 从 IndexedDB 读取 `#quickvo.logs` 并触发浏览器下载 JSON 文件(控制台可执行 `getQVLogs()`)。
|
|
9
|
+
*/
|
|
10
|
+
export declare function getQVLogs(): Promise<void>;
|
|
6
11
|
export interface CallsWebSocketOptions {
|
|
7
12
|
/**
|
|
8
13
|
* websocket服务地址
|
|
@@ -24,13 +29,8 @@ export declare class CallsWebSocket {
|
|
|
24
29
|
timeout: number;
|
|
25
30
|
prws: PrWebSocket;
|
|
26
31
|
events: Events;
|
|
27
|
-
on:
|
|
28
|
-
|
|
29
|
-
} & {
|
|
30
|
-
state?: (state: 'connecting' | 'reconnecting' | 'connected' | 'closed') => void;
|
|
31
|
-
log?: (e: any) => void;
|
|
32
|
-
};
|
|
33
|
-
/** 日志写入节流:先入内存缓冲,定时批量写 localStorage */
|
|
32
|
+
on: CallsWebSocketOn;
|
|
33
|
+
/** 日志写入节流:先入内存缓冲,定时批量写 IndexedDB(structured clone 可保留 BigInt) */
|
|
34
34
|
private _logBuffer;
|
|
35
35
|
private _logFlushTimer;
|
|
36
36
|
private static _LOG_FLUSH_DELAY;
|
|
@@ -38,14 +38,15 @@ export declare class CallsWebSocket {
|
|
|
38
38
|
config: Config;
|
|
39
39
|
});
|
|
40
40
|
needRestoreRoom: () => boolean;
|
|
41
|
+
isValid: () => boolean;
|
|
41
42
|
connect: () => Promise<void>;
|
|
42
43
|
reconnect: () => Promise<void>;
|
|
43
44
|
close: () => void;
|
|
44
45
|
createRequest: <T extends K_eventName>(eventName: T, options?: Options) => CallsWebSocketEvent<T>;
|
|
45
46
|
hasEvent: (eventName: K_eventName) => boolean;
|
|
46
47
|
clearEvents: () => void;
|
|
48
|
+
private _dispatchCwsDecodedMessage;
|
|
47
49
|
retryEvents: () => Promise<void>;
|
|
48
|
-
private
|
|
50
|
+
private _updateLogs;
|
|
49
51
|
private _flushLogs;
|
|
50
52
|
}
|
|
51
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { K_eventName } from '../../../enums/eventName';
|
|
2
|
-
import { MessageReq, MessageRsp } from '../../../protos/protoEvent';
|
|
2
|
+
import { MessageReq, MessageRsp, MessageRspCore } from '../../../protos/protoEvent';
|
|
3
3
|
import { PrWebSocket } from './PrWebSocket';
|
|
4
4
|
export interface Options {
|
|
5
5
|
/**
|
|
@@ -17,8 +17,8 @@ export declare class CallsWebSocketEvent<T extends K_eventName> {
|
|
|
17
17
|
message?: MessageReq<T>;
|
|
18
18
|
needRetry: boolean;
|
|
19
19
|
sn: number;
|
|
20
|
-
_resolve: (_value:
|
|
21
|
-
_reject: (_reason?:
|
|
20
|
+
_resolve: (_value: MessageRspCore<T>) => void;
|
|
21
|
+
_reject: (_reason?: unknown) => void;
|
|
22
22
|
sendBefore?: (_message: MessageReq<T>) => void;
|
|
23
23
|
sendAfter?: () => void;
|
|
24
24
|
options: {
|
|
@@ -27,10 +27,10 @@ export declare class CallsWebSocketEvent<T extends K_eventName> {
|
|
|
27
27
|
};
|
|
28
28
|
timer: number;
|
|
29
29
|
constructor(eventName: T, prws: PrWebSocket, options?: Options);
|
|
30
|
-
resolve: (_value: MessageRsp<T
|
|
31
|
-
reject: (_reason?:
|
|
30
|
+
resolve: (_value: MessageRspCore<T> & Partial<Pick<MessageRsp<T>, "time">>) => void;
|
|
31
|
+
reject: (_reason?: unknown) => void;
|
|
32
32
|
retry: () => void;
|
|
33
|
-
send: (req_message: Pick<MessageReq<T>, "data" | "compress" | "version">) => Promise<
|
|
33
|
+
send: (req_message: Pick<MessageReq<T>, "data" | "compress" | "version">) => Promise<MessageRspCore<T>>;
|
|
34
34
|
private sendMsg;
|
|
35
35
|
private _createTimer;
|
|
36
36
|
destroy: () => void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
interface On {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 消息回调(binaryType 为 arraybuffer 时为 ArrayBuffer)
|
|
4
4
|
* @description 接收当前WebSocket的所有消息
|
|
5
5
|
*/
|
|
6
|
-
message?: (
|
|
6
|
+
message?: (data: ArrayBuffer) => void;
|
|
7
7
|
/**
|
|
8
8
|
* 检测是否重连
|
|
9
9
|
*/
|
|
10
|
-
checkReconnect?: (e:
|
|
10
|
+
checkReconnect?: (e: CloseEvent) => void;
|
|
11
11
|
}
|
|
12
12
|
export declare class PrWebSocket {
|
|
13
13
|
binaryType: BinaryType;
|
|
@@ -21,15 +21,16 @@ export declare class PrWebSocket {
|
|
|
21
21
|
on: On;
|
|
22
22
|
getUrl: () => string;
|
|
23
23
|
constructor();
|
|
24
|
-
connect: () => Promise<
|
|
24
|
+
connect: () => Promise<number>;
|
|
25
25
|
/**
|
|
26
26
|
* 重新连接
|
|
27
27
|
*/
|
|
28
|
-
reconnect: () => Promise<
|
|
28
|
+
reconnect: () => Promise<number>;
|
|
29
|
+
private _reconnectAsync;
|
|
29
30
|
/**
|
|
30
31
|
* 发送消息
|
|
31
32
|
*/
|
|
32
|
-
send: (
|
|
33
|
+
send: (data: Parameters<WebSocket["send"]>[0]) => void;
|
|
33
34
|
/**
|
|
34
35
|
* 关闭
|
|
35
36
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 通话调试日志:IndexedDB 存储(structured clone 支持 BigInt,可原样持久化)
|
|
3
|
+
* - `#quickvo.logs` → object store `logs_main`
|
|
4
|
+
* - `#quickvo.ignoreEvents` → object store `logs_ignore`(与主日志分表,避免互相覆盖或迁移遗漏)
|
|
5
|
+
* 首次读取时从 localStorage 迁移旧数据;v1 单表 `call_logs` 在首次读取时惰性迁入对应新表
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 读取日志条目列表;优先 IndexedDB 新表,再尝试 v1 表与 localStorage 并写回新表
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadCallLogs(key: string): Promise<any[]>;
|
|
11
|
+
/**
|
|
12
|
+
* 持久化日志条目(可含 BigInt,不经 JSON)
|
|
13
|
+
*/
|
|
14
|
+
export declare function saveCallLogs(key: string, entries: any[]): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* 深拷贝并将 BigInt 转为十进制字符串,供 on.log / JSON 等无法处理 BigInt 的场景
|
|
17
|
+
*/
|
|
18
|
+
export declare function cloneWithBigIntAsString<T>(value: T): T;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OnMessageFormatResult } from '../../../protos/protoEvent';
|
|
2
|
+
export declare function decodeCwsBinary<E extends string = string>(buffer: ArrayBuffer): Promise<OnMessageFormatResult<E>>;
|
|
3
|
+
/** gzip 压缩(发送侧 / 日志上报);失败时回退主线程 pako */
|
|
4
|
+
export declare function gzipCompressBytes(data: Uint8Array): Promise<Uint8Array>;
|
|
5
|
+
/** 终止 CWS 编解码 Worker;`QuickVO.destroy` 时应调用。之后可再次懒创建 Worker。 */
|
|
6
|
+
export declare function destroyQuickvoCodecWorker(): void;
|