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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { K_notifyName } from '../../enums/notifyName';
|
|
2
|
+
import { K_roomState } from '../../enums/roomState';
|
|
3
|
+
import { CwsNotifyPayloadFor } from '../../protos/protoEvent';
|
|
4
|
+
import { RoomUser } from '../../types';
|
|
5
|
+
/**
|
|
6
|
+
* SDK 内部派发的通知名(不经由 CWS OnMessageDataMap)
|
|
7
|
+
*/
|
|
8
|
+
export type SdkOnlyNotifyName = 'onLog' | 'onRoomUsers' | 'onRoomNetwork' | 'onDevicechange' | 'onPeerState' | 'onRoomState';
|
|
9
|
+
/** QuickVO.addNotify / Notifys 支持的完整事件名 */
|
|
10
|
+
export type K_quickvoNotifyName = K_notifyName | SdkOnlyNotifyName;
|
|
11
|
+
type WithSn<T> = T & {
|
|
12
|
+
sn?: string;
|
|
13
|
+
};
|
|
14
|
+
type CwsNotifyPayloadWithSn<K extends K_notifyName> = WithSn<CwsNotifyPayloadFor<K>>;
|
|
15
|
+
/** 与 Config.network / ActionSFU 网络汇总一致 */
|
|
16
|
+
export type RoomNetworkNotifyData = {
|
|
17
|
+
sfu: {
|
|
18
|
+
inboundBytes: number;
|
|
19
|
+
outboundBytes: number;
|
|
20
|
+
lostRate: number;
|
|
21
|
+
roundTripTime: number;
|
|
22
|
+
jitter: number;
|
|
23
|
+
quality: number;
|
|
24
|
+
averageQuality: number;
|
|
25
|
+
velocityPush: number;
|
|
26
|
+
velocityPull: number;
|
|
27
|
+
};
|
|
28
|
+
p2p: {
|
|
29
|
+
inboundBytes: number;
|
|
30
|
+
outboundBytes: number;
|
|
31
|
+
lostRate: number;
|
|
32
|
+
roundTripTime: number;
|
|
33
|
+
jitter: number;
|
|
34
|
+
quality: number;
|
|
35
|
+
averageQuality: number;
|
|
36
|
+
velocityPush: number;
|
|
37
|
+
velocityPull: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/** 与 Base._reportLog 的 type 参数一致 */
|
|
41
|
+
export type ReportLogNotifyType = 'ws_c_timeout' | 'webrtc_c_timeout' | 'join_room_error' | 'publish_error' | 'subscribe_error' | 'close_track_error' | 'heartbeat_e_timeout' | 'heartbeat_i_timeout' | 'quit_room_error';
|
|
42
|
+
/**
|
|
43
|
+
* 各通知事件 emit 第二参 / callback 第一参的精确类型
|
|
44
|
+
*/
|
|
45
|
+
export type NotifyPayloadMap = {
|
|
46
|
+
[K in K_notifyName]: CwsNotifyPayloadWithSn<K>;
|
|
47
|
+
} & {
|
|
48
|
+
onLog: WithSn<{
|
|
49
|
+
code: number;
|
|
50
|
+
desc: string;
|
|
51
|
+
data: {
|
|
52
|
+
message: unknown;
|
|
53
|
+
} | {
|
|
54
|
+
type: ReportLogNotifyType;
|
|
55
|
+
};
|
|
56
|
+
}>;
|
|
57
|
+
onRoomUsers: WithSn<{
|
|
58
|
+
code: number;
|
|
59
|
+
desc: string;
|
|
60
|
+
data: RoomUser[];
|
|
61
|
+
}>;
|
|
62
|
+
onRoomNetwork: WithSn<{
|
|
63
|
+
code: number;
|
|
64
|
+
desc: string;
|
|
65
|
+
data: RoomNetworkNotifyData;
|
|
66
|
+
}>;
|
|
67
|
+
onDevicechange: WithSn<{
|
|
68
|
+
code: number;
|
|
69
|
+
desc: string;
|
|
70
|
+
data: Record<string, never>;
|
|
71
|
+
}>;
|
|
72
|
+
onPeerState: WithSn<{
|
|
73
|
+
code: number;
|
|
74
|
+
desc: string;
|
|
75
|
+
data: {
|
|
76
|
+
state: RTCPeerConnectionState;
|
|
77
|
+
};
|
|
78
|
+
}>;
|
|
79
|
+
onRoomState: WithSn<{
|
|
80
|
+
code: number;
|
|
81
|
+
desc: string;
|
|
82
|
+
data: {
|
|
83
|
+
state: K_roomState;
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
87
|
+
export type NotifyEmitPayloadFor<E extends K_quickvoNotifyName> = NotifyPayloadMap[E];
|
|
88
|
+
/** 所有通知 payload 的联合(需按 event 收窄时请用 NotifyEmitPayloadFor<E>) */
|
|
89
|
+
export type NotifyEmitPayloadUnion = NotifyPayloadMap[K_quickvoNotifyName];
|
|
90
|
+
/**
|
|
91
|
+
* addNotify 注册的 discriminated union:event 与 callback 参数类型联动
|
|
92
|
+
*/
|
|
93
|
+
export type QuickvoNotify = {
|
|
94
|
+
[E in K_quickvoNotifyName]: {
|
|
95
|
+
sn?: string;
|
|
96
|
+
event: E;
|
|
97
|
+
callback?: (e: NotifyPayloadMap[E]) => void;
|
|
98
|
+
};
|
|
99
|
+
}[K_quickvoNotifyName];
|
|
100
|
+
/**
|
|
101
|
+
* 辅助推断:注册通知时无需手写 payload 泛型
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* quickvo.addNotify(defineQuickvoNotify({
|
|
105
|
+
* event: 'onJoinRoom',
|
|
106
|
+
* callback: (e) => e.data.user,
|
|
107
|
+
* }))
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare function defineQuickvoNotify<const E extends K_quickvoNotifyName>(notify: {
|
|
111
|
+
sn?: string;
|
|
112
|
+
event: E;
|
|
113
|
+
callback?: (e: NotifyPayloadMap[E]) => void;
|
|
114
|
+
}): {
|
|
115
|
+
sn?: string;
|
|
116
|
+
event: E;
|
|
117
|
+
callback?: (e: NotifyPayloadMap[E]) => void;
|
|
118
|
+
};
|
|
119
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { K_mediaType } from '../../../enums/mediaType';
|
|
2
|
-
import {
|
|
2
|
+
import { UserMediaTypes, UserTrack } from '../../../types';
|
|
3
|
+
import { User as ProtoUser } from '../../../protos/gen/modules/Room_pb';
|
|
3
4
|
import { Config } from '../Config';
|
|
4
5
|
import { LocalMedias } from '../LocalMedias';
|
|
5
6
|
import { Notifys } from '../Notifys';
|
|
@@ -12,6 +13,7 @@ export declare class Users {
|
|
|
12
13
|
notifys: Notifys;
|
|
13
14
|
localUser: LocalUser;
|
|
14
15
|
remoteUsers: Map<string, RemoteUser>;
|
|
16
|
+
_emitUsersChangeTimer: number;
|
|
15
17
|
constructor({ config, localMedias, notifys }: {
|
|
16
18
|
config: Config;
|
|
17
19
|
localMedias: LocalMedias;
|
|
@@ -132,12 +134,31 @@ export declare class Users {
|
|
|
132
134
|
*/
|
|
133
135
|
setBgmGain: (userId: string, mediaType: K_mediaType, gain: number) => Promise<void>;
|
|
134
136
|
getrP2PConnectedCount: () => number;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
addRemoteUsersSubscribed: (usersMediaTypes?: UserMediaTypes[]) => void;
|
|
138
|
+
removeRemoteUsersSubscribed: (usersMediaTypes?: UserMediaTypes[]) => void;
|
|
139
|
+
createRemoteUsersSubscribeData: (lastRetry?: boolean) => {
|
|
137
140
|
id: string;
|
|
138
|
-
tracks:
|
|
141
|
+
tracks: {
|
|
142
|
+
type: number;
|
|
143
|
+
lastRetry: boolean;
|
|
144
|
+
}[];
|
|
145
|
+
}[];
|
|
146
|
+
createRemoteUsersCloseData: () => {
|
|
147
|
+
userId: string;
|
|
148
|
+
sfu_tracks: {
|
|
149
|
+
userId: string;
|
|
150
|
+
mediaType: K_mediaType;
|
|
151
|
+
trackName: string;
|
|
152
|
+
origin: "phoney" | "local" | "sfu" | "p2p";
|
|
153
|
+
simulcast: "f" | "h" | "q";
|
|
154
|
+
location: string;
|
|
155
|
+
mid: string;
|
|
156
|
+
msid: string;
|
|
157
|
+
type: number;
|
|
158
|
+
enabled: boolean;
|
|
159
|
+
}[];
|
|
160
|
+
p2p_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
|
|
139
161
|
}[];
|
|
140
|
-
completedRemoteUsersSubscribes: (users: RoomUser[]) => void;
|
|
141
162
|
emitUsersChange: () => void;
|
|
142
163
|
/**
|
|
143
164
|
* getMaxVolumeUser
|
|
@@ -149,47 +170,26 @@ export declare class Users {
|
|
|
149
170
|
getUserStream: (userId: string, mediaType: K_mediaType) => MediaStream | undefined;
|
|
150
171
|
getUsersInfo: () => {
|
|
151
172
|
id: string;
|
|
152
|
-
callAction: number;
|
|
153
|
-
callActionStr: string;
|
|
154
|
-
callActionMap: {
|
|
155
|
-
mc_audio?: boolean | undefined;
|
|
156
|
-
mc_video?: boolean | undefined;
|
|
157
|
-
ss_video?: boolean | undefined;
|
|
158
|
-
ss_audio?: boolean | undefined;
|
|
159
|
-
};
|
|
160
|
-
permissions: number;
|
|
161
|
-
permissionsStr: string;
|
|
162
|
-
permissionsMap: {
|
|
163
|
-
subscribe: boolean;
|
|
164
|
-
publish: boolean;
|
|
165
|
-
};
|
|
166
|
-
banBehavior: number;
|
|
167
|
-
banBehaviorStr: string;
|
|
168
|
-
banBehaviorMap: {
|
|
169
|
-
mc_audio?: boolean | undefined;
|
|
170
|
-
mc_video?: boolean | undefined;
|
|
171
|
-
ss_video?: boolean | undefined;
|
|
172
|
-
ss_audio?: boolean | undefined;
|
|
173
|
-
};
|
|
174
173
|
isOwner: boolean;
|
|
175
174
|
isAdmin: boolean;
|
|
176
175
|
isSelf: boolean;
|
|
176
|
+
callAction: number;
|
|
177
|
+
permissions: number;
|
|
178
|
+
behavior: number;
|
|
177
179
|
network: {
|
|
178
180
|
egress: number;
|
|
179
181
|
ingress: number;
|
|
180
182
|
};
|
|
181
183
|
tracks: {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
simulcast?: "f" | "h" | "q";
|
|
192
|
-
lastRetry?: boolean;
|
|
184
|
+
mediaType: K_mediaType;
|
|
185
|
+
trackName: string;
|
|
186
|
+
origin: "phoney" | "local" | "sfu" | "p2p";
|
|
187
|
+
simulcast: "f" | "h" | "q";
|
|
188
|
+
location: string;
|
|
189
|
+
mid: string;
|
|
190
|
+
msid: string;
|
|
191
|
+
type: number;
|
|
192
|
+
enabled: boolean;
|
|
193
193
|
}[];
|
|
194
194
|
}[];
|
|
195
195
|
getP2PState: () => {
|
|
@@ -205,9 +205,27 @@ 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
|
+
/**
|
|
213
|
+
* 远端退出房间:剥离用户并汇总需 SFU 侧 stopReceivers / closeTrack 的 mid 与轨道
|
|
214
|
+
*/
|
|
215
|
+
detachRemoteUsersForQuit: (userIds: string[]) => {
|
|
216
|
+
removeUserIds: string[];
|
|
217
|
+
removeMids: string[];
|
|
218
|
+
removeTracks: UserTrack[];
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* syncRoomInfo:本地远端用户若不在服务端返回的 id 集合中则移除;返回每位被移除用户对应的 SFU recv mid(供 Peer.stopReceivers 分批调用,行为与原先一致)
|
|
222
|
+
*/
|
|
223
|
+
pruneRemoteUsersNotInServerList: (serverUserIds: readonly string[]) => {
|
|
224
|
+
mids: string[];
|
|
225
|
+
}[];
|
|
208
226
|
updateUsersIsAdmin: (adminIds?: string[]) => void;
|
|
209
|
-
initUsers: (users:
|
|
210
|
-
|
|
227
|
+
initUsers: (users: ProtoUser[], clear: boolean) => void;
|
|
228
|
+
clearRemoteUsers: () => void;
|
|
211
229
|
createRemoteUserP2P: (userId: string) => RemoteUserP2P;
|
|
212
230
|
syncRemoteUserP2PSenderStreamTrack: (mediaTypes: K_mediaType[]) => Promise<void>;
|
|
213
231
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TrackReport } from '../../../../types';
|
|
1
|
+
import { ReportInfo, TrackReport } from '../../../../types';
|
|
2
2
|
export declare class LocalTrackAnalysis {
|
|
3
3
|
types: string[];
|
|
4
4
|
trackReport: TrackReport;
|
|
@@ -10,7 +10,11 @@ export declare class LocalTrackAnalysis {
|
|
|
10
10
|
availableScore: number[];
|
|
11
11
|
constructor();
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 使用已筛选的 stats 子集更新网络信息(由上层对整连接 `getStats()` 分轨后传入)
|
|
14
|
+
*/
|
|
15
|
+
applyFromReports: (reports: ReportInfo[]) => TrackReport;
|
|
16
|
+
/**
|
|
17
|
+
* 生成网络信息(单轨 getStats,兼容旧调用;推荐上层使用整连接 getStats + applyFromReports)
|
|
14
18
|
*/
|
|
15
19
|
generate: (pc: RTCPeerConnection, track: MediaStreamTrack | undefined | null) => Promise<TrackReport>;
|
|
16
20
|
/**
|
|
@@ -12,13 +12,20 @@ interface LocalUserTracksAnalysis {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export declare class LocalUser extends UserBase {
|
|
15
|
+
/**
|
|
16
|
+
* 应发布的轨道
|
|
17
|
+
*/
|
|
18
|
+
published: {
|
|
19
|
+
[key in K_mediaType]: Boolean;
|
|
20
|
+
};
|
|
15
21
|
tracksAnalysis: LocalUserTracksAnalysis;
|
|
16
22
|
constructor({ config, localMedias }: {
|
|
17
23
|
config: Config;
|
|
18
24
|
localMedias: LocalMedias;
|
|
19
25
|
});
|
|
20
26
|
getTrackReports: (mediaType: K_mediaType) => import('../../../..').TrackReport;
|
|
21
|
-
generateTrackAnalysis: (peer: Peer) => Promise<void>;
|
|
27
|
+
generateTrackAnalysis: (peer: Peer, sfuStats: RTCStatsReport) => Promise<void>;
|
|
28
|
+
setPublished: (mediaTypes: K_mediaType[], published: boolean) => void;
|
|
22
29
|
/**
|
|
23
30
|
* setActiveNoise
|
|
24
31
|
* @param mediaType K_mediaType
|
|
@@ -10,7 +10,11 @@ export declare class RemotePeerTrackAnalysis {
|
|
|
10
10
|
availableScore: number[];
|
|
11
11
|
constructor();
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 使用已筛选的 stats 子集更新网络信息
|
|
14
|
+
*/
|
|
15
|
+
applyFromReports: (reports: ReportInfo[]) => TrackReport;
|
|
16
|
+
/**
|
|
17
|
+
* 生成网络信息(单轨 getStats,兼容旧调用)
|
|
14
18
|
*/
|
|
15
19
|
generate: (pc: RTCPeerConnection, track: MediaStreamTrack | undefined | null) => Promise<TrackReport>;
|
|
16
20
|
/**
|
|
@@ -6,7 +6,6 @@ import { Config } from '../../Config';
|
|
|
6
6
|
import { Peer } from '../../Peer';
|
|
7
7
|
import { LocalTrackAnalysis } from './LocalTrackAnalysis';
|
|
8
8
|
import { RemotePeerTrackAnalysis } from './RemotePeerTrackAnalysis';
|
|
9
|
-
import { UserTrack } from '../../../../types';
|
|
10
9
|
interface RemoteUserTracksAnalysis {
|
|
11
10
|
sfu: {
|
|
12
11
|
recvs: {
|
|
@@ -23,16 +22,13 @@ interface RemoteUserTracksAnalysis {
|
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
24
|
export declare class RemoteUser extends UserBase {
|
|
26
|
-
tracksAnalysis: RemoteUserTracksAnalysis;
|
|
27
25
|
/**
|
|
28
|
-
*
|
|
26
|
+
* 应订阅的轨道 可尝试订阅次数
|
|
29
27
|
*/
|
|
30
|
-
|
|
31
|
-
[key in K_mediaType]
|
|
32
|
-
};
|
|
33
|
-
publishWaiting: {
|
|
34
|
-
[key in K_mediaType]?: number;
|
|
28
|
+
subscribed: {
|
|
29
|
+
[key in K_mediaType]: boolean;
|
|
35
30
|
};
|
|
31
|
+
tracksAnalysis: RemoteUserTracksAnalysis;
|
|
36
32
|
/**
|
|
37
33
|
* 数据接收器
|
|
38
34
|
*/
|
|
@@ -44,19 +40,13 @@ export declare class RemoteUser extends UserBase {
|
|
|
44
40
|
config: Config;
|
|
45
41
|
localMedias: LocalMedias;
|
|
46
42
|
});
|
|
47
|
-
|
|
48
|
-
generateTrackAnalysis: (peer: Peer) => Promise<void>;
|
|
49
|
-
addSubscribe: (mediaTypes: K_mediaType[], count?: number) => void;
|
|
50
|
-
executeSubscribe: () => {
|
|
51
|
-
id: string;
|
|
52
|
-
tracks: UserTrack[];
|
|
53
|
-
};
|
|
54
|
-
completedSubscribe: (mediaTypes: K_mediaType[]) => void;
|
|
55
|
-
setPublishWaiting: (mediaTypes: K_mediaType[]) => void;
|
|
56
|
-
checkSubscribed: (mediaTypes: K_mediaType[], origin?: "sfu" | "p2p" | "all") => {
|
|
57
|
-
subscribed_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
|
|
43
|
+
checkSubscribed: (mediaTypes: K_mediaType[]) => {
|
|
58
44
|
prohibited_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
|
|
45
|
+
subscribed_mediaTypes: ("mc_audio" | "mc_video" | "ss_video" | "ss_audio")[];
|
|
59
46
|
};
|
|
47
|
+
setSubscribed: (mediaTypes: K_mediaType[], subscribed: boolean) => void;
|
|
48
|
+
getTrackReports: (origin: "sfu" | "p2p", direction: "sends" | "recvs", mediaType: K_mediaType) => import('../../../..').TrackReport | undefined;
|
|
49
|
+
generateTrackAnalysis: (peer: Peer, sfuStats: RTCStatsReport, p2pStats: RTCStatsReport | null) => Promise<void>;
|
|
60
50
|
useRemoteStream: (mediaTypes: K_mediaType[], peer: Peer) => void;
|
|
61
51
|
useRemoteP2PStream: (mediaTypes: K_mediaType[]) => void;
|
|
62
52
|
clear: () => void;
|
|
@@ -1,4 +1,8 @@
|
|
|
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
6
|
import { K_mediaType } from '../../../../enums/mediaType';
|
|
3
7
|
import { Config } from '../../Config';
|
|
4
8
|
export interface MediaTypeTransceiver {
|
|
@@ -15,8 +19,8 @@ export declare class RemoteUserP2P {
|
|
|
15
19
|
config: Config;
|
|
16
20
|
prResolves: PrResolves<string>;
|
|
17
21
|
remoteUserId: string;
|
|
18
|
-
|
|
19
|
-
timer?:
|
|
22
|
+
pc?: RTCPeerConnection;
|
|
23
|
+
timer?: number;
|
|
20
24
|
channelLocal?: RTCDataChannel;
|
|
21
25
|
channelRemote?: RTCDataChannel;
|
|
22
26
|
channelRemoteList: RTCDataChannel[];
|
|
@@ -41,7 +45,7 @@ export declare class RemoteUserP2P {
|
|
|
41
45
|
config: Config;
|
|
42
46
|
remoteUserId: string;
|
|
43
47
|
});
|
|
44
|
-
remoteChannelSend: (message:
|
|
48
|
+
remoteChannelSend: <T extends K_eventName>(message: Pick<SendMessageFormat<T>, "event" | "data"> & Partial<Omit<SendMessageFormat<T>, "event" | "data">>) => Promise<void>;
|
|
45
49
|
init: () => void;
|
|
46
50
|
getSenderTrack: (mediaType: K_mediaType) => MediaStreamTrack | null | undefined;
|
|
47
51
|
getRecvierTrack: (mediaType: K_mediaType) => MediaStreamTrack | undefined;
|
|
@@ -68,6 +72,7 @@ export declare class RemoteUserP2P {
|
|
|
68
72
|
mid: string | null;
|
|
69
73
|
mediaType: string;
|
|
70
74
|
}[];
|
|
75
|
+
/** 供 CWS offer 等使用,形状贴近 Room.Track 初始化(非 RtcTrack) */
|
|
71
76
|
getRecvUserTracks: (mediaTypes?: K_mediaType[]) => {
|
|
72
77
|
type: number;
|
|
73
78
|
enabled: boolean;
|
|
@@ -76,11 +81,18 @@ export declare class RemoteUserP2P {
|
|
|
76
81
|
mediaType: string;
|
|
77
82
|
isActive: number | undefined;
|
|
78
83
|
}[];
|
|
84
|
+
/** CWS offer/answer 的 repeated Track,需 @bufbuild create(Room.Track) */
|
|
85
|
+
getRecvUserTracksAsRoomTrack: (mediaTypes?: K_mediaType[]) => Track[];
|
|
86
|
+
getSenderUserTracksAsRoomTrack: (mediaTypes?: K_mediaType[]) => Track[];
|
|
87
|
+
/** DataChannel 事件 UpdateTrackActive 需 protobuf RtcTrack(@bufbuild create) */
|
|
88
|
+
getRecvUserTracksAsRtc: (mediaTypes?: K_mediaType[]) => RtcTrack[];
|
|
79
89
|
checkReceActive: (mediaType: K_mediaType) => number | false;
|
|
80
90
|
getTrack: (mediaType: K_mediaType) => MediaStreamTrack | undefined;
|
|
81
91
|
checkPeer: () => RTCPeerConnection;
|
|
82
92
|
close: () => void;
|
|
83
93
|
destroy: () => Promise<void>;
|
|
94
|
+
/** ICE 收集结束:`onicecandidate` 的 null,或 `iceGatheringState === 'complete'` */
|
|
95
|
+
private _markIceGatheringComplete;
|
|
84
96
|
private _clear;
|
|
85
97
|
private _filterSdp;
|
|
86
98
|
}
|
|
@@ -10,31 +10,6 @@ export declare class UserBase {
|
|
|
10
10
|
* 用户ID
|
|
11
11
|
*/
|
|
12
12
|
id: string;
|
|
13
|
-
/**
|
|
14
|
-
* 通话行为
|
|
15
|
-
*/
|
|
16
|
-
callAction: number;
|
|
17
|
-
callActionStr: string;
|
|
18
|
-
callActionMap: {
|
|
19
|
-
[key in K_mediaType]?: boolean;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* 用户权限
|
|
23
|
-
*/
|
|
24
|
-
permissions: number;
|
|
25
|
-
permissionsStr: string;
|
|
26
|
-
permissionsMap: {
|
|
27
|
-
subscribe: boolean;
|
|
28
|
-
publish: boolean;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* 禁用行为
|
|
32
|
-
*/
|
|
33
|
-
banBehavior: number;
|
|
34
|
-
banBehaviorStr: string;
|
|
35
|
-
banBehaviorMap: {
|
|
36
|
-
[key in K_mediaType]?: boolean;
|
|
37
|
-
};
|
|
38
13
|
/**
|
|
39
14
|
* 是否为自己
|
|
40
15
|
*/
|
|
@@ -47,6 +22,12 @@ export declare class UserBase {
|
|
|
47
22
|
* 是否为管理员
|
|
48
23
|
*/
|
|
49
24
|
isAdmin: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 用户轨道
|
|
27
|
+
*/
|
|
28
|
+
tracks: {
|
|
29
|
+
[key in K_mediaType]?: UserTrack;
|
|
30
|
+
};
|
|
50
31
|
/**
|
|
51
32
|
* 网络情况
|
|
52
33
|
*/
|
|
@@ -63,11 +44,17 @@ export declare class UserBase {
|
|
|
63
44
|
ingress: number;
|
|
64
45
|
};
|
|
65
46
|
/**
|
|
66
|
-
*
|
|
47
|
+
* 通话行为
|
|
67
48
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
49
|
+
callAction: number;
|
|
50
|
+
/**
|
|
51
|
+
* 用户权限
|
|
52
|
+
*/
|
|
53
|
+
permissions: number;
|
|
54
|
+
/**
|
|
55
|
+
* 禁用行为
|
|
56
|
+
*/
|
|
57
|
+
behavior: number;
|
|
71
58
|
/**
|
|
72
59
|
* 用户流控制器
|
|
73
60
|
*/
|
|
@@ -83,47 +70,23 @@ export declare class UserBase {
|
|
|
83
70
|
streams: {
|
|
84
71
|
[key in K_mediaType]: MediaStream;
|
|
85
72
|
};
|
|
86
|
-
/**
|
|
87
|
-
* 是否已发布 (本地用户有效 远端用户均为true)
|
|
88
|
-
*/
|
|
89
|
-
published: {
|
|
90
|
-
[key in K_mediaType]?: Boolean;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* 是否已订阅 (远端用户有效 本地用户均为true)
|
|
94
|
-
*/
|
|
95
|
-
subscribed: {
|
|
96
|
-
[key in K_mediaType]?: Boolean;
|
|
97
|
-
};
|
|
98
73
|
constructor({ config, localMedias }: {
|
|
99
74
|
config: Config;
|
|
100
75
|
localMedias: LocalMedias;
|
|
101
76
|
});
|
|
102
77
|
setMute: (mediaTypes: K_mediaType[], mute: boolean) => void;
|
|
103
|
-
setTracksPublished: (mediaTypes: K_mediaType[], published: boolean) => void;
|
|
104
|
-
setTracksSubscribed: (mediaTypes: K_mediaType[], subscribed: boolean) => void;
|
|
105
|
-
/**
|
|
106
|
-
* updateCallAction
|
|
107
|
-
*/
|
|
108
78
|
updateCallAction: (callAction: number) => void;
|
|
109
|
-
/**
|
|
110
|
-
* updatePermissions
|
|
111
|
-
*/
|
|
112
79
|
updatePermissions: (permissions: number) => void;
|
|
113
|
-
|
|
114
|
-
* updateBanBehavior
|
|
115
|
-
*/
|
|
116
|
-
updateBanBehavior: (banBehavior: number) => void;
|
|
80
|
+
updateBehavior: (behavior: number) => void;
|
|
117
81
|
updateNetwork: (network: {
|
|
118
82
|
egress: number;
|
|
119
83
|
ingress: number;
|
|
120
84
|
}) => boolean;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
updateTracks: (tracks: Omit<UserTrack, "location" | "mediaType" | "origin">[], clear?: boolean) => void;
|
|
85
|
+
updateTracks: (tracks: Array<{
|
|
86
|
+
type?: number;
|
|
87
|
+
trackName?: string;
|
|
88
|
+
mid?: string;
|
|
89
|
+
}>, clear?: boolean) => void;
|
|
127
90
|
getTrack: (mediaType: K_mediaType) => UserTrack | undefined;
|
|
128
91
|
getTracks: (mediaTypes: K_mediaType[]) => UserTrack[];
|
|
129
92
|
removeTracks: (mediaTypes: K_mediaType[]) => UserTrack[];
|
|
@@ -136,37 +99,15 @@ export declare class UserBase {
|
|
|
136
99
|
ss_audio: MediaStream;
|
|
137
100
|
};
|
|
138
101
|
getUserMediaStreamContext: (mediaType: K_mediaType) => PrAudioStream | undefined;
|
|
139
|
-
|
|
140
|
-
* 使用假流数据
|
|
141
|
-
*/
|
|
142
|
-
usePhoneyStream: (mediaTypes: K_mediaType[]) => void;
|
|
102
|
+
usePhoneyStream: (mediaTypes: K_mediaType[], replaceMediaStreamTrack?: boolean) => void;
|
|
143
103
|
getInfo: () => {
|
|
144
104
|
id: string;
|
|
145
|
-
callAction: number;
|
|
146
|
-
callActionStr: string;
|
|
147
|
-
callActionMap: {
|
|
148
|
-
mc_audio?: boolean | undefined;
|
|
149
|
-
mc_video?: boolean | undefined;
|
|
150
|
-
ss_video?: boolean | undefined;
|
|
151
|
-
ss_audio?: boolean | undefined;
|
|
152
|
-
};
|
|
153
|
-
permissions: number;
|
|
154
|
-
permissionsStr: string;
|
|
155
|
-
permissionsMap: {
|
|
156
|
-
subscribe: boolean;
|
|
157
|
-
publish: boolean;
|
|
158
|
-
};
|
|
159
|
-
banBehavior: number;
|
|
160
|
-
banBehaviorStr: string;
|
|
161
|
-
banBehaviorMap: {
|
|
162
|
-
mc_audio?: boolean | undefined;
|
|
163
|
-
mc_video?: boolean | undefined;
|
|
164
|
-
ss_video?: boolean | undefined;
|
|
165
|
-
ss_audio?: boolean | undefined;
|
|
166
|
-
};
|
|
167
105
|
isOwner: boolean;
|
|
168
106
|
isAdmin: boolean;
|
|
169
107
|
isSelf: boolean;
|
|
108
|
+
callAction: number;
|
|
109
|
+
permissions: number;
|
|
110
|
+
behavior: number;
|
|
170
111
|
network: {
|
|
171
112
|
/**
|
|
172
113
|
* 上行网络质量 quality 的值 0 - 5
|
|
@@ -180,17 +121,15 @@ export declare class UserBase {
|
|
|
180
121
|
ingress: number;
|
|
181
122
|
};
|
|
182
123
|
tracks: {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
simulcast?: "f" | "h" | "q";
|
|
193
|
-
lastRetry?: boolean;
|
|
124
|
+
mediaType: K_mediaType;
|
|
125
|
+
trackName: string;
|
|
126
|
+
origin: "phoney" | "local" | "sfu" | "p2p";
|
|
127
|
+
simulcast: "f" | "h" | "q";
|
|
128
|
+
location: string;
|
|
129
|
+
mid: string;
|
|
130
|
+
msid: string;
|
|
131
|
+
type: number;
|
|
132
|
+
enabled: boolean;
|
|
194
133
|
}[];
|
|
195
134
|
};
|
|
196
135
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReportInfo } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* 从整连接 `getStats()` 结果中筛出与某条发送轨道相关的报告(对齐原 `getStats(track)` 子集)
|
|
4
|
+
*/
|
|
5
|
+
export declare function filterOutboundTrackReports(report: RTCStatsReport, track: MediaStreamTrack | null | undefined): ReportInfo[];
|
|
6
|
+
/**
|
|
7
|
+
* 从整连接 `getStats()` 结果中筛出与某条接收轨道相关的报告
|
|
8
|
+
*/
|
|
9
|
+
export declare function filterInboundTrackReports(report: RTCStatsReport, track: MediaStreamTrack | null | undefined, mid?: string | null): ReportInfo[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 在 Worker 内执行 webm-duration-fix;`buffer` 在 postMessage 时 transfer,调用后勿再读。
|
|
3
|
+
*/
|
|
4
|
+
export declare function fixWebmDurationInWorker(buffer: ArrayBuffer, mimeType: string): Promise<Blob>;
|
|
5
|
+
/** 终止 WebM 修复 Worker;`QuickVO.destroy` 时应调用。 */
|
|
6
|
+
export declare function destroyWebmFixWorker(): void;
|
|
@@ -4,6 +4,8 @@ export declare const enum_eventName: {
|
|
|
4
4
|
readonly ackMsg: "确认收到消息";
|
|
5
5
|
readonly reportNetwork: "上报网络类型";
|
|
6
6
|
readonly connectCF: "连接CF";
|
|
7
|
+
/** 获取 TURN/STUN 等 ICE 服务配置(SFU 主连接前) */
|
|
8
|
+
readonly genTurnAddress: "获取TURN地址";
|
|
7
9
|
readonly publish: "发布流";
|
|
8
10
|
readonly joinRoom: "加入房间";
|
|
9
11
|
readonly joinRoomEx: "加入房间(提前建连)";
|
|
@@ -36,4 +38,4 @@ export declare const eventName_options: {
|
|
|
36
38
|
label: any;
|
|
37
39
|
}[];
|
|
38
40
|
export declare const eventName_keys: (keyof typeof enum_eventName)[];
|
|
39
|
-
export declare const eventName_vals: ("关闭轨道" | "心跳" | "慢心跳" | "确认收到消息" | "上报网络类型" | "连接CF" | "发布流" | "加入房间" | "加入房间(提前建连)" | "广播已发布的轨道" | "订阅流" | "协商流" | "阻止用户行为" | "更新网络状态" | "更新通话状态" | "切换大小流" | "切换房间语音识别" | "同步房间" | "更新房间SDKTOKEN" | "发送P2P-offer" | "回应P2P-answer" | "发送P2P候选信息-candidate" | "上报P2P连接结果" | "退出房间" | "退出房间不断开连接" | "调试" | "WorkerAi调试" | "p2p轨道状态")[];
|
|
41
|
+
export declare const eventName_vals: ("关闭轨道" | "心跳" | "慢心跳" | "确认收到消息" | "上报网络类型" | "连接CF" | "获取TURN地址" | "发布流" | "加入房间" | "加入房间(提前建连)" | "广播已发布的轨道" | "订阅流" | "协商流" | "阻止用户行为" | "更新网络状态" | "更新通话状态" | "切换大小流" | "切换房间语音识别" | "同步房间" | "更新房间SDKTOKEN" | "发送P2P-offer" | "回应P2P-answer" | "发送P2P候选信息-candidate" | "上报P2P连接结果" | "退出房间" | "退出房间不断开连接" | "调试" | "WorkerAi调试" | "p2p轨道状态")[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const enum_notifyName: {
|
|
2
2
|
readonly onNetQuality: "网络质量回调";
|
|
3
|
+
readonly updateSeverTime: "服务端时间更新";
|
|
3
4
|
readonly onJoinRoom: "加入房间回调";
|
|
4
5
|
readonly onJoinRoomBatch: "加入房间批量回调";
|
|
5
6
|
readonly onQuitRoom: "退出房间回调";
|
|
@@ -32,4 +33,4 @@ export declare const notifyName_options: {
|
|
|
32
33
|
label: any;
|
|
33
34
|
}[];
|
|
34
35
|
export declare const notifyName_keys: (keyof typeof enum_notifyName)[];
|
|
35
|
-
export declare const notifyName_vals: ("网络质量回调" | "加入房间回调" | "加入房间批量回调" | "退出房间回调" | "退出房间批量回调" | "监听到流发布" | "关闭轨道" | "更新通讯状态" | "通知轨道失效" | "房间内的全体禁言状态发生变化" | "房间内的管理员发生变化" | "建立P2P连接" | "收到P2P-offer" | "收到P2P-answer" | "收到P2P候选信息-candidate" | "断开P2P" | "更新推流权限通知" | "批量更新推流权限通知" | "Token即将过期" | "Token已过期" | "销毁房间" | "行为允许权限变更" | "cdn播放地址变化" | "用户讲话")[];
|
|
36
|
+
export declare const notifyName_vals: ("网络质量回调" | "服务端时间更新" | "加入房间回调" | "加入房间批量回调" | "退出房间回调" | "退出房间批量回调" | "监听到流发布" | "关闭轨道" | "更新通讯状态" | "通知轨道失效" | "房间内的全体禁言状态发生变化" | "房间内的管理员发生变化" | "建立P2P连接" | "收到P2P-offer" | "收到P2P-answer" | "收到P2P候选信息-candidate" | "断开P2P" | "更新推流权限通知" | "批量更新推流权限通知" | "Token即将过期" | "Token已过期" | "销毁房间" | "行为允许权限变更" | "cdn播放地址变化" | "用户讲话")[];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
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
|
+
export * as tools from './tools';
|
|
7
|
+
/** cws 广播 on 回调:按事件名推断 payload */
|
|
8
|
+
export { defineCwsOn, type CallsWebSocketOn, type CwsNotifyPayloadFor, type CwsNotifyPayloadUnion, } from './protos/protoEvent';
|