@defcomm/meetingsdk 0.4.9 → 0.5.1
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/index.d.mts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +189 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -17,6 +17,9 @@ type Events = {
|
|
|
17
17
|
onActiveSpeakersChanged?: (participantIds: string[]) => void;
|
|
18
18
|
onJoinApproved?: (requestId: string) => void;
|
|
19
19
|
onJoinRejected?: (requestId: string) => void;
|
|
20
|
+
onJoinRequestCanceled?: (requestId: string) => void;
|
|
21
|
+
onParticipantRemoved?: (participantId: string, removedBy: string) => void;
|
|
22
|
+
onParticipantPermissionsChanged?: (participantId: string, permissions: any) => void;
|
|
20
23
|
onConnectionStateChanged?: (state: string) => void;
|
|
21
24
|
onRoomUpdate?: (data: any) => void;
|
|
22
25
|
onUserLeft?: (id: string) => void;
|
|
@@ -91,6 +94,8 @@ type Participant = {
|
|
|
91
94
|
id: string;
|
|
92
95
|
name?: string;
|
|
93
96
|
isHost?: boolean;
|
|
97
|
+
isModerator?: boolean;
|
|
98
|
+
permissions?: any;
|
|
94
99
|
isLocal?: boolean;
|
|
95
100
|
media?: ParticipantMedia;
|
|
96
101
|
isPresenter?: boolean;
|
|
@@ -189,6 +194,9 @@ declare const useLocalParticipant: () => {
|
|
|
189
194
|
type LocalParticipantPatch = {
|
|
190
195
|
id?: string;
|
|
191
196
|
name?: string;
|
|
197
|
+
isHost?: boolean;
|
|
198
|
+
isModerator?: boolean;
|
|
199
|
+
permissions?: any;
|
|
192
200
|
media?: Partial<ParticipantMedia>;
|
|
193
201
|
};
|
|
194
202
|
declare class MeetingState {
|
|
@@ -260,6 +268,13 @@ declare class VideoSDKCore {
|
|
|
260
268
|
};
|
|
261
269
|
approveJoinRequest(requestId: string): Promise<void>;
|
|
262
270
|
rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
|
|
271
|
+
cancelJoinRequest(requestId?: string): Promise<void | undefined>;
|
|
272
|
+
muteAllAudio(): Promise<void>;
|
|
273
|
+
unmuteAllAudio(): Promise<void>;
|
|
274
|
+
removeParticipant(participantId: string): Promise<void>;
|
|
275
|
+
getModerators(roomCode: string): Promise<any>;
|
|
276
|
+
addModerator(roomCode: string, userId: string): Promise<any>;
|
|
277
|
+
removeModerator(roomCode: string, userId: string): Promise<any>;
|
|
263
278
|
toggleMic(): void;
|
|
264
279
|
toggleCam(): void;
|
|
265
280
|
startScreenShare(): Promise<MediaStream | null>;
|
|
@@ -335,12 +350,22 @@ type MeetingContextValue = {
|
|
|
335
350
|
onPubSubMessage: <T extends PubSubTopic>(topic: T, cb: (message: PubSubMessage<PubSubTopicConfig[T]["message"]>) => void) => () => void;
|
|
336
351
|
approveJoinRequest: (requestId: string) => void;
|
|
337
352
|
rejectJoinRequest: (requestId: string) => void;
|
|
353
|
+
cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
|
|
354
|
+
muteAllAudio: () => Promise<void>;
|
|
355
|
+
unmuteAllAudio: () => Promise<void>;
|
|
356
|
+
removeParticipant: (participantId: string) => Promise<void>;
|
|
357
|
+
getModerators: (roomCode: string) => Promise<any> | undefined;
|
|
358
|
+
addModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
359
|
+
removeModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
338
360
|
startRecording: () => Promise<void>;
|
|
339
361
|
stopRecording: () => Promise<void>;
|
|
340
362
|
getRecordingStatus: () => Promise<any>;
|
|
341
363
|
onError: (cb: (err: any) => void) => () => void;
|
|
342
364
|
onEntryRequested: (cb: (req: any) => void) => () => void;
|
|
343
365
|
onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
|
|
366
|
+
onJoinRequestCanceled: (cb: (requestId: string) => void) => () => void;
|
|
367
|
+
onParticipantRemoved: (cb: (participantId: string, removedBy: string) => void) => () => void;
|
|
368
|
+
onParticipantPermissionsChanged: (cb: (participantId: string, permissions: any) => void) => () => void;
|
|
344
369
|
onMeetingLeft: (cb: () => void) => () => void;
|
|
345
370
|
onTrackStateChanged: (cb: (track: any) => void) => () => void;
|
|
346
371
|
onRecordingStarted: (cb: (recording: Recording) => void) => () => void;
|
|
@@ -359,6 +384,9 @@ declare const useMeeting: (handlers?: {
|
|
|
359
384
|
onError?: (err: any) => void;
|
|
360
385
|
onEntryRequested?: (req: any) => void;
|
|
361
386
|
onEntryResponded?: (payload: any, decision?: any) => void;
|
|
387
|
+
onJoinRequestCanceled?: (requestId: string) => void;
|
|
388
|
+
onParticipantRemoved?: (participantId: string, removedBy: string) => void;
|
|
389
|
+
onParticipantPermissionsChanged?: (participantId: string, permissions: any) => void;
|
|
362
390
|
onMeetingLeft?: () => void;
|
|
363
391
|
onTrackStateChanged?: (track: any) => void;
|
|
364
392
|
onRecordingStarted?: (recording: any) => void;
|
|
@@ -398,12 +426,22 @@ declare const useMeeting: (handlers?: {
|
|
|
398
426
|
onPubSubMessage: <T extends PubSubTopic>(topic: T, cb: (message: PubSubMessage<PubSubTopicConfig[T]["message"]>) => void) => () => void;
|
|
399
427
|
approveJoinRequest: (requestId: string) => void;
|
|
400
428
|
rejectJoinRequest: (requestId: string) => void;
|
|
429
|
+
cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
|
|
430
|
+
muteAllAudio: () => Promise<void>;
|
|
431
|
+
unmuteAllAudio: () => Promise<void>;
|
|
432
|
+
removeParticipant: (participantId: string) => Promise<void>;
|
|
433
|
+
getModerators: (roomCode: string) => Promise<any> | undefined;
|
|
434
|
+
addModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
435
|
+
removeModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
401
436
|
startRecording: () => Promise<void>;
|
|
402
437
|
stopRecording: () => Promise<void>;
|
|
403
438
|
getRecordingStatus: () => Promise<any>;
|
|
404
439
|
onError: (cb: (err: any) => void) => () => void;
|
|
405
440
|
onEntryRequested: (cb: (req: any) => void) => () => void;
|
|
406
441
|
onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
|
|
442
|
+
onJoinRequestCanceled: (cb: (requestId: string) => void) => () => void;
|
|
443
|
+
onParticipantRemoved: (cb: (participantId: string, removedBy: string) => void) => () => void;
|
|
444
|
+
onParticipantPermissionsChanged: (cb: (participantId: string, permissions: any) => void) => () => void;
|
|
407
445
|
onMeetingLeft: (cb: () => void) => () => void;
|
|
408
446
|
onTrackStateChanged: (cb: (track: any) => void) => () => void;
|
|
409
447
|
onRecordingStarted: (cb: (recording: Recording) => void) => () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ type Events = {
|
|
|
17
17
|
onActiveSpeakersChanged?: (participantIds: string[]) => void;
|
|
18
18
|
onJoinApproved?: (requestId: string) => void;
|
|
19
19
|
onJoinRejected?: (requestId: string) => void;
|
|
20
|
+
onJoinRequestCanceled?: (requestId: string) => void;
|
|
21
|
+
onParticipantRemoved?: (participantId: string, removedBy: string) => void;
|
|
22
|
+
onParticipantPermissionsChanged?: (participantId: string, permissions: any) => void;
|
|
20
23
|
onConnectionStateChanged?: (state: string) => void;
|
|
21
24
|
onRoomUpdate?: (data: any) => void;
|
|
22
25
|
onUserLeft?: (id: string) => void;
|
|
@@ -91,6 +94,8 @@ type Participant = {
|
|
|
91
94
|
id: string;
|
|
92
95
|
name?: string;
|
|
93
96
|
isHost?: boolean;
|
|
97
|
+
isModerator?: boolean;
|
|
98
|
+
permissions?: any;
|
|
94
99
|
isLocal?: boolean;
|
|
95
100
|
media?: ParticipantMedia;
|
|
96
101
|
isPresenter?: boolean;
|
|
@@ -189,6 +194,9 @@ declare const useLocalParticipant: () => {
|
|
|
189
194
|
type LocalParticipantPatch = {
|
|
190
195
|
id?: string;
|
|
191
196
|
name?: string;
|
|
197
|
+
isHost?: boolean;
|
|
198
|
+
isModerator?: boolean;
|
|
199
|
+
permissions?: any;
|
|
192
200
|
media?: Partial<ParticipantMedia>;
|
|
193
201
|
};
|
|
194
202
|
declare class MeetingState {
|
|
@@ -260,6 +268,13 @@ declare class VideoSDKCore {
|
|
|
260
268
|
};
|
|
261
269
|
approveJoinRequest(requestId: string): Promise<void>;
|
|
262
270
|
rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
|
|
271
|
+
cancelJoinRequest(requestId?: string): Promise<void | undefined>;
|
|
272
|
+
muteAllAudio(): Promise<void>;
|
|
273
|
+
unmuteAllAudio(): Promise<void>;
|
|
274
|
+
removeParticipant(participantId: string): Promise<void>;
|
|
275
|
+
getModerators(roomCode: string): Promise<any>;
|
|
276
|
+
addModerator(roomCode: string, userId: string): Promise<any>;
|
|
277
|
+
removeModerator(roomCode: string, userId: string): Promise<any>;
|
|
263
278
|
toggleMic(): void;
|
|
264
279
|
toggleCam(): void;
|
|
265
280
|
startScreenShare(): Promise<MediaStream | null>;
|
|
@@ -335,12 +350,22 @@ type MeetingContextValue = {
|
|
|
335
350
|
onPubSubMessage: <T extends PubSubTopic>(topic: T, cb: (message: PubSubMessage<PubSubTopicConfig[T]["message"]>) => void) => () => void;
|
|
336
351
|
approveJoinRequest: (requestId: string) => void;
|
|
337
352
|
rejectJoinRequest: (requestId: string) => void;
|
|
353
|
+
cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
|
|
354
|
+
muteAllAudio: () => Promise<void>;
|
|
355
|
+
unmuteAllAudio: () => Promise<void>;
|
|
356
|
+
removeParticipant: (participantId: string) => Promise<void>;
|
|
357
|
+
getModerators: (roomCode: string) => Promise<any> | undefined;
|
|
358
|
+
addModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
359
|
+
removeModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
338
360
|
startRecording: () => Promise<void>;
|
|
339
361
|
stopRecording: () => Promise<void>;
|
|
340
362
|
getRecordingStatus: () => Promise<any>;
|
|
341
363
|
onError: (cb: (err: any) => void) => () => void;
|
|
342
364
|
onEntryRequested: (cb: (req: any) => void) => () => void;
|
|
343
365
|
onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
|
|
366
|
+
onJoinRequestCanceled: (cb: (requestId: string) => void) => () => void;
|
|
367
|
+
onParticipantRemoved: (cb: (participantId: string, removedBy: string) => void) => () => void;
|
|
368
|
+
onParticipantPermissionsChanged: (cb: (participantId: string, permissions: any) => void) => () => void;
|
|
344
369
|
onMeetingLeft: (cb: () => void) => () => void;
|
|
345
370
|
onTrackStateChanged: (cb: (track: any) => void) => () => void;
|
|
346
371
|
onRecordingStarted: (cb: (recording: Recording) => void) => () => void;
|
|
@@ -359,6 +384,9 @@ declare const useMeeting: (handlers?: {
|
|
|
359
384
|
onError?: (err: any) => void;
|
|
360
385
|
onEntryRequested?: (req: any) => void;
|
|
361
386
|
onEntryResponded?: (payload: any, decision?: any) => void;
|
|
387
|
+
onJoinRequestCanceled?: (requestId: string) => void;
|
|
388
|
+
onParticipantRemoved?: (participantId: string, removedBy: string) => void;
|
|
389
|
+
onParticipantPermissionsChanged?: (participantId: string, permissions: any) => void;
|
|
362
390
|
onMeetingLeft?: () => void;
|
|
363
391
|
onTrackStateChanged?: (track: any) => void;
|
|
364
392
|
onRecordingStarted?: (recording: any) => void;
|
|
@@ -398,12 +426,22 @@ declare const useMeeting: (handlers?: {
|
|
|
398
426
|
onPubSubMessage: <T extends PubSubTopic>(topic: T, cb: (message: PubSubMessage<PubSubTopicConfig[T]["message"]>) => void) => () => void;
|
|
399
427
|
approveJoinRequest: (requestId: string) => void;
|
|
400
428
|
rejectJoinRequest: (requestId: string) => void;
|
|
429
|
+
cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
|
|
430
|
+
muteAllAudio: () => Promise<void>;
|
|
431
|
+
unmuteAllAudio: () => Promise<void>;
|
|
432
|
+
removeParticipant: (participantId: string) => Promise<void>;
|
|
433
|
+
getModerators: (roomCode: string) => Promise<any> | undefined;
|
|
434
|
+
addModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
435
|
+
removeModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
401
436
|
startRecording: () => Promise<void>;
|
|
402
437
|
stopRecording: () => Promise<void>;
|
|
403
438
|
getRecordingStatus: () => Promise<any>;
|
|
404
439
|
onError: (cb: (err: any) => void) => () => void;
|
|
405
440
|
onEntryRequested: (cb: (req: any) => void) => () => void;
|
|
406
441
|
onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
|
|
442
|
+
onJoinRequestCanceled: (cb: (requestId: string) => void) => () => void;
|
|
443
|
+
onParticipantRemoved: (cb: (participantId: string, removedBy: string) => void) => () => void;
|
|
444
|
+
onParticipantPermissionsChanged: (cb: (participantId: string, permissions: any) => void) => () => void;
|
|
407
445
|
onMeetingLeft: (cb: () => void) => () => void;
|
|
408
446
|
onTrackStateChanged: (cb: (track: any) => void) => () => void;
|
|
409
447
|
onRecordingStarted: (cb: (recording: Recording) => void) => () => void;
|
package/dist/index.js
CHANGED
|
@@ -309,6 +309,9 @@ var MeetingState = class {
|
|
|
309
309
|
this.localParticipant = {
|
|
310
310
|
id: patch.id ?? "",
|
|
311
311
|
name: patch.name ?? "",
|
|
312
|
+
isHost: patch.isHost ?? false,
|
|
313
|
+
isModerator: patch.isModerator ?? false,
|
|
314
|
+
permissions: patch.permissions,
|
|
312
315
|
media: {
|
|
313
316
|
stream: patch.media?.stream ?? null,
|
|
314
317
|
// ◄ FIX: Capture the stream from the patch here
|
|
@@ -348,6 +351,9 @@ var MeetingState = class {
|
|
|
348
351
|
...prev,
|
|
349
352
|
id: patch.id ?? prev.id,
|
|
350
353
|
name: patch.name ?? prev.name,
|
|
354
|
+
isHost: patch.isHost ?? prev.isHost,
|
|
355
|
+
isModerator: patch.isModerator ?? prev.isModerator,
|
|
356
|
+
permissions: patch.permissions ?? prev.permissions,
|
|
351
357
|
media: nextMedia
|
|
352
358
|
};
|
|
353
359
|
this.notify("localParticipant");
|
|
@@ -476,6 +482,12 @@ var SFUClient = class {
|
|
|
476
482
|
});
|
|
477
483
|
this.onJoinRequested = options.onJoinRequested || (() => {
|
|
478
484
|
});
|
|
485
|
+
this.onJoinRequestCanceled = options.onJoinRequestCanceled || (() => {
|
|
486
|
+
});
|
|
487
|
+
this.onParticipantRemoved = options.onParticipantRemoved || (() => {
|
|
488
|
+
});
|
|
489
|
+
this.onParticipantPermissionsChanged = options.onParticipantPermissionsChanged || (() => {
|
|
490
|
+
});
|
|
479
491
|
this.onScreenShareStarted = options.onScreenShareStarted || (() => {
|
|
480
492
|
});
|
|
481
493
|
this.onScreenShareStopped = options.onScreenShareStopped || (() => {
|
|
@@ -843,6 +855,38 @@ var SFUClient = class {
|
|
|
843
855
|
this.onJoinRequested(payload.request || payload);
|
|
844
856
|
break;
|
|
845
857
|
}
|
|
858
|
+
case "join_request_canceled": {
|
|
859
|
+
this.onJoinRequestCanceled(payload.request_id || message.request_id);
|
|
860
|
+
break;
|
|
861
|
+
}
|
|
862
|
+
case "participant_removed": {
|
|
863
|
+
const participantId = payload.participant_id;
|
|
864
|
+
if (!participantId) break;
|
|
865
|
+
const removedBy = payload.removed_by || "";
|
|
866
|
+
this.participants.delete(participantId);
|
|
867
|
+
this.removeRemoteParticipant(participantId);
|
|
868
|
+
if (participantId === this.currentParticipantId) {
|
|
869
|
+
this.intentionalClose = true;
|
|
870
|
+
this.pendingJoinRequestId = null;
|
|
871
|
+
this.setState("disconnected");
|
|
872
|
+
try {
|
|
873
|
+
this.ws?.close();
|
|
874
|
+
} catch {
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
this.onParticipantRemoved(participantId, removedBy);
|
|
878
|
+
break;
|
|
879
|
+
}
|
|
880
|
+
case "participant_permissions_changed": {
|
|
881
|
+
const participantId = payload.participant_id;
|
|
882
|
+
if (!participantId) break;
|
|
883
|
+
const participant = this.participants.get(participantId);
|
|
884
|
+
if (participant) {
|
|
885
|
+
this.participants.set(participantId, { ...participant, permissions: payload.permissions });
|
|
886
|
+
}
|
|
887
|
+
this.onParticipantPermissionsChanged(participantId, payload.permissions);
|
|
888
|
+
break;
|
|
889
|
+
}
|
|
846
890
|
case "publish_answer": {
|
|
847
891
|
if (!this.publisher) break;
|
|
848
892
|
await this.publisher.setRemoteDescription({
|
|
@@ -1746,6 +1790,40 @@ var SFUClient = class {
|
|
|
1746
1790
|
throw new Error("SFU signaling is not connected");
|
|
1747
1791
|
}
|
|
1748
1792
|
}
|
|
1793
|
+
async cancelJoinRequest(requestId) {
|
|
1794
|
+
const id = requestId || this.pendingJoinRequestId;
|
|
1795
|
+
if (!id) return;
|
|
1796
|
+
if (!this.send({ type: "cancel_join_request", payload: { request_id: id } })) {
|
|
1797
|
+
throw new Error("SFU signaling is not connected");
|
|
1798
|
+
}
|
|
1799
|
+
this.pendingJoinRequestId = null;
|
|
1800
|
+
}
|
|
1801
|
+
async muteAllAudio() {
|
|
1802
|
+
if (!this.send({ type: "mute_all_audio" })) throw new Error("SFU signaling is not connected");
|
|
1803
|
+
}
|
|
1804
|
+
async unmuteAllAudio() {
|
|
1805
|
+
if (!this.send({ type: "unmute_all_audio" })) throw new Error("SFU signaling is not connected");
|
|
1806
|
+
}
|
|
1807
|
+
async removeParticipant(participantId) {
|
|
1808
|
+
if (!participantId) throw new Error("participantId is required");
|
|
1809
|
+
if (!this.send({ type: "remove_participant", payload: { participant_id: participantId } })) {
|
|
1810
|
+
throw new Error("SFU signaling is not connected");
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
async getModerators(roomCode) {
|
|
1814
|
+
return this.request(`${this.apiBase}/rooms/${encodeURIComponent(roomCode)}/moderators`);
|
|
1815
|
+
}
|
|
1816
|
+
async addModerator(roomCode, userId) {
|
|
1817
|
+
return this.request(`${this.apiBase}/rooms/${encodeURIComponent(roomCode)}/moderators`, {
|
|
1818
|
+
method: "POST",
|
|
1819
|
+
body: JSON.stringify({ user_id: userId })
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
async removeModerator(roomCode, userId) {
|
|
1823
|
+
return this.request(`${this.apiBase}/rooms/${encodeURIComponent(roomCode)}/moderators/${encodeURIComponent(userId)}`, {
|
|
1824
|
+
method: "DELETE"
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1749
1827
|
isSocketOpen() {
|
|
1750
1828
|
return this.ws?.readyState === WebSocket.OPEN;
|
|
1751
1829
|
}
|
|
@@ -2270,6 +2348,30 @@ var VideoSDKCore = class {
|
|
|
2270
2348
|
onReaction: (reaction) => {
|
|
2271
2349
|
this.events.onReaction?.(reaction);
|
|
2272
2350
|
},
|
|
2351
|
+
onJoinRequestCanceled: (requestId) => {
|
|
2352
|
+
this.events.onJoinRequestCanceled?.(requestId);
|
|
2353
|
+
},
|
|
2354
|
+
onParticipantRemoved: (participantId, removedBy) => {
|
|
2355
|
+
if (participantId === this.myId) {
|
|
2356
|
+
this.intentionalDisconnect = true;
|
|
2357
|
+
this.events.onUserLeft?.(participantId);
|
|
2358
|
+
try {
|
|
2359
|
+
this.localStream?.getTracks().forEach((track) => track.enabled = false);
|
|
2360
|
+
} catch {
|
|
2361
|
+
}
|
|
2362
|
+
} else {
|
|
2363
|
+
this.cleanupRemoteParticipant(participantId);
|
|
2364
|
+
this.state.removeParticipant(participantId);
|
|
2365
|
+
this.events.onUserLeft?.(participantId);
|
|
2366
|
+
}
|
|
2367
|
+
this.events.onParticipantRemoved?.(participantId, removedBy);
|
|
2368
|
+
},
|
|
2369
|
+
onParticipantPermissionsChanged: (participantId, permissions) => {
|
|
2370
|
+
if (participantId === this.myId) {
|
|
2371
|
+
const current = this.state.localParticipant;
|
|
2372
|
+
this.state.updateLocalParticipant({ id: this.myId, name: this.participantName, isHost: current?.isHost, isModerator: Boolean(permissions?.moderate), permissions });
|
|
2373
|
+
}
|
|
2374
|
+
},
|
|
2273
2375
|
onJoinRequested: (request) => {
|
|
2274
2376
|
const requestId = request?.request_id || request?.requestId;
|
|
2275
2377
|
const participantId = request?.user_id || request?.participantId;
|
|
@@ -2293,6 +2395,8 @@ var VideoSDKCore = class {
|
|
|
2293
2395
|
this.state.addParticipant({
|
|
2294
2396
|
id: pid,
|
|
2295
2397
|
name: pname,
|
|
2398
|
+
isModerator: Boolean(participant?.permissions?.moderate),
|
|
2399
|
+
permissions: participant?.permissions,
|
|
2296
2400
|
connectionState: "connected",
|
|
2297
2401
|
media: {
|
|
2298
2402
|
micEnabled: true,
|
|
@@ -2339,7 +2443,18 @@ var VideoSDKCore = class {
|
|
|
2339
2443
|
},
|
|
2340
2444
|
// TRACKS
|
|
2341
2445
|
onParticipantMediaState: (participantId, audioMuted, videoMuted) => {
|
|
2342
|
-
if (participantId === this.myId)
|
|
2446
|
+
if (participantId === this.myId) {
|
|
2447
|
+
this.localStream?.getAudioTracks().forEach((track) => track.enabled = !audioMuted);
|
|
2448
|
+
this.localStream?.getVideoTracks().forEach((track) => track.enabled = !videoMuted);
|
|
2449
|
+
this.state.updateLocalParticipant({
|
|
2450
|
+
id: this.myId,
|
|
2451
|
+
name: this.participantName,
|
|
2452
|
+
media: { micEnabled: !audioMuted, camEnabled: !videoMuted }
|
|
2453
|
+
});
|
|
2454
|
+
this.events.onMuteStateChanged?.(participantId, "audio", audioMuted);
|
|
2455
|
+
this.events.onMuteStateChanged?.(participantId, "video", videoMuted);
|
|
2456
|
+
return;
|
|
2457
|
+
}
|
|
2343
2458
|
const participant = this.state.getParticipant(participantId);
|
|
2344
2459
|
if (!participant) return;
|
|
2345
2460
|
this.state.updateParticipantMedia(participantId, {
|
|
@@ -2609,6 +2724,30 @@ var VideoSDKCore = class {
|
|
|
2609
2724
|
}
|
|
2610
2725
|
return this.sfuClient.rejectJoinRequest(requestId, reason);
|
|
2611
2726
|
}
|
|
2727
|
+
async cancelJoinRequest(requestId) {
|
|
2728
|
+
return this.sfuClient?.cancelJoinRequest(requestId);
|
|
2729
|
+
}
|
|
2730
|
+
async muteAllAudio() {
|
|
2731
|
+
if (!this.sfuClient) throw new Error("SFU client is not connected");
|
|
2732
|
+
return this.sfuClient.muteAllAudio();
|
|
2733
|
+
}
|
|
2734
|
+
async unmuteAllAudio() {
|
|
2735
|
+
if (!this.sfuClient) throw new Error("SFU client is not connected");
|
|
2736
|
+
return this.sfuClient.unmuteAllAudio();
|
|
2737
|
+
}
|
|
2738
|
+
async removeParticipant(participantId) {
|
|
2739
|
+
if (!this.sfuClient) throw new Error("SFU client is not connected");
|
|
2740
|
+
return this.sfuClient.removeParticipant(participantId);
|
|
2741
|
+
}
|
|
2742
|
+
async getModerators(roomCode) {
|
|
2743
|
+
return this.sfuClient?.getModerators(roomCode);
|
|
2744
|
+
}
|
|
2745
|
+
async addModerator(roomCode, userId) {
|
|
2746
|
+
return this.sfuClient?.addModerator(roomCode, userId);
|
|
2747
|
+
}
|
|
2748
|
+
async removeModerator(roomCode, userId) {
|
|
2749
|
+
return this.sfuClient?.removeModerator(roomCode, userId);
|
|
2750
|
+
}
|
|
2612
2751
|
// MEDIA CONTROL
|
|
2613
2752
|
toggleMic() {
|
|
2614
2753
|
const mediaState = this.state.localParticipant?.media;
|
|
@@ -2839,6 +2978,9 @@ var MeetingProvider = ({
|
|
|
2839
2978
|
const entryResponseListeners = (0, import_react2.useRef)(
|
|
2840
2979
|
/* @__PURE__ */ new Set()
|
|
2841
2980
|
);
|
|
2981
|
+
const joinRequestCanceledListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
|
|
2982
|
+
const participantRemovedListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
|
|
2983
|
+
const participantPermissionsChangedListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
|
|
2842
2984
|
const meetingLeftListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
|
|
2843
2985
|
const trackStateListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
|
|
2844
2986
|
const recordingStartedListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
|
|
@@ -2870,6 +3012,15 @@ var MeetingProvider = ({
|
|
|
2870
3012
|
onEntryResponded: (p, d) => {
|
|
2871
3013
|
entryResponseListeners.current.forEach((fn) => fn(p, d));
|
|
2872
3014
|
},
|
|
3015
|
+
onJoinRequestCanceled: (requestId) => {
|
|
3016
|
+
joinRequestCanceledListeners.current.forEach((fn) => fn(requestId));
|
|
3017
|
+
},
|
|
3018
|
+
onParticipantRemoved: (participantId, removedBy) => {
|
|
3019
|
+
participantRemovedListeners.current.forEach((fn) => fn(participantId, removedBy));
|
|
3020
|
+
},
|
|
3021
|
+
onParticipantPermissionsChanged: (participantId, permissions) => {
|
|
3022
|
+
participantPermissionsChangedListeners.current.forEach((fn) => fn(participantId, permissions));
|
|
3023
|
+
},
|
|
2873
3024
|
onMeetingLeft: () => {
|
|
2874
3025
|
meetingLeftListeners.current.forEach((fn) => fn());
|
|
2875
3026
|
},
|
|
@@ -3030,6 +3181,13 @@ var MeetingProvider = ({
|
|
|
3030
3181
|
},
|
|
3031
3182
|
approveJoinRequest: sdk.approveJoinRequest.bind(sdk),
|
|
3032
3183
|
rejectJoinRequest: sdk.rejectJoinRequest.bind(sdk),
|
|
3184
|
+
cancelJoinRequest: sdk.cancelJoinRequest.bind(sdk),
|
|
3185
|
+
muteAllAudio: sdk.muteAllAudio.bind(sdk),
|
|
3186
|
+
unmuteAllAudio: sdk.unmuteAllAudio.bind(sdk),
|
|
3187
|
+
removeParticipant: sdk.removeParticipant.bind(sdk),
|
|
3188
|
+
getModerators: sdk.getModerators.bind(sdk),
|
|
3189
|
+
addModerator: sdk.addModerator.bind(sdk),
|
|
3190
|
+
removeModerator: sdk.removeModerator.bind(sdk),
|
|
3033
3191
|
startRecording: sdk.startRecording.bind(sdk),
|
|
3034
3192
|
stopRecording: sdk.stopRecording.bind(sdk),
|
|
3035
3193
|
getRecordingStatus: sdk.getRecordingStatus.bind(sdk),
|
|
@@ -3051,6 +3209,24 @@ var MeetingProvider = ({
|
|
|
3051
3209
|
entryResponseListeners.current.delete(cb);
|
|
3052
3210
|
};
|
|
3053
3211
|
},
|
|
3212
|
+
onJoinRequestCanceled: (cb) => {
|
|
3213
|
+
joinRequestCanceledListeners.current.add(cb);
|
|
3214
|
+
return () => {
|
|
3215
|
+
joinRequestCanceledListeners.current.delete(cb);
|
|
3216
|
+
};
|
|
3217
|
+
},
|
|
3218
|
+
onParticipantRemoved: (cb) => {
|
|
3219
|
+
participantRemovedListeners.current.add(cb);
|
|
3220
|
+
return () => {
|
|
3221
|
+
participantRemovedListeners.current.delete(cb);
|
|
3222
|
+
};
|
|
3223
|
+
},
|
|
3224
|
+
onParticipantPermissionsChanged: (cb) => {
|
|
3225
|
+
participantPermissionsChangedListeners.current.add(cb);
|
|
3226
|
+
return () => {
|
|
3227
|
+
participantPermissionsChangedListeners.current.delete(cb);
|
|
3228
|
+
};
|
|
3229
|
+
},
|
|
3054
3230
|
onMeetingLeft: (cb) => {
|
|
3055
3231
|
meetingLeftListeners.current.add(cb);
|
|
3056
3232
|
return () => {
|
|
@@ -3169,6 +3345,18 @@ var useMeeting = (handlers) => {
|
|
|
3169
3345
|
if (!handlers?.onEntryResponded) return;
|
|
3170
3346
|
return ctx.onEntryResponded(handlers.onEntryResponded);
|
|
3171
3347
|
}, [handlers?.onEntryResponded]);
|
|
3348
|
+
(0, import_react4.useEffect)(() => {
|
|
3349
|
+
if (!handlers?.onJoinRequestCanceled) return;
|
|
3350
|
+
return ctx.onJoinRequestCanceled(handlers.onJoinRequestCanceled);
|
|
3351
|
+
}, [handlers?.onJoinRequestCanceled]);
|
|
3352
|
+
(0, import_react4.useEffect)(() => {
|
|
3353
|
+
if (!handlers?.onParticipantRemoved) return;
|
|
3354
|
+
return ctx.onParticipantRemoved(handlers.onParticipantRemoved);
|
|
3355
|
+
}, [handlers?.onParticipantRemoved]);
|
|
3356
|
+
(0, import_react4.useEffect)(() => {
|
|
3357
|
+
if (!handlers?.onParticipantPermissionsChanged) return;
|
|
3358
|
+
return ctx.onParticipantPermissionsChanged(handlers.onParticipantPermissionsChanged);
|
|
3359
|
+
}, [handlers?.onParticipantPermissionsChanged]);
|
|
3172
3360
|
(0, import_react4.useEffect)(() => {
|
|
3173
3361
|
if (!handlers?.onMeetingLeft) return;
|
|
3174
3362
|
return ctx.onMeetingLeft(handlers.onMeetingLeft);
|