@axonkit/client-sdk-js 0.1.0
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/LICENSE +85 -0
- package/README.md +125 -0
- package/dist/Room.d.ts +273 -0
- package/dist/axonkit-client.esm.js +1 -0
- package/dist/axonkit-client.umd.js +1 -0
- package/dist/connectionHelper/ConnectionCheck.d.ts +33 -0
- package/dist/data-stream/DataStreamManager.d.ts +65 -0
- package/dist/events.d.ts +432 -0
- package/dist/index.d.ts +41 -0
- package/dist/participant/LocalParticipant.d.ts +186 -0
- package/dist/participant/LocalTrackPublication.d.ts +28 -0
- package/dist/participant/Participant.d.ts +133 -0
- package/dist/participant/RemoteParticipant.d.ts +30 -0
- package/dist/participant/RemoteTrackPublication.d.ts +63 -0
- package/dist/protocol/errors.d.ts +22 -0
- package/dist/protocol/message.d.ts +30 -0
- package/dist/protocol/types.d.ts +522 -0
- package/dist/room/DefaultReconnectPolicy.d.ts +28 -0
- package/dist/room/options.d.ts +74 -0
- package/dist/rpc.d.ts +28 -0
- package/dist/signal/RPCClient.d.ts +28 -0
- package/dist/signal/SignalClient.d.ts +14 -0
- package/dist/stats/StatsCollector.d.ts +15 -0
- package/dist/track/LocalAudioTrack.d.ts +20 -0
- package/dist/track/LocalTrack.d.ts +108 -0
- package/dist/track/LocalVideoTrack.d.ts +35 -0
- package/dist/track/RemoteAudioTrack.d.ts +7 -0
- package/dist/track/RemoteTrack.d.ts +33 -0
- package/dist/track/RemoteVideoTrack.d.ts +31 -0
- package/dist/track/Track.d.ts +62 -0
- package/dist/track/create.d.ts +30 -0
- package/dist/track/options.d.ts +525 -0
- package/dist/track/processor/types.d.ts +49 -0
- package/dist/track/publishUtils.d.ts +14 -0
- package/dist/transport/TransportManager.d.ts +62 -0
- package/dist/types.d.ts +146 -0
- package/dist/utils/browser.d.ts +113 -0
- package/dist/utils/deviceFailure.d.ts +30 -0
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/logger.d.ts +39 -0
- package/dist/utils/typedEmitter.d.ts +24 -0
- package/dist/version.d.ts +2 -0
- package/package.json +80 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import type { types as mediasoupTypes } from 'mediasoup-client';
|
|
2
|
+
export declare enum RoomState {
|
|
3
|
+
Disconnected = "disconnected",
|
|
4
|
+
Connecting = "connecting",
|
|
5
|
+
Connected = "connected",
|
|
6
|
+
Reconnecting = "reconnecting"
|
|
7
|
+
}
|
|
8
|
+
export declare enum ConnectionQuality {
|
|
9
|
+
Excellent = "excellent",
|
|
10
|
+
Good = "good",
|
|
11
|
+
Poor = "poor",
|
|
12
|
+
Lost = "lost",
|
|
13
|
+
Unknown = "unknown"
|
|
14
|
+
}
|
|
15
|
+
export declare enum TrackKind {
|
|
16
|
+
Audio = "audio",
|
|
17
|
+
Video = "video"
|
|
18
|
+
}
|
|
19
|
+
export declare enum TrackSource {
|
|
20
|
+
Camera = "camera",
|
|
21
|
+
Microphone = "microphone",
|
|
22
|
+
ScreenShare = "screen_share",
|
|
23
|
+
ScreenShareAudio = "screen_share_audio",
|
|
24
|
+
Unknown = "unknown"
|
|
25
|
+
}
|
|
26
|
+
export declare enum VideoQuality {
|
|
27
|
+
LOW = 0,
|
|
28
|
+
MEDIUM = 1,
|
|
29
|
+
HIGH = 2
|
|
30
|
+
}
|
|
31
|
+
export declare enum AudioTrackFeature {
|
|
32
|
+
AutoGainControl = "auto_gain_control",
|
|
33
|
+
EchoCancellation = "echo_cancellation",
|
|
34
|
+
NoiseSuppression = "noise_suppression",
|
|
35
|
+
Stereo = "stereo",
|
|
36
|
+
NoDtx = "no_dtx",
|
|
37
|
+
EnhancedNoiseCancellation = "enhanced_noise_cancellation"
|
|
38
|
+
}
|
|
39
|
+
export declare enum StreamState {
|
|
40
|
+
Active = "active",
|
|
41
|
+
Paused = "paused",
|
|
42
|
+
Unknown = "unknown"
|
|
43
|
+
}
|
|
44
|
+
export declare enum DisconnectReason {
|
|
45
|
+
UnknownReason = 0,
|
|
46
|
+
ClientInitiated = 1,
|
|
47
|
+
DuplicateIdentity = 2,
|
|
48
|
+
ServerShutdown = 3,
|
|
49
|
+
ParticipantRemoved = 4,
|
|
50
|
+
RoomDeleted = 5,
|
|
51
|
+
StateMismatch = 6,
|
|
52
|
+
JoinFailure = 7,
|
|
53
|
+
Migration = 8,
|
|
54
|
+
SignalClose = 9,
|
|
55
|
+
RoomClosed = 10,
|
|
56
|
+
UserUnavailable = 11,
|
|
57
|
+
UserRejected = 12,
|
|
58
|
+
SipTrunkFailure = 13,
|
|
59
|
+
ConnectionTimeout = 14,
|
|
60
|
+
MediaFailure = 15
|
|
61
|
+
}
|
|
62
|
+
export declare enum ParticipantState {
|
|
63
|
+
Joining = 0,
|
|
64
|
+
Joined = 1,
|
|
65
|
+
Suspended = 2,
|
|
66
|
+
Disconnected = 3
|
|
67
|
+
}
|
|
68
|
+
export interface IceParameters {
|
|
69
|
+
usernameFragment: string;
|
|
70
|
+
password: string;
|
|
71
|
+
iceLite?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface IceCandidate {
|
|
74
|
+
foundation: string;
|
|
75
|
+
priority: number;
|
|
76
|
+
ip: string;
|
|
77
|
+
address?: string;
|
|
78
|
+
protocol: 'udp' | 'tcp';
|
|
79
|
+
port: number;
|
|
80
|
+
type: 'host' | 'srflx' | 'prflx' | 'relay';
|
|
81
|
+
tcpType?: 'active' | 'passive' | 'so';
|
|
82
|
+
}
|
|
83
|
+
export interface DtlsParameters {
|
|
84
|
+
role?: 'auto' | 'client' | 'server';
|
|
85
|
+
fingerprints: DtlsFingerprint[];
|
|
86
|
+
}
|
|
87
|
+
export interface DtlsFingerprint {
|
|
88
|
+
algorithm: string;
|
|
89
|
+
value: string;
|
|
90
|
+
}
|
|
91
|
+
export interface SctpParameters {
|
|
92
|
+
port: number;
|
|
93
|
+
OS: number;
|
|
94
|
+
MIS: number;
|
|
95
|
+
maxMessageSize: number;
|
|
96
|
+
}
|
|
97
|
+
export interface SctpStreamParameters {
|
|
98
|
+
streamId: number;
|
|
99
|
+
ordered?: boolean;
|
|
100
|
+
maxPacketLifeTime?: number;
|
|
101
|
+
maxRetransmits?: number;
|
|
102
|
+
}
|
|
103
|
+
export interface TransportParams {
|
|
104
|
+
sid: string;
|
|
105
|
+
iceParameters: IceParameters;
|
|
106
|
+
iceCandidates: IceCandidate[];
|
|
107
|
+
dtlsParameters: DtlsParameters;
|
|
108
|
+
sctpParameters?: SctpParameters;
|
|
109
|
+
}
|
|
110
|
+
export interface DataChannelInfo {
|
|
111
|
+
channelSid: string;
|
|
112
|
+
dataSourceSid?: string;
|
|
113
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
114
|
+
label: string;
|
|
115
|
+
protocol: string;
|
|
116
|
+
}
|
|
117
|
+
export interface SignalChannels {
|
|
118
|
+
receive: DataChannelInfo & {
|
|
119
|
+
dataSourceSid: string;
|
|
120
|
+
};
|
|
121
|
+
send: DataChannelInfo;
|
|
122
|
+
}
|
|
123
|
+
export interface ServerInfo {
|
|
124
|
+
nodeId: string;
|
|
125
|
+
region: string;
|
|
126
|
+
protocol: number;
|
|
127
|
+
}
|
|
128
|
+
export interface RoomInfo {
|
|
129
|
+
sid: string;
|
|
130
|
+
name: string;
|
|
131
|
+
metadata?: string;
|
|
132
|
+
numParticipants?: number;
|
|
133
|
+
numPublishers?: number;
|
|
134
|
+
activeRecording?: boolean;
|
|
135
|
+
sharedState?: Record<string, string>;
|
|
136
|
+
}
|
|
137
|
+
export declare enum ParticipantKind {
|
|
138
|
+
Standard = 0,
|
|
139
|
+
Ingress = 1,
|
|
140
|
+
Egress = 2,
|
|
141
|
+
Sip = 3,
|
|
142
|
+
Agent = 4
|
|
143
|
+
}
|
|
144
|
+
export interface ParticipantPermission {
|
|
145
|
+
canPublish: boolean;
|
|
146
|
+
canSubscribe: boolean;
|
|
147
|
+
canPublishData: boolean;
|
|
148
|
+
canPublishSources: TrackSource[];
|
|
149
|
+
canUpdateMetadata: boolean;
|
|
150
|
+
canManageGroups: boolean;
|
|
151
|
+
hidden: boolean;
|
|
152
|
+
recorder: boolean;
|
|
153
|
+
agent: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface ParticipantInfo {
|
|
156
|
+
sid: string;
|
|
157
|
+
identity: string;
|
|
158
|
+
name?: string;
|
|
159
|
+
metadata?: string;
|
|
160
|
+
state: ParticipantState;
|
|
161
|
+
tracks?: TrackInfo[];
|
|
162
|
+
attributes?: Record<string, string>;
|
|
163
|
+
kind?: ParticipantKind;
|
|
164
|
+
joinedAt?: number;
|
|
165
|
+
disconnectReason?: DisconnectReason;
|
|
166
|
+
permission?: ParticipantPermission;
|
|
167
|
+
groupId?: string;
|
|
168
|
+
}
|
|
169
|
+
export interface TrackInfo {
|
|
170
|
+
sid: string;
|
|
171
|
+
name: string;
|
|
172
|
+
kind: TrackKind;
|
|
173
|
+
source: TrackSource;
|
|
174
|
+
muted: boolean;
|
|
175
|
+
width?: number;
|
|
176
|
+
height?: number;
|
|
177
|
+
appData?: Record<string, unknown>;
|
|
178
|
+
}
|
|
179
|
+
export interface DataTrackInfo {
|
|
180
|
+
sid: string;
|
|
181
|
+
name: string;
|
|
182
|
+
label: string;
|
|
183
|
+
protocol: string;
|
|
184
|
+
appData?: Record<string, unknown>;
|
|
185
|
+
}
|
|
186
|
+
export interface ClientInfo {
|
|
187
|
+
sdk: number;
|
|
188
|
+
version: string;
|
|
189
|
+
protocol: number;
|
|
190
|
+
}
|
|
191
|
+
export interface ConnectionSettings {
|
|
192
|
+
autoSubscribe: boolean;
|
|
193
|
+
adaptiveStream: boolean;
|
|
194
|
+
lastN?: number;
|
|
195
|
+
dtlsFingerprints?: DtlsFingerprint[];
|
|
196
|
+
}
|
|
197
|
+
export interface JoinRequest {
|
|
198
|
+
room: {
|
|
199
|
+
name: string;
|
|
200
|
+
metadata?: string;
|
|
201
|
+
};
|
|
202
|
+
clientInfo: ClientInfo;
|
|
203
|
+
connectionSettings: ConnectionSettings;
|
|
204
|
+
reconnect: boolean;
|
|
205
|
+
participantSid: string;
|
|
206
|
+
nodeId: string;
|
|
207
|
+
token?: string;
|
|
208
|
+
refreshToken?: string;
|
|
209
|
+
}
|
|
210
|
+
export interface JoinResponse {
|
|
211
|
+
room: RoomInfo;
|
|
212
|
+
participant: ParticipantInfo;
|
|
213
|
+
pingTimeout: number;
|
|
214
|
+
pingInterval: number;
|
|
215
|
+
statsInterval?: number;
|
|
216
|
+
serverInfo: ServerInfo;
|
|
217
|
+
iceServers: RTCIceServer[];
|
|
218
|
+
sendTransport: TransportParams;
|
|
219
|
+
receiveTransport: TransportParams;
|
|
220
|
+
signal: SignalChannels;
|
|
221
|
+
rtpCapabilities: mediasoupTypes.RtpCapabilities;
|
|
222
|
+
otherParticipants?: ParticipantInfo[];
|
|
223
|
+
fullReconnect?: boolean;
|
|
224
|
+
refreshToken?: string;
|
|
225
|
+
iceTransportPolicy?: RTCIceTransportPolicy;
|
|
226
|
+
}
|
|
227
|
+
export interface TokenRefreshedNotification {
|
|
228
|
+
token: string;
|
|
229
|
+
}
|
|
230
|
+
export interface ReconnectResponse {
|
|
231
|
+
iceParameters: Record<string, IceParameters>;
|
|
232
|
+
}
|
|
233
|
+
export interface ConnectRequest {
|
|
234
|
+
nodeId: string;
|
|
235
|
+
participantSid: string;
|
|
236
|
+
transports: TransportConnectInfo[];
|
|
237
|
+
token?: string;
|
|
238
|
+
}
|
|
239
|
+
export interface TransportConnectInfo {
|
|
240
|
+
transportSid: string;
|
|
241
|
+
dtlsParameters: DtlsParameters;
|
|
242
|
+
}
|
|
243
|
+
export interface SyncState {
|
|
244
|
+
subscribedTrackSids: string[];
|
|
245
|
+
subscribedDataTrackSids: string[];
|
|
246
|
+
publishedTrackSids: string[];
|
|
247
|
+
dataReceiveStates: DataReceiveState[];
|
|
248
|
+
/** Timestamp of the last chat message the client received before disconnect. */
|
|
249
|
+
lastMessageTimestamp?: number;
|
|
250
|
+
}
|
|
251
|
+
export interface DataReceiveState {
|
|
252
|
+
dataTrackSid: string;
|
|
253
|
+
lastSeq: number;
|
|
254
|
+
}
|
|
255
|
+
export interface ReadyRequest {
|
|
256
|
+
rtpCapabilities: mediasoupTypes.RtpCapabilities;
|
|
257
|
+
syncState?: SyncState;
|
|
258
|
+
}
|
|
259
|
+
export interface ReadyResponse {
|
|
260
|
+
otherParticipants: ParticipantInfo[];
|
|
261
|
+
room?: RoomInfo;
|
|
262
|
+
groups?: GroupInfo[];
|
|
263
|
+
messages?: MessageInfo[];
|
|
264
|
+
sharedState?: Record<string, string>;
|
|
265
|
+
}
|
|
266
|
+
export interface MessageInfo {
|
|
267
|
+
id: string;
|
|
268
|
+
type?: string;
|
|
269
|
+
message: string;
|
|
270
|
+
timestamp: number;
|
|
271
|
+
editTimestamp?: number;
|
|
272
|
+
transient?: boolean;
|
|
273
|
+
participantSid?: string;
|
|
274
|
+
participantIdentity?: string;
|
|
275
|
+
}
|
|
276
|
+
/** @deprecated Use {@link MessageInfo} instead. */
|
|
277
|
+
export type ChatMessageInfo = MessageInfo;
|
|
278
|
+
export interface MessageDeletedNotification {
|
|
279
|
+
ids: string[];
|
|
280
|
+
type?: string;
|
|
281
|
+
}
|
|
282
|
+
export interface StateUpdatedNotification {
|
|
283
|
+
key: string;
|
|
284
|
+
value: string;
|
|
285
|
+
participantSid?: string;
|
|
286
|
+
participantIdentity?: string;
|
|
287
|
+
}
|
|
288
|
+
export interface StateDeletedNotification {
|
|
289
|
+
key: string;
|
|
290
|
+
participantSid?: string;
|
|
291
|
+
participantIdentity?: string;
|
|
292
|
+
}
|
|
293
|
+
export interface LeaveRequest {
|
|
294
|
+
reason?: string;
|
|
295
|
+
}
|
|
296
|
+
export interface PingRequest {
|
|
297
|
+
timestamp: number;
|
|
298
|
+
}
|
|
299
|
+
export interface PingResponse {
|
|
300
|
+
lastTimestamp: number;
|
|
301
|
+
serverTime: number;
|
|
302
|
+
}
|
|
303
|
+
export interface TrackPublishRequest {
|
|
304
|
+
clientTrackId: string;
|
|
305
|
+
name: string;
|
|
306
|
+
kind: TrackKind;
|
|
307
|
+
rtpParameters: mediasoupTypes.RtpParameters;
|
|
308
|
+
source: TrackSource;
|
|
309
|
+
width?: number;
|
|
310
|
+
height?: number;
|
|
311
|
+
muted: boolean;
|
|
312
|
+
videoCodec?: string;
|
|
313
|
+
backupCodec?: string;
|
|
314
|
+
backupCodecPolicy?: number;
|
|
315
|
+
appData?: Record<string, unknown>;
|
|
316
|
+
}
|
|
317
|
+
export interface PublishBackupTrackRequest {
|
|
318
|
+
trackSid: string;
|
|
319
|
+
clientTrackId: string;
|
|
320
|
+
rtpParameters: mediasoupTypes.RtpParameters;
|
|
321
|
+
}
|
|
322
|
+
export interface PublishBackupTrackResponse {
|
|
323
|
+
backupTrackSid: string;
|
|
324
|
+
}
|
|
325
|
+
export interface TrackPublishResponse {
|
|
326
|
+
trackSid: string;
|
|
327
|
+
}
|
|
328
|
+
export interface TrackUnpublishRequest {
|
|
329
|
+
trackSid: string;
|
|
330
|
+
}
|
|
331
|
+
export interface TrackMuteRequest {
|
|
332
|
+
trackSid: string;
|
|
333
|
+
muted: boolean;
|
|
334
|
+
}
|
|
335
|
+
export interface TrackUpdateRequest {
|
|
336
|
+
trackSid: string;
|
|
337
|
+
width?: number;
|
|
338
|
+
height?: number;
|
|
339
|
+
}
|
|
340
|
+
export interface DataTrackPublishRequest {
|
|
341
|
+
clientTrackId: string;
|
|
342
|
+
transportSid: string;
|
|
343
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
344
|
+
name: string;
|
|
345
|
+
label: string;
|
|
346
|
+
protocol: string;
|
|
347
|
+
appData?: Record<string, unknown>;
|
|
348
|
+
}
|
|
349
|
+
export interface DataTrackPublishResponse {
|
|
350
|
+
dataTrackSid: string;
|
|
351
|
+
}
|
|
352
|
+
export interface DataTrackUnpublishRequest {
|
|
353
|
+
dataTrackSid: string;
|
|
354
|
+
}
|
|
355
|
+
export interface SubscriptionActionRequest {
|
|
356
|
+
subscriptionSid: string;
|
|
357
|
+
}
|
|
358
|
+
export interface SubscriptionSetLayersRequest {
|
|
359
|
+
subscriptionSid: string;
|
|
360
|
+
spatialLayer: number;
|
|
361
|
+
temporalLayer?: number;
|
|
362
|
+
}
|
|
363
|
+
export interface SubscriptionSetPriorityRequest {
|
|
364
|
+
subscriptionSid: string;
|
|
365
|
+
priority: number;
|
|
366
|
+
}
|
|
367
|
+
export interface DataSubscriptionCloseRequest {
|
|
368
|
+
dataSubscriptionSid: string;
|
|
369
|
+
}
|
|
370
|
+
export interface TransportGetStatsRequest {
|
|
371
|
+
transportSid: string;
|
|
372
|
+
}
|
|
373
|
+
export interface ParticipantUpdateRequest {
|
|
374
|
+
metadata?: string;
|
|
375
|
+
name?: string;
|
|
376
|
+
attributes?: Record<string, string>;
|
|
377
|
+
}
|
|
378
|
+
export interface ParticipantTrackPermission {
|
|
379
|
+
/** The participant identity this permission applies to. */
|
|
380
|
+
participantIdentity?: string;
|
|
381
|
+
/** The participant server id this permission applies to. */
|
|
382
|
+
participantSid?: string;
|
|
383
|
+
/** Grant permission to all tracks. Takes precedence over allowedTrackSids. */
|
|
384
|
+
allowAll?: boolean;
|
|
385
|
+
/** List of track sids the target participant can subscribe to. */
|
|
386
|
+
allowedTrackSids?: string[];
|
|
387
|
+
}
|
|
388
|
+
export interface UpdateSubscriptionPermissionsRequest {
|
|
389
|
+
allParticipantsAllowed: boolean;
|
|
390
|
+
trackPermissions: ParticipantTrackPermission[];
|
|
391
|
+
}
|
|
392
|
+
export interface SubscriptionCreateRequest {
|
|
393
|
+
subscriptionSid: string;
|
|
394
|
+
trackSid: string;
|
|
395
|
+
trackName: string;
|
|
396
|
+
trackSource: TrackSource;
|
|
397
|
+
publisherSid: string;
|
|
398
|
+
kind: TrackKind;
|
|
399
|
+
rtpParameters: mediasoupTypes.RtpParameters;
|
|
400
|
+
subscriptionType?: string;
|
|
401
|
+
trackMuted: boolean;
|
|
402
|
+
appData?: Record<string, unknown>;
|
|
403
|
+
}
|
|
404
|
+
export interface DataSubscriptionCreateRequest {
|
|
405
|
+
dataSubscriptionSid: string;
|
|
406
|
+
dataTrackSid: string;
|
|
407
|
+
publisherSid: string;
|
|
408
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
409
|
+
label: string;
|
|
410
|
+
protocol: string;
|
|
411
|
+
appData?: Record<string, unknown>;
|
|
412
|
+
}
|
|
413
|
+
export interface SubscriptionClosedNotification {
|
|
414
|
+
subscriptionSid: string;
|
|
415
|
+
}
|
|
416
|
+
export interface DataSubscriptionClosedNotification {
|
|
417
|
+
dataSubscriptionSid: string;
|
|
418
|
+
}
|
|
419
|
+
export interface ParticipantJoinedNotification {
|
|
420
|
+
participant: ParticipantInfo;
|
|
421
|
+
}
|
|
422
|
+
export interface ParticipantLeftNotification {
|
|
423
|
+
participantSid: string;
|
|
424
|
+
reason?: string;
|
|
425
|
+
}
|
|
426
|
+
export interface ParticipantUpdatedNotification {
|
|
427
|
+
participant: ParticipantInfo;
|
|
428
|
+
}
|
|
429
|
+
export interface TrackPublishedNotification {
|
|
430
|
+
participantSid: string;
|
|
431
|
+
track: TrackInfo;
|
|
432
|
+
}
|
|
433
|
+
export interface TrackUnpublishedNotification {
|
|
434
|
+
participantSid: string;
|
|
435
|
+
trackSid: string;
|
|
436
|
+
}
|
|
437
|
+
export interface DataTrackPublishedNotification {
|
|
438
|
+
participantSid: string;
|
|
439
|
+
dataTrack: DataTrackInfo;
|
|
440
|
+
}
|
|
441
|
+
export interface DataTrackUnpublishedNotification {
|
|
442
|
+
participantSid: string;
|
|
443
|
+
dataTrackSid: string;
|
|
444
|
+
}
|
|
445
|
+
export interface TrackMutedNotification {
|
|
446
|
+
participantSid: string;
|
|
447
|
+
trackSid: string;
|
|
448
|
+
muted: boolean;
|
|
449
|
+
}
|
|
450
|
+
export interface SubscribedQualityInfo {
|
|
451
|
+
quality: VideoQuality;
|
|
452
|
+
enabled: boolean;
|
|
453
|
+
}
|
|
454
|
+
export interface SubscribedCodecInfo {
|
|
455
|
+
codec: string;
|
|
456
|
+
qualities: SubscribedQualityInfo[];
|
|
457
|
+
}
|
|
458
|
+
export interface TrackSubscribedQualityChangedNotification {
|
|
459
|
+
trackSid: string;
|
|
460
|
+
subscribedQualities: SubscribedQualityInfo[];
|
|
461
|
+
subscribedCodecs?: SubscribedCodecInfo[];
|
|
462
|
+
}
|
|
463
|
+
export interface TrackSubscriptionStatusChangedNotification {
|
|
464
|
+
trackSid: string;
|
|
465
|
+
hasSubscribers: boolean;
|
|
466
|
+
}
|
|
467
|
+
export interface ActiveSpeaker {
|
|
468
|
+
participantSid: string;
|
|
469
|
+
level: number;
|
|
470
|
+
active: boolean;
|
|
471
|
+
}
|
|
472
|
+
export interface ActiveSpeakersChangedNotification {
|
|
473
|
+
speakers: ActiveSpeaker[];
|
|
474
|
+
}
|
|
475
|
+
export interface RoomUpdatedNotification {
|
|
476
|
+
room: RoomInfo;
|
|
477
|
+
}
|
|
478
|
+
export interface DisconnectNotification {
|
|
479
|
+
reason: DisconnectReason;
|
|
480
|
+
}
|
|
481
|
+
export interface GroupInfo {
|
|
482
|
+
groupId: string;
|
|
483
|
+
name: string;
|
|
484
|
+
permissions?: ParticipantPermission;
|
|
485
|
+
participantCount: number;
|
|
486
|
+
}
|
|
487
|
+
export interface CreateGroupRequest {
|
|
488
|
+
name: string;
|
|
489
|
+
permissions?: ParticipantPermission;
|
|
490
|
+
}
|
|
491
|
+
export interface CreateGroupResponse {
|
|
492
|
+
group: GroupInfo;
|
|
493
|
+
}
|
|
494
|
+
export interface DeleteGroupRequest {
|
|
495
|
+
groupId: string;
|
|
496
|
+
}
|
|
497
|
+
export interface ListGroupsResponse {
|
|
498
|
+
groups: GroupInfo[];
|
|
499
|
+
}
|
|
500
|
+
export interface JoinGroupRequest {
|
|
501
|
+
groupId: string;
|
|
502
|
+
}
|
|
503
|
+
export interface JoinGroupResponse {
|
|
504
|
+
otherParticipants: ParticipantInfo[];
|
|
505
|
+
}
|
|
506
|
+
export interface GroupCreatedNotification {
|
|
507
|
+
group: GroupInfo;
|
|
508
|
+
}
|
|
509
|
+
export interface GroupUpdatedNotification {
|
|
510
|
+
group: GroupInfo;
|
|
511
|
+
}
|
|
512
|
+
export interface GroupDeletedNotification {
|
|
513
|
+
groupId: string;
|
|
514
|
+
}
|
|
515
|
+
export interface GroupParticipantJoinedNotification {
|
|
516
|
+
groupId: string;
|
|
517
|
+
participantSid: string;
|
|
518
|
+
}
|
|
519
|
+
export interface GroupParticipantLeftNotification {
|
|
520
|
+
groupId: string;
|
|
521
|
+
participantSid: string;
|
|
522
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context provided to a reconnect policy when computing the next retry delay.
|
|
3
|
+
*/
|
|
4
|
+
export interface ReconnectContext {
|
|
5
|
+
retryCount: number;
|
|
6
|
+
elapsedMs: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Default reconnect policy with exponential back-off and jitter.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const policy = new DefaultReconnectPolicy(10);
|
|
14
|
+
* const delay = policy.nextRetryDelayInMs({ retryCount: 1, elapsedMs: 0 });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class DefaultReconnectPolicy {
|
|
18
|
+
private readonly maxRetries;
|
|
19
|
+
private readonly baseDelay;
|
|
20
|
+
private readonly maxDelay;
|
|
21
|
+
constructor(maxRetries?: number, baseDelay?: number, maxDelay?: number);
|
|
22
|
+
/**
|
|
23
|
+
* Returns the number of milliseconds to wait before the next reconnect
|
|
24
|
+
* attempt, or `null` if the policy says to stop trying.
|
|
25
|
+
*/
|
|
26
|
+
nextRetryDelayInMs(context: ReconnectContext): number | null;
|
|
27
|
+
reset(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { VideoCaptureOptions, AudioCaptureOptions, TrackPublishDefaults } from '../track/options';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for the adaptive stream feature. When enabled the SDK
|
|
4
|
+
* automatically manages video subscription quality based on element
|
|
5
|
+
* visibility and dimensions.
|
|
6
|
+
*/
|
|
7
|
+
export interface AdaptiveStreamSettings {
|
|
8
|
+
/**
|
|
9
|
+
* Pixel density to use when computing the required video resolution.
|
|
10
|
+
* Set to `'screen'` to use `window.devicePixelRatio`.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue `1`
|
|
13
|
+
*/
|
|
14
|
+
pixelDensity?: number | 'screen';
|
|
15
|
+
/**
|
|
16
|
+
* Pause video subscriptions when the browser tab is hidden.
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue `true`
|
|
19
|
+
*/
|
|
20
|
+
pauseVideoInBackground?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Top-level options for a {@link Room} instance.
|
|
24
|
+
*/
|
|
25
|
+
export interface RoomOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Automatically manage subscribed video quality based on the size and
|
|
28
|
+
* visibility of attached elements. Pass `true` to enable with defaults
|
|
29
|
+
* or provide {@link AdaptiveStreamSettings} for fine-grained control.
|
|
30
|
+
*/
|
|
31
|
+
adaptiveStream?: boolean | AdaptiveStreamSettings;
|
|
32
|
+
/**
|
|
33
|
+
* Enable Dynacast — dynamically pause video layers that have no
|
|
34
|
+
* subscribers on the server.
|
|
35
|
+
*/
|
|
36
|
+
dynacast?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Default capture options used when creating camera tracks.
|
|
39
|
+
*/
|
|
40
|
+
videoCaptureDefaults?: VideoCaptureOptions;
|
|
41
|
+
/**
|
|
42
|
+
* Default capture options used when creating microphone tracks.
|
|
43
|
+
*/
|
|
44
|
+
audioCaptureDefaults?: AudioCaptureOptions;
|
|
45
|
+
/**
|
|
46
|
+
* Default publish parameters applied to every track unless overridden
|
|
47
|
+
* per-track.
|
|
48
|
+
*/
|
|
49
|
+
publishDefaults?: TrackPublishDefaults;
|
|
50
|
+
/**
|
|
51
|
+
* Room name sent in the JoinRequest for server-side routing and room
|
|
52
|
+
* creation. Must match the `room` claim in the JWT token (if present).
|
|
53
|
+
*/
|
|
54
|
+
roomName?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Room metadata (e.g. meeting topic) sent in the JoinRequest when the
|
|
57
|
+
* room is auto-created. Only takes effect for the first participant
|
|
58
|
+
* that causes the room to be created. Maximum size: 64 KB.
|
|
59
|
+
*/
|
|
60
|
+
metadata?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Maximum number of remote participants whose audio/video tracks this
|
|
63
|
+
* client will receive. `0` (default) means receive all participants.
|
|
64
|
+
*
|
|
65
|
+
* When set to a positive number, the server will only auto-subscribe
|
|
66
|
+
* this participant to at most `lastN` publishers' media tracks.
|
|
67
|
+
*/
|
|
68
|
+
lastN?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Options for Room.connect()
|
|
72
|
+
*/
|
|
73
|
+
export interface RoomConnectOptions extends Partial<InternalRoomConnectOptions> {
|
|
74
|
+
}
|
package/dist/rpc.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specialized error for RPC methods.
|
|
3
|
+
*
|
|
4
|
+
* When thrown in an RPC handler, the `message` and `code` are sent back to
|
|
5
|
+
* the caller. Built-in error codes 1001–1999 are reserved.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RpcError extends Error {
|
|
8
|
+
static MAX_MESSAGE_BYTES: number;
|
|
9
|
+
static MAX_DATA_BYTES: number;
|
|
10
|
+
code: number;
|
|
11
|
+
data?: string;
|
|
12
|
+
constructor(code: number, message: string, data?: string);
|
|
13
|
+
static ErrorCode: {
|
|
14
|
+
readonly APPLICATION_ERROR: 1500;
|
|
15
|
+
readonly CONNECTION_TIMEOUT: 1501;
|
|
16
|
+
readonly RESPONSE_TIMEOUT: 1502;
|
|
17
|
+
readonly RECIPIENT_DISCONNECTED: 1503;
|
|
18
|
+
readonly RESPONSE_PAYLOAD_TOO_LARGE: 1504;
|
|
19
|
+
readonly SEND_FAILED: 1505;
|
|
20
|
+
readonly UNSUPPORTED_METHOD: 1400;
|
|
21
|
+
readonly RECIPIENT_NOT_FOUND: 1401;
|
|
22
|
+
readonly REQUEST_PAYLOAD_TOO_LARGE: 1402;
|
|
23
|
+
};
|
|
24
|
+
static ErrorMessage: Record<keyof typeof RpcError.ErrorCode, string>;
|
|
25
|
+
/** Create a built-in error by key name. */
|
|
26
|
+
static builtIn(key: keyof typeof RpcError.ErrorCode, data?: string): RpcError;
|
|
27
|
+
}
|
|
28
|
+
export declare const MAX_RPC_PAYLOAD_BYTES = 15360;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { types as mediasoupTypes } from 'mediasoup-client';
|
|
2
|
+
import { TypedEmitter } from '../utils/typedEmitter';
|
|
3
|
+
type RequestHandler = (body: any) => Promise<any>;
|
|
4
|
+
type NotificationHandler = (body: any) => void;
|
|
5
|
+
export type RPCEvents = {
|
|
6
|
+
closed: () => void;
|
|
7
|
+
error: (err: Error) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare class RPCClient extends TypedEmitter<RPCEvents> {
|
|
10
|
+
private sendDC;
|
|
11
|
+
private pending;
|
|
12
|
+
private requestHandlers;
|
|
13
|
+
private notificationHandlers;
|
|
14
|
+
private closed;
|
|
15
|
+
lastSentAt: number;
|
|
16
|
+
bind(sendDC: mediasoupTypes.DataProducer, recvDC: mediasoupTypes.DataConsumer): void;
|
|
17
|
+
request<T = any>(method: string, body?: object, timeout?: number): Promise<T>;
|
|
18
|
+
respond(logId: string, status: number, body?: object, headers?: Record<string, string>): void;
|
|
19
|
+
notify(method: string, body?: object): void;
|
|
20
|
+
onRequest(method: string, handler: RequestHandler): void;
|
|
21
|
+
onNotification(method: string, handler: NotificationHandler): void;
|
|
22
|
+
close(): void;
|
|
23
|
+
private handleMessage;
|
|
24
|
+
private handleResponse;
|
|
25
|
+
private handleIncomingRequest;
|
|
26
|
+
private handleNotification;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JoinRequest, JoinResponse, ReconnectResponse, ConnectRequest } from '../protocol/types';
|
|
2
|
+
export interface JoinResult {
|
|
3
|
+
response: JoinResponse | ReconnectResponse;
|
|
4
|
+
logId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function isReconnectResponse(resp: any): resp is ReconnectResponse;
|
|
7
|
+
export declare class SignalClient {
|
|
8
|
+
private nodeId;
|
|
9
|
+
private logId;
|
|
10
|
+
get currentNodeId(): string;
|
|
11
|
+
get currentLogId(): string;
|
|
12
|
+
join(url: string, request: JoinRequest): Promise<JoinResult>;
|
|
13
|
+
connect(url: string, request: ConnectRequest, roomName?: string): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RPCClient } from '../signal/RPCClient';
|
|
2
|
+
import { TransportManager } from '../transport/TransportManager';
|
|
3
|
+
import { LocalParticipant } from '../participant/LocalParticipant';
|
|
4
|
+
import { RemoteParticipant } from '../participant/RemoteParticipant';
|
|
5
|
+
export declare class StatsCollector {
|
|
6
|
+
private rpc;
|
|
7
|
+
private transportManager;
|
|
8
|
+
private localParticipant;
|
|
9
|
+
private remoteParticipants;
|
|
10
|
+
private timer?;
|
|
11
|
+
constructor(rpc: RPCClient, transportManager: TransportManager, localParticipant: LocalParticipant, remoteParticipants: Map<string, RemoteParticipant>);
|
|
12
|
+
start(intervalSec: number): void;
|
|
13
|
+
stop(): void;
|
|
14
|
+
private collect;
|
|
15
|
+
}
|