@defcomm/meetingsdk 0.5.2 → 0.5.4
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 +0 -6
- package/dist/index.d.ts +0 -6
- package/dist/index.js +60 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -271,8 +271,6 @@ declare class VideoSDKCore {
|
|
|
271
271
|
cancelJoinRequest(requestId?: string): Promise<void | undefined>;
|
|
272
272
|
muteAllAudio(): Promise<void>;
|
|
273
273
|
muteParticipant(participantId: string): Promise<void>;
|
|
274
|
-
unmuteParticipant(participantId: string): Promise<void>;
|
|
275
|
-
unmuteAllAudio(): Promise<void>;
|
|
276
274
|
removeParticipant(participantId: string): Promise<void>;
|
|
277
275
|
getModerators(roomCode: string): Promise<any>;
|
|
278
276
|
addModerator(roomCode: string, userId: string): Promise<any>;
|
|
@@ -354,9 +352,7 @@ type MeetingContextValue = {
|
|
|
354
352
|
rejectJoinRequest: (requestId: string) => void;
|
|
355
353
|
cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
|
|
356
354
|
muteAllAudio: () => Promise<void>;
|
|
357
|
-
unmuteAllAudio: () => Promise<void>;
|
|
358
355
|
muteParticipant: (participantId: string) => Promise<void>;
|
|
359
|
-
unmuteParticipant: (participantId: string) => Promise<void>;
|
|
360
356
|
removeParticipant: (participantId: string) => Promise<void>;
|
|
361
357
|
getModerators: (roomCode: string) => Promise<any> | undefined;
|
|
362
358
|
addModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
@@ -432,9 +428,7 @@ declare const useMeeting: (handlers?: {
|
|
|
432
428
|
rejectJoinRequest: (requestId: string) => void;
|
|
433
429
|
cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
|
|
434
430
|
muteAllAudio: () => Promise<void>;
|
|
435
|
-
unmuteAllAudio: () => Promise<void>;
|
|
436
431
|
muteParticipant: (participantId: string) => Promise<void>;
|
|
437
|
-
unmuteParticipant: (participantId: string) => Promise<void>;
|
|
438
432
|
removeParticipant: (participantId: string) => Promise<void>;
|
|
439
433
|
getModerators: (roomCode: string) => Promise<any> | undefined;
|
|
440
434
|
addModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -271,8 +271,6 @@ declare class VideoSDKCore {
|
|
|
271
271
|
cancelJoinRequest(requestId?: string): Promise<void | undefined>;
|
|
272
272
|
muteAllAudio(): Promise<void>;
|
|
273
273
|
muteParticipant(participantId: string): Promise<void>;
|
|
274
|
-
unmuteParticipant(participantId: string): Promise<void>;
|
|
275
|
-
unmuteAllAudio(): Promise<void>;
|
|
276
274
|
removeParticipant(participantId: string): Promise<void>;
|
|
277
275
|
getModerators(roomCode: string): Promise<any>;
|
|
278
276
|
addModerator(roomCode: string, userId: string): Promise<any>;
|
|
@@ -354,9 +352,7 @@ type MeetingContextValue = {
|
|
|
354
352
|
rejectJoinRequest: (requestId: string) => void;
|
|
355
353
|
cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
|
|
356
354
|
muteAllAudio: () => Promise<void>;
|
|
357
|
-
unmuteAllAudio: () => Promise<void>;
|
|
358
355
|
muteParticipant: (participantId: string) => Promise<void>;
|
|
359
|
-
unmuteParticipant: (participantId: string) => Promise<void>;
|
|
360
356
|
removeParticipant: (participantId: string) => Promise<void>;
|
|
361
357
|
getModerators: (roomCode: string) => Promise<any> | undefined;
|
|
362
358
|
addModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
|
@@ -432,9 +428,7 @@ declare const useMeeting: (handlers?: {
|
|
|
432
428
|
rejectJoinRequest: (requestId: string) => void;
|
|
433
429
|
cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
|
|
434
430
|
muteAllAudio: () => Promise<void>;
|
|
435
|
-
unmuteAllAudio: () => Promise<void>;
|
|
436
431
|
muteParticipant: (participantId: string) => Promise<void>;
|
|
437
|
-
unmuteParticipant: (participantId: string) => Promise<void>;
|
|
438
432
|
removeParticipant: (participantId: string) => Promise<void>;
|
|
439
433
|
getModerators: (roomCode: string) => Promise<any> | undefined;
|
|
440
434
|
addModerator: (roomCode: string, userId: string) => Promise<any> | undefined;
|
package/dist/index.js
CHANGED
|
@@ -290,9 +290,9 @@ var MeetingState = class {
|
|
|
290
290
|
cameraTrack: void 0,
|
|
291
291
|
screenTrack: void 0,
|
|
292
292
|
audioTrack: void 0,
|
|
293
|
-
micEnabled:
|
|
294
|
-
camEnabled:
|
|
295
|
-
isScreenSharing: false,
|
|
293
|
+
micEnabled: p.media?.micEnabled ?? false,
|
|
294
|
+
camEnabled: p.media?.camEnabled ?? false,
|
|
295
|
+
isScreenSharing: p.media?.isScreenSharing ?? false,
|
|
296
296
|
...p.media,
|
|
297
297
|
...patch
|
|
298
298
|
}
|
|
@@ -882,9 +882,15 @@ var SFUClient = class {
|
|
|
882
882
|
if (!participantId) break;
|
|
883
883
|
const participant = this.participants.get(participantId);
|
|
884
884
|
if (participant) {
|
|
885
|
-
this.participants.set(participantId, {
|
|
885
|
+
this.participants.set(participantId, {
|
|
886
|
+
...participant,
|
|
887
|
+
permissions: payload.permissions
|
|
888
|
+
});
|
|
886
889
|
}
|
|
887
|
-
this.onParticipantPermissionsChanged(
|
|
890
|
+
this.onParticipantPermissionsChanged(
|
|
891
|
+
participantId,
|
|
892
|
+
payload.permissions
|
|
893
|
+
);
|
|
888
894
|
break;
|
|
889
895
|
}
|
|
890
896
|
case "publish_answer": {
|
|
@@ -1799,42 +1805,48 @@ var SFUClient = class {
|
|
|
1799
1805
|
this.pendingJoinRequestId = null;
|
|
1800
1806
|
}
|
|
1801
1807
|
async muteAllAudio() {
|
|
1802
|
-
if (!this.send({ type: "mute_all_audio" }))
|
|
1803
|
-
}
|
|
1804
|
-
async muteParticipant(participantId) {
|
|
1805
|
-
if (!participantId) throw new Error("participantId is required");
|
|
1806
|
-
if (!this.send({ type: "mute_participant", payload: { participant_id: participantId } })) {
|
|
1808
|
+
if (!this.send({ type: "mute_all_audio" }))
|
|
1807
1809
|
throw new Error("SFU signaling is not connected");
|
|
1808
|
-
}
|
|
1809
1810
|
}
|
|
1810
|
-
async
|
|
1811
|
+
async muteParticipant(participantId) {
|
|
1811
1812
|
if (!participantId) throw new Error("participantId is required");
|
|
1812
|
-
if (!this.send({
|
|
1813
|
+
if (!this.send({
|
|
1814
|
+
type: "mute_participant",
|
|
1815
|
+
payload: { participant_id: participantId }
|
|
1816
|
+
})) {
|
|
1813
1817
|
throw new Error("SFU signaling is not connected");
|
|
1814
1818
|
}
|
|
1815
1819
|
}
|
|
1816
|
-
async unmuteAllAudio() {
|
|
1817
|
-
if (!this.send({ type: "unmute_all_audio" })) throw new Error("SFU signaling is not connected");
|
|
1818
|
-
}
|
|
1819
1820
|
async removeParticipant(participantId) {
|
|
1820
1821
|
if (!participantId) throw new Error("participantId is required");
|
|
1821
|
-
if (!this.send({
|
|
1822
|
+
if (!this.send({
|
|
1823
|
+
type: "remove_participant",
|
|
1824
|
+
payload: { participant_id: participantId }
|
|
1825
|
+
})) {
|
|
1822
1826
|
throw new Error("SFU signaling is not connected");
|
|
1823
1827
|
}
|
|
1824
1828
|
}
|
|
1825
1829
|
async getModerators(roomCode) {
|
|
1826
|
-
return this.request(
|
|
1830
|
+
return this.request(
|
|
1831
|
+
`${this.apiBase}/rooms/${encodeURIComponent(roomCode)}/moderators`
|
|
1832
|
+
);
|
|
1827
1833
|
}
|
|
1828
1834
|
async addModerator(roomCode, userId) {
|
|
1829
|
-
return this.request(
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1835
|
+
return this.request(
|
|
1836
|
+
`${this.apiBase}/rooms/${encodeURIComponent(roomCode)}/moderators`,
|
|
1837
|
+
{
|
|
1838
|
+
method: "POST",
|
|
1839
|
+
body: JSON.stringify({ user_id: userId })
|
|
1840
|
+
}
|
|
1841
|
+
);
|
|
1833
1842
|
}
|
|
1834
1843
|
async removeModerator(roomCode, userId) {
|
|
1835
|
-
return this.request(
|
|
1836
|
-
|
|
1837
|
-
|
|
1844
|
+
return this.request(
|
|
1845
|
+
`${this.apiBase}/rooms/${encodeURIComponent(roomCode)}/moderators/${encodeURIComponent(userId)}`,
|
|
1846
|
+
{
|
|
1847
|
+
method: "DELETE"
|
|
1848
|
+
}
|
|
1849
|
+
);
|
|
1838
1850
|
}
|
|
1839
1851
|
isSocketOpen() {
|
|
1840
1852
|
return this.ws?.readyState === WebSocket.OPEN;
|
|
@@ -2259,10 +2271,24 @@ var VideoSDKCore = class {
|
|
|
2259
2271
|
this.handleSFUState(state);
|
|
2260
2272
|
},
|
|
2261
2273
|
onConnected: (payload, resumed) => {
|
|
2262
|
-
|
|
2274
|
+
const local = (payload?.participants || []).find(
|
|
2275
|
+
(participant) => participant?.participant_id === this.myId
|
|
2276
|
+
);
|
|
2277
|
+
const permissions = local?.permissions ?? payload?.permissions ?? {};
|
|
2278
|
+
const isModerator = Boolean(permissions?.moderate);
|
|
2279
|
+
const isHost = Boolean(
|
|
2280
|
+
local?.is_host ?? local?.isHost ?? permissions?.host
|
|
2281
|
+
);
|
|
2263
2282
|
this.state.updateLocalParticipant({
|
|
2264
2283
|
id: this.myId,
|
|
2265
|
-
name:
|
|
2284
|
+
name: local?.user_metadata?.name,
|
|
2285
|
+
isHost,
|
|
2286
|
+
isModerator,
|
|
2287
|
+
permissions,
|
|
2288
|
+
media: {
|
|
2289
|
+
micEnabled: !Boolean(local?.audio_muted),
|
|
2290
|
+
camEnabled: !Boolean(local?.video_muted)
|
|
2291
|
+
}
|
|
2266
2292
|
});
|
|
2267
2293
|
},
|
|
2268
2294
|
onDisconnected: () => {
|
|
@@ -2381,7 +2407,13 @@ var VideoSDKCore = class {
|
|
|
2381
2407
|
onParticipantPermissionsChanged: (participantId, permissions) => {
|
|
2382
2408
|
if (participantId === this.myId) {
|
|
2383
2409
|
const current = this.state.localParticipant;
|
|
2384
|
-
this.state.updateLocalParticipant({
|
|
2410
|
+
this.state.updateLocalParticipant({
|
|
2411
|
+
id: this.myId,
|
|
2412
|
+
name: this.participantName,
|
|
2413
|
+
isHost: current?.isHost,
|
|
2414
|
+
isModerator: Boolean(permissions?.moderate),
|
|
2415
|
+
permissions
|
|
2416
|
+
});
|
|
2385
2417
|
}
|
|
2386
2418
|
},
|
|
2387
2419
|
onJoinRequested: (request) => {
|
|
@@ -2747,14 +2779,6 @@ var VideoSDKCore = class {
|
|
|
2747
2779
|
if (!this.sfuClient) throw new Error("SFU client is not connected");
|
|
2748
2780
|
return this.sfuClient.muteParticipant(participantId);
|
|
2749
2781
|
}
|
|
2750
|
-
async unmuteParticipant(participantId) {
|
|
2751
|
-
if (!this.sfuClient) throw new Error("SFU client is not connected");
|
|
2752
|
-
return this.sfuClient.unmuteParticipant(participantId);
|
|
2753
|
-
}
|
|
2754
|
-
async unmuteAllAudio() {
|
|
2755
|
-
if (!this.sfuClient) throw new Error("SFU client is not connected");
|
|
2756
|
-
return this.sfuClient.unmuteAllAudio();
|
|
2757
|
-
}
|
|
2758
2782
|
async removeParticipant(participantId) {
|
|
2759
2783
|
if (!this.sfuClient) throw new Error("SFU client is not connected");
|
|
2760
2784
|
return this.sfuClient.removeParticipant(participantId);
|
|
@@ -3203,9 +3227,7 @@ var MeetingProvider = ({
|
|
|
3203
3227
|
rejectJoinRequest: sdk.rejectJoinRequest.bind(sdk),
|
|
3204
3228
|
cancelJoinRequest: sdk.cancelJoinRequest.bind(sdk),
|
|
3205
3229
|
muteAllAudio: sdk.muteAllAudio.bind(sdk),
|
|
3206
|
-
unmuteAllAudio: sdk.unmuteAllAudio.bind(sdk),
|
|
3207
3230
|
muteParticipant: sdk.muteParticipant.bind(sdk),
|
|
3208
|
-
unmuteParticipant: sdk.unmuteParticipant.bind(sdk),
|
|
3209
3231
|
removeParticipant: sdk.removeParticipant.bind(sdk),
|
|
3210
3232
|
getModerators: sdk.getModerators.bind(sdk),
|
|
3211
3233
|
addModerator: sdk.addModerator.bind(sdk),
|