@defcomm/meetingsdk 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 +21 -0
- package/README.md +1000 -0
- package/dist/index.d.mts +543 -0
- package/dist/index.d.ts +543 -0
- package/dist/index.js +2289 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2253 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
4
|
+
|
|
5
|
+
type Events = {
|
|
6
|
+
onMicToggled?: (peerId: string, enabled: boolean) => void;
|
|
7
|
+
onError?: (err: SDKError) => void;
|
|
8
|
+
onCamToggled?: (peerId: string, enabled: boolean) => void;
|
|
9
|
+
onTrack?: (stream: MediaStream, peerId: string) => void;
|
|
10
|
+
onScreenTrack?: (stream: MediaStream, peerId: string) => void;
|
|
11
|
+
onUserJoined?: (p: Participant) => void;
|
|
12
|
+
onEntryRequested?: (req: EntryRequest) => void;
|
|
13
|
+
onEntryResponded?: (payload: {
|
|
14
|
+
participantId: string;
|
|
15
|
+
decision: EntryDecision;
|
|
16
|
+
} | string, decision?: EntryDecision) => void;
|
|
17
|
+
onJoinApproved?: (requestId: string) => void;
|
|
18
|
+
onJoinRejected?: (requestId: string) => void;
|
|
19
|
+
onConnectionStateChanged?: (state: string) => void;
|
|
20
|
+
onRoomUpdate?: (data: any) => void;
|
|
21
|
+
onUserLeft?: (id: string) => void;
|
|
22
|
+
onMeetingLeft?: () => void;
|
|
23
|
+
onChatMessage?: (msg: ChatMessage) => void;
|
|
24
|
+
onScreenShareStarted?: (peerId: string, stream: MediaStream) => void;
|
|
25
|
+
onScreenShareStopped?: (peerId: string) => void;
|
|
26
|
+
onMuteStateChanged?: (peerId: string, kind: "audio" | "video", muted: boolean) => void;
|
|
27
|
+
onTrackStateChanged?: (track: TrackDescriptor & {
|
|
28
|
+
participant_id: string;
|
|
29
|
+
kind: "audio" | "video";
|
|
30
|
+
muted: boolean;
|
|
31
|
+
}) => void;
|
|
32
|
+
onRecordingStarted?: (recording: {
|
|
33
|
+
recording_id: string;
|
|
34
|
+
started_at: string;
|
|
35
|
+
}) => void;
|
|
36
|
+
onRecordingStopped?: (recording: {
|
|
37
|
+
recording_id: string;
|
|
38
|
+
stopped_at: string;
|
|
39
|
+
}) => void;
|
|
40
|
+
};
|
|
41
|
+
type ChatMessage = {
|
|
42
|
+
id: string;
|
|
43
|
+
text: string;
|
|
44
|
+
sender_id: string;
|
|
45
|
+
sender_name?: string;
|
|
46
|
+
timestamp: number;
|
|
47
|
+
reply_to?: {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
} | null;
|
|
51
|
+
target?: string | null;
|
|
52
|
+
};
|
|
53
|
+
type Participant = {
|
|
54
|
+
id: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
isHost?: boolean;
|
|
57
|
+
isLocal?: boolean;
|
|
58
|
+
media?: ParticipantMedia;
|
|
59
|
+
isPresenter?: boolean;
|
|
60
|
+
connectionState?: "connected" | "reconnecting" | "disconnected";
|
|
61
|
+
};
|
|
62
|
+
type ParticipantMedia = {
|
|
63
|
+
stream?: MediaStream | null;
|
|
64
|
+
screenStream?: MediaStream | null;
|
|
65
|
+
cameraTrack?: MediaStreamTrack;
|
|
66
|
+
screenTrack?: MediaStreamTrack;
|
|
67
|
+
audioTrack?: MediaStreamTrack;
|
|
68
|
+
micEnabled: boolean;
|
|
69
|
+
camEnabled: boolean;
|
|
70
|
+
isScreenSharing: boolean;
|
|
71
|
+
remoteScreenStreamId?: string;
|
|
72
|
+
cameraStreamId?: string;
|
|
73
|
+
};
|
|
74
|
+
type Listener = () => void;
|
|
75
|
+
type ChatInput = {
|
|
76
|
+
message: string;
|
|
77
|
+
reply_to?: {
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
} | null;
|
|
81
|
+
target?: string | null;
|
|
82
|
+
};
|
|
83
|
+
type MeetingConfig = {
|
|
84
|
+
roomId: string;
|
|
85
|
+
name: string;
|
|
86
|
+
audioMuted?: boolean;
|
|
87
|
+
videoMuted?: boolean;
|
|
88
|
+
token?: string;
|
|
89
|
+
};
|
|
90
|
+
type PubSubTopic = "SECURE_CHAT";
|
|
91
|
+
type RecordingInfo = {
|
|
92
|
+
recording_id: string;
|
|
93
|
+
started_at?: string;
|
|
94
|
+
stopped_at?: string;
|
|
95
|
+
active?: boolean;
|
|
96
|
+
};
|
|
97
|
+
type StateScope = "participants" | "localParticipant" | "chat" | "presenter" | `participant:${string}`;
|
|
98
|
+
type SDKError = {
|
|
99
|
+
code: string;
|
|
100
|
+
message: string;
|
|
101
|
+
roomId?: string | null;
|
|
102
|
+
userId?: string;
|
|
103
|
+
raw?: any;
|
|
104
|
+
recoverable?: boolean;
|
|
105
|
+
};
|
|
106
|
+
type EntryDecision = "approved" | "rejected";
|
|
107
|
+
type EntryRequest = {
|
|
108
|
+
requestId: string;
|
|
109
|
+
userId: string;
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
112
|
+
interface TrackDescriptor {
|
|
113
|
+
id: string;
|
|
114
|
+
publisher_id: string;
|
|
115
|
+
source: "camera" | "screen" | "audio";
|
|
116
|
+
mid?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare const useLocalParticipant: () => {
|
|
120
|
+
participant: Participant | null;
|
|
121
|
+
videoRef: (video: HTMLVideoElement | null) => void;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
type LocalParticipantPatch = {
|
|
125
|
+
id?: string;
|
|
126
|
+
name?: string;
|
|
127
|
+
media?: Partial<ParticipantMedia>;
|
|
128
|
+
};
|
|
129
|
+
declare class MeetingState {
|
|
130
|
+
participants: Map<string, Participant>;
|
|
131
|
+
localParticipant: Participant | null;
|
|
132
|
+
localStream: MediaStream | null;
|
|
133
|
+
chatMessages: Map<string, ChatMessage>;
|
|
134
|
+
presenterId: string | null;
|
|
135
|
+
private listeners;
|
|
136
|
+
subscribe(scope: StateScope, fn: Listener): () => void;
|
|
137
|
+
notify(scope: StateScope): void;
|
|
138
|
+
setPresenterId(id: string | null): void;
|
|
139
|
+
addParticipant(p: Participant): boolean;
|
|
140
|
+
removeParticipant(id: string): void;
|
|
141
|
+
updateParticipantMedia(id: string, patch: Partial<NonNullable<Participant["media"]>>): void;
|
|
142
|
+
updateLocalParticipant(patch: LocalParticipantPatch): void;
|
|
143
|
+
addChatMessage(msg: ChatMessage): void;
|
|
144
|
+
getChatMessages(): ChatMessage[];
|
|
145
|
+
clearChat(): void;
|
|
146
|
+
getParticipants(): Participant[];
|
|
147
|
+
getParticipant(id: string): Participant | null;
|
|
148
|
+
resetRemoteState(): void;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare class VideoSDKCore {
|
|
152
|
+
private events;
|
|
153
|
+
private apiBase;
|
|
154
|
+
private wsBase;
|
|
155
|
+
private sfuClient;
|
|
156
|
+
private myId;
|
|
157
|
+
private room;
|
|
158
|
+
private localStream;
|
|
159
|
+
private screenStream;
|
|
160
|
+
private isScreenSharing;
|
|
161
|
+
private participantName;
|
|
162
|
+
readonly state: MeetingState;
|
|
163
|
+
private intentionalDisconnect;
|
|
164
|
+
private remoteStreams;
|
|
165
|
+
private remoteScreenStreams;
|
|
166
|
+
private emitError;
|
|
167
|
+
constructor(events?: Events, apiBase?: string, wsBase?: string);
|
|
168
|
+
initLocal(video: HTMLVideoElement, name: string): Promise<void>;
|
|
169
|
+
private updateLocalMedia;
|
|
170
|
+
createRoom(input: {
|
|
171
|
+
name: string;
|
|
172
|
+
description?: string;
|
|
173
|
+
capacity?: number;
|
|
174
|
+
is_private?: boolean;
|
|
175
|
+
}): Promise<any>;
|
|
176
|
+
getRoom(roomCode: string): Promise<any>;
|
|
177
|
+
deleteRoom(roomCode: string): Promise<any>;
|
|
178
|
+
joinMeeting(config: MeetingConfig): Promise<void>;
|
|
179
|
+
private connect;
|
|
180
|
+
private handleSFUState;
|
|
181
|
+
private handleRemoteTrack;
|
|
182
|
+
getMeeting(): {
|
|
183
|
+
id: string | null;
|
|
184
|
+
name: string | null;
|
|
185
|
+
};
|
|
186
|
+
approveJoinRequest(requestId: string): Promise<void>;
|
|
187
|
+
rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
|
|
188
|
+
toggleMic(): void;
|
|
189
|
+
toggleCam(): void;
|
|
190
|
+
startScreenShare(): Promise<MediaStream>;
|
|
191
|
+
stopScreenShare(): void;
|
|
192
|
+
startRecording(): Promise<void>;
|
|
193
|
+
stopRecording(): Promise<void>;
|
|
194
|
+
getRecordingStatus(): Promise<{
|
|
195
|
+
recording: RecordingInfo | null;
|
|
196
|
+
}>;
|
|
197
|
+
sendChatMessage(payload: ChatInput): void;
|
|
198
|
+
private cleanupRemoteParticipant;
|
|
199
|
+
disconnect(): Promise<void>;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* DefComm SFU client.
|
|
204
|
+
*
|
|
205
|
+
* Signaling is authoritative for admission/session state.
|
|
206
|
+
* WebRTC peer connections are transport state and are recreated only after a
|
|
207
|
+
* successful join/resume. A transient WebSocket close therefore does NOT
|
|
208
|
+
* destroy the local MediaStream or immediately declare the participant gone.
|
|
209
|
+
*/
|
|
210
|
+
type SFUConnectionState = "idle" | "connecting" | "joining" | "waiting_approval" | "connected" | "reconnecting" | "leaving" | "disconnected";
|
|
211
|
+
interface TrackInfo {
|
|
212
|
+
track_id: string;
|
|
213
|
+
participant_id: string;
|
|
214
|
+
kind: "audio" | "video";
|
|
215
|
+
source?: "camera" | "screen" | "audio" | string;
|
|
216
|
+
[key: string]: any;
|
|
217
|
+
}
|
|
218
|
+
interface ParticipantInfo {
|
|
219
|
+
participant_id: string;
|
|
220
|
+
user_metadata?: {
|
|
221
|
+
name?: string;
|
|
222
|
+
[key: string]: any;
|
|
223
|
+
};
|
|
224
|
+
display_name?: string;
|
|
225
|
+
[key: string]: any;
|
|
226
|
+
}
|
|
227
|
+
interface JoinPendingInfo {
|
|
228
|
+
request_id: string;
|
|
229
|
+
room_code?: string;
|
|
230
|
+
message?: string;
|
|
231
|
+
}
|
|
232
|
+
interface SFUClientOptions {
|
|
233
|
+
apiBase?: string;
|
|
234
|
+
wsBase?: string;
|
|
235
|
+
userId?: string;
|
|
236
|
+
onStateChange?: (state: SFUConnectionState) => void;
|
|
237
|
+
onParticipantJoined?: (participant: ParticipantInfo) => void;
|
|
238
|
+
onParticipantLeft?: (participant: string | ParticipantInfo) => void;
|
|
239
|
+
onParticipantPresence?: (participantId: string, presence: string) => void;
|
|
240
|
+
onTrackPublished?: (track: TrackInfo) => void;
|
|
241
|
+
onTrackUnpublished?: (track: TrackInfo) => void;
|
|
242
|
+
onRemoteTrack?: (track: MediaStreamTrack, stream: MediaStream, metadata: TrackInfo) => void;
|
|
243
|
+
onConnected?: (payload: any, resumed: boolean) => void;
|
|
244
|
+
onDisconnected?: () => void;
|
|
245
|
+
onReconnecting?: (attempt: number) => void;
|
|
246
|
+
onJoinPending?: (info: JoinPendingInfo) => void;
|
|
247
|
+
onJoinApproved?: (requestId: string) => void;
|
|
248
|
+
onJoinRejected?: (requestId: string, reason?: string) => void;
|
|
249
|
+
onJoinRequested?: (request: any) => void;
|
|
250
|
+
onScreenShareStarted?: (participantId: string, track?: TrackInfo) => void;
|
|
251
|
+
onScreenShareStopped?: (participantId: string, trackId?: string) => void;
|
|
252
|
+
onTrackStateChanged?: (track: TrackInfo) => void;
|
|
253
|
+
onRecordingStarted?: (recording: {
|
|
254
|
+
recording_id: string;
|
|
255
|
+
started_at: string;
|
|
256
|
+
}) => void;
|
|
257
|
+
onRecordingStopped?: (recording: {
|
|
258
|
+
recording_id: string;
|
|
259
|
+
stopped_at: string;
|
|
260
|
+
}) => void;
|
|
261
|
+
onError?: (error: any) => void;
|
|
262
|
+
autoSubscribe?: boolean;
|
|
263
|
+
}
|
|
264
|
+
declare class SFUClient {
|
|
265
|
+
private apiBase;
|
|
266
|
+
private wsBase;
|
|
267
|
+
private userId;
|
|
268
|
+
private ws;
|
|
269
|
+
private publisher;
|
|
270
|
+
private subscriber;
|
|
271
|
+
private localStream;
|
|
272
|
+
private screenStream;
|
|
273
|
+
private videoSender;
|
|
274
|
+
private audioSender;
|
|
275
|
+
private screenSender;
|
|
276
|
+
private iceServers;
|
|
277
|
+
private requestId;
|
|
278
|
+
private publisherRevision;
|
|
279
|
+
private currentParticipantId;
|
|
280
|
+
private token;
|
|
281
|
+
private room;
|
|
282
|
+
private resumeToken;
|
|
283
|
+
private pendingJoinRequestId;
|
|
284
|
+
private joinOptions;
|
|
285
|
+
private state;
|
|
286
|
+
private intentionalClose;
|
|
287
|
+
private leaveAcknowledged;
|
|
288
|
+
private joiningWithResume;
|
|
289
|
+
private reconnectTimer;
|
|
290
|
+
private reconnectAttempt;
|
|
291
|
+
private maxReconnectAttempts;
|
|
292
|
+
private reconnectBaseMs;
|
|
293
|
+
private joinWaiter;
|
|
294
|
+
private pendingIce;
|
|
295
|
+
private subscriberNegotiating;
|
|
296
|
+
private offerQueue;
|
|
297
|
+
private subscriptionQueue;
|
|
298
|
+
private subscriptionRunning;
|
|
299
|
+
private subscriptionWaiters;
|
|
300
|
+
private subscribedTracks;
|
|
301
|
+
private trackMetadata;
|
|
302
|
+
private participants;
|
|
303
|
+
private remoteStreams;
|
|
304
|
+
private trackToParticipant;
|
|
305
|
+
private trackToSource;
|
|
306
|
+
private localTrackIds;
|
|
307
|
+
private subscriberStatsTimer;
|
|
308
|
+
private onStateChange;
|
|
309
|
+
private onParticipantJoined;
|
|
310
|
+
private onParticipantLeft;
|
|
311
|
+
private onParticipantPresence;
|
|
312
|
+
private onTrackPublished;
|
|
313
|
+
private onTrackUnpublished;
|
|
314
|
+
private onRemoteTrack;
|
|
315
|
+
private onConnected;
|
|
316
|
+
private onDisconnected;
|
|
317
|
+
private onReconnecting;
|
|
318
|
+
private onJoinPending;
|
|
319
|
+
private onJoinApproved;
|
|
320
|
+
private onJoinRejected;
|
|
321
|
+
private onJoinRequested;
|
|
322
|
+
private onScreenShareStarted;
|
|
323
|
+
private onScreenShareStopped;
|
|
324
|
+
private onTrackStateChanged;
|
|
325
|
+
private onRecordingStarted;
|
|
326
|
+
private onRecordingStopped;
|
|
327
|
+
private onError;
|
|
328
|
+
private autoSubscribe;
|
|
329
|
+
constructor(options?: SFUClientOptions);
|
|
330
|
+
private createId;
|
|
331
|
+
private resumeStorageKey;
|
|
332
|
+
private loadResumeToken;
|
|
333
|
+
private saveResumeToken;
|
|
334
|
+
private clearResumeToken;
|
|
335
|
+
private setState;
|
|
336
|
+
getConnectionState(): SFUConnectionState;
|
|
337
|
+
getParticipantId(): string | null;
|
|
338
|
+
getResumeToken(): string | null;
|
|
339
|
+
getLocalStream(): MediaStream | null;
|
|
340
|
+
getScreenStream(): MediaStream | null;
|
|
341
|
+
setLocalStream(stream: MediaStream | null): void;
|
|
342
|
+
private nextRequestId;
|
|
343
|
+
private request;
|
|
344
|
+
createRoom(input: {
|
|
345
|
+
name: string;
|
|
346
|
+
description?: string;
|
|
347
|
+
capacity?: number;
|
|
348
|
+
is_private?: boolean;
|
|
349
|
+
}): Promise<any>;
|
|
350
|
+
getRoom(roomCode: string): Promise<any>;
|
|
351
|
+
deleteRoom(roomCode: string): Promise<any>;
|
|
352
|
+
getToken(roomCode: string, options?: {
|
|
353
|
+
displayName?: string;
|
|
354
|
+
avatarUrl?: string;
|
|
355
|
+
userId?: string;
|
|
356
|
+
}): Promise<void>;
|
|
357
|
+
private refreshAccessToken;
|
|
358
|
+
private connect;
|
|
359
|
+
private openWebSocket;
|
|
360
|
+
private scheduleReconnect;
|
|
361
|
+
private failJoin;
|
|
362
|
+
private resolveJoin;
|
|
363
|
+
private handleServerMessage;
|
|
364
|
+
private rememberTrack;
|
|
365
|
+
private handleJoined;
|
|
366
|
+
private initializePeerConnections;
|
|
367
|
+
private handleRemoteTrack;
|
|
368
|
+
private normalizeRemoteTrackId;
|
|
369
|
+
private resolveRemoteTrackMetadata;
|
|
370
|
+
private sendCandidate;
|
|
371
|
+
private handleIce;
|
|
372
|
+
private flushPendingIce;
|
|
373
|
+
private processOfferQueue;
|
|
374
|
+
private subscribe;
|
|
375
|
+
private subscribeMultiple;
|
|
376
|
+
private processSubscriptionQueue;
|
|
377
|
+
publish({ audio, video }?: {
|
|
378
|
+
audio?: boolean | undefined;
|
|
379
|
+
video?: boolean | undefined;
|
|
380
|
+
}): Promise<MediaStream>;
|
|
381
|
+
private publishExistingTracks;
|
|
382
|
+
shareScreen(): Promise<MediaStream>;
|
|
383
|
+
stopScreenShare(): Promise<void>;
|
|
384
|
+
muteAudio(muted: boolean): void;
|
|
385
|
+
muteVideo(muted: boolean): void;
|
|
386
|
+
startRecording(): Promise<void>;
|
|
387
|
+
stopRecording(): Promise<void>;
|
|
388
|
+
getRecordingStatus(): Promise<any>;
|
|
389
|
+
approveJoinRequest(requestId: string): Promise<void>;
|
|
390
|
+
rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
|
|
391
|
+
private isSocketOpen;
|
|
392
|
+
private send;
|
|
393
|
+
private removeRemoteParticipant;
|
|
394
|
+
leave(): Promise<void>;
|
|
395
|
+
private closePeerConnectionsOnly;
|
|
396
|
+
private cleanupAll;
|
|
397
|
+
private logSubscriberVideoStats;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
type PubSubHandle = {
|
|
401
|
+
messages: ChatMessage[];
|
|
402
|
+
publish: (input: ChatInput) => void;
|
|
403
|
+
};
|
|
404
|
+
type MeetingContextValue = {
|
|
405
|
+
sdk: VideoSDKCore;
|
|
406
|
+
join: (config?: MeetingConfig) => Promise<void>;
|
|
407
|
+
leave: () => void;
|
|
408
|
+
createRoom: (input: {
|
|
409
|
+
name: string;
|
|
410
|
+
description?: string;
|
|
411
|
+
capacity?: number;
|
|
412
|
+
is_private?: boolean;
|
|
413
|
+
}) => Promise<any>;
|
|
414
|
+
getRoom: (roomCode: string) => Promise<any>;
|
|
415
|
+
deleteRoom: (roomCode: string) => Promise<any>;
|
|
416
|
+
toggleMic: () => void;
|
|
417
|
+
toggleCam: () => void;
|
|
418
|
+
startScreenShare: () => Promise<MediaStream>;
|
|
419
|
+
stopScreenShare: () => void;
|
|
420
|
+
sendMessage: (input: ChatInput) => void;
|
|
421
|
+
room: {
|
|
422
|
+
id: string | null;
|
|
423
|
+
name: string | null;
|
|
424
|
+
};
|
|
425
|
+
localParticipant: Participant | null;
|
|
426
|
+
participants: Map<string, Participant>;
|
|
427
|
+
messages: ChatMessage[];
|
|
428
|
+
presenterId: string | null;
|
|
429
|
+
usePubSub: (topic: PubSubTopic) => PubSubHandle;
|
|
430
|
+
approveJoinRequest: (requestId: string) => void;
|
|
431
|
+
rejectJoinRequest: (requestId: string) => void;
|
|
432
|
+
startRecording: () => Promise<void>;
|
|
433
|
+
stopRecording: () => Promise<void>;
|
|
434
|
+
getRecordingStatus: () => Promise<any>;
|
|
435
|
+
onError: (cb: (err: any) => void) => () => void;
|
|
436
|
+
onEntryRequested: (cb: (req: any) => void) => () => void;
|
|
437
|
+
onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
|
|
438
|
+
onMeetingLeft: (cb: () => void) => () => void;
|
|
439
|
+
onTrackStateChanged: (cb: (track: any) => void) => () => void;
|
|
440
|
+
onRecordingStarted: (cb: (recording: any) => void) => () => void;
|
|
441
|
+
onRecordingStopped: (cb: (recording: any) => void) => () => void;
|
|
442
|
+
};
|
|
443
|
+
declare const MeetingProvider: ({ config, children, }: {
|
|
444
|
+
config: MeetingConfig;
|
|
445
|
+
children: react__default.ReactNode;
|
|
446
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
447
|
+
declare const useMeetingContext: () => MeetingContextValue;
|
|
448
|
+
|
|
449
|
+
declare const useMeeting: (handlers?: {
|
|
450
|
+
onError?: (err: any) => void;
|
|
451
|
+
onEntryRequested?: (req: any) => void;
|
|
452
|
+
onEntryResponded?: (payload: any, decision?: any) => void;
|
|
453
|
+
onMeetingLeft?: () => void;
|
|
454
|
+
onTrackStateChanged?: (track: any) => void;
|
|
455
|
+
onRecordingStarted?: (recording: any) => void;
|
|
456
|
+
onRecordingStopped?: (recording: any) => void;
|
|
457
|
+
}) => {
|
|
458
|
+
join: (config?: MeetingConfig) => Promise<void>;
|
|
459
|
+
leave: () => void;
|
|
460
|
+
createRoom: (input: {
|
|
461
|
+
name: string;
|
|
462
|
+
description?: string;
|
|
463
|
+
capacity?: number;
|
|
464
|
+
is_private?: boolean;
|
|
465
|
+
}) => Promise<any>;
|
|
466
|
+
getRoom: (roomCode: string) => Promise<any>;
|
|
467
|
+
deleteRoom: (roomCode: string) => Promise<any>;
|
|
468
|
+
toggleMic: () => void;
|
|
469
|
+
toggleCam: () => void;
|
|
470
|
+
startScreenShare: () => Promise<MediaStream>;
|
|
471
|
+
stopScreenShare: () => void;
|
|
472
|
+
sendMessage: (input: ChatInput) => void;
|
|
473
|
+
room: {
|
|
474
|
+
id: string | null;
|
|
475
|
+
name: string | null;
|
|
476
|
+
};
|
|
477
|
+
localParticipant: Participant | null;
|
|
478
|
+
participants: Map<string, Participant>;
|
|
479
|
+
messages: ChatMessage[];
|
|
480
|
+
presenterId: string | null;
|
|
481
|
+
usePubSub: (topic: PubSubTopic) => {
|
|
482
|
+
messages: ChatMessage[];
|
|
483
|
+
publish: (input: ChatInput) => void;
|
|
484
|
+
};
|
|
485
|
+
approveJoinRequest: (requestId: string) => void;
|
|
486
|
+
rejectJoinRequest: (requestId: string) => void;
|
|
487
|
+
startRecording: () => Promise<void>;
|
|
488
|
+
stopRecording: () => Promise<void>;
|
|
489
|
+
getRecordingStatus: () => Promise<any>;
|
|
490
|
+
onError: (cb: (err: any) => void) => () => void;
|
|
491
|
+
onEntryRequested: (cb: (req: any) => void) => () => void;
|
|
492
|
+
onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
|
|
493
|
+
onMeetingLeft: (cb: () => void) => () => void;
|
|
494
|
+
onTrackStateChanged: (cb: (track: any) => void) => () => void;
|
|
495
|
+
onRecordingStarted: (cb: (recording: any) => void) => () => void;
|
|
496
|
+
onRecordingStopped: (cb: (recording: any) => void) => () => void;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
declare const useParticipants: () => Participant[];
|
|
500
|
+
|
|
501
|
+
declare const useRemoteMedia: (participantId: string) => {
|
|
502
|
+
videoRef: react.RefObject<HTMLVideoElement | null>;
|
|
503
|
+
audioRef: react.RefObject<HTMLAudioElement | null>;
|
|
504
|
+
isCamActive: boolean;
|
|
505
|
+
isMicEnabled: boolean;
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
type LiveRoomState = {
|
|
509
|
+
active: boolean;
|
|
510
|
+
count: number;
|
|
511
|
+
canJoin: boolean;
|
|
512
|
+
approved: boolean;
|
|
513
|
+
isHost: boolean;
|
|
514
|
+
hasMoreParticipants: boolean;
|
|
515
|
+
participants: {
|
|
516
|
+
id: string;
|
|
517
|
+
name: string;
|
|
518
|
+
isHost: boolean;
|
|
519
|
+
isPresenter: boolean;
|
|
520
|
+
micEnabled: boolean;
|
|
521
|
+
camEnabled: boolean;
|
|
522
|
+
}[];
|
|
523
|
+
room?: {
|
|
524
|
+
id: string;
|
|
525
|
+
name: string;
|
|
526
|
+
room_code: string;
|
|
527
|
+
capacity: number;
|
|
528
|
+
is_private: boolean;
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* Current SFU does not expose the old `/watch/:room` mesh presence socket.
|
|
533
|
+
* Preview therefore uses the authoritative REST room endpoint and polls it.
|
|
534
|
+
* Live participant/media state begins after JOIN over the SFU WebSocket.
|
|
535
|
+
*/
|
|
536
|
+
declare function useMeetingPreview(roomId: string, userId: string): {
|
|
537
|
+
room: LiveRoomState | null;
|
|
538
|
+
isConnected: boolean;
|
|
539
|
+
isLoading: boolean;
|
|
540
|
+
error: string | null;
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
export { type ChatInput, type MeetingConfig, MeetingProvider, MeetingState, type Participant, type ParticipantInfo, type RecordingInfo, SFUClient, type SFUConnectionState, type TrackInfo, VideoSDKCore, useLocalParticipant, useMeeting, useMeetingContext, useMeetingPreview, useParticipants, useRemoteMedia };
|