@defcomm/meetingsdk 0.6.2 → 0.6.3
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 +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -286,6 +286,7 @@ var MeetingState = class {
|
|
|
286
286
|
name: patch.name ?? "",
|
|
287
287
|
isHost: patch.isHost ?? false,
|
|
288
288
|
isModerator: patch.isModerator ?? false,
|
|
289
|
+
handRaised: patch.handRaised ?? false,
|
|
289
290
|
permissions: patch.permissions,
|
|
290
291
|
media: {
|
|
291
292
|
stream: patch.media?.stream ?? null,
|
|
@@ -333,6 +334,21 @@ var MeetingState = class {
|
|
|
333
334
|
};
|
|
334
335
|
this.notify("localParticipant");
|
|
335
336
|
}
|
|
337
|
+
setParticipantHandRaised(id, raised) {
|
|
338
|
+
const p = id === this.localParticipant?.id ? this.localParticipant : this.participants.get(id);
|
|
339
|
+
if (!p || p.handRaised === raised) return;
|
|
340
|
+
const updated = { ...p, handRaised: raised };
|
|
341
|
+
if (id === this.localParticipant?.id) {
|
|
342
|
+
this.localParticipant = updated;
|
|
343
|
+
this.notify("localParticipant");
|
|
344
|
+
} else {
|
|
345
|
+
const next = new Map(this.participants);
|
|
346
|
+
next.set(id, updated);
|
|
347
|
+
this.participants = next;
|
|
348
|
+
this.notify(`participant:${id}`);
|
|
349
|
+
this.notify("participants");
|
|
350
|
+
}
|
|
351
|
+
}
|
|
336
352
|
// ---- chat ----
|
|
337
353
|
addChatMessage(msg) {
|
|
338
354
|
this.chatMessages.set(msg.id, msg);
|
|
@@ -481,6 +497,8 @@ var SFUClient = class {
|
|
|
481
497
|
});
|
|
482
498
|
this.onReaction = options.onReaction || (() => {
|
|
483
499
|
});
|
|
500
|
+
this.onHandRaised = options.onHandRaised || (() => {
|
|
501
|
+
});
|
|
484
502
|
this.onRoomUpdate = options.onRoomUpdate || (() => {
|
|
485
503
|
});
|
|
486
504
|
this.onNetworkQuality = options.onNetworkQuality || (() => {
|
|
@@ -1079,6 +1097,12 @@ var SFUClient = class {
|
|
|
1079
1097
|
if (reaction?.id && reaction?.emoji) this.onReaction(reaction);
|
|
1080
1098
|
break;
|
|
1081
1099
|
}
|
|
1100
|
+
case "hand_raised": {
|
|
1101
|
+
const participantId = String(payload.participant_id ?? payload.participantId ?? "");
|
|
1102
|
+
const raised = Boolean(payload.raised);
|
|
1103
|
+
if (participantId) this.onHandRaised(participantId, raised);
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1082
1106
|
case "network_quality": {
|
|
1083
1107
|
const raw = payload.quality || payload;
|
|
1084
1108
|
const quality = {
|
|
@@ -2004,6 +2028,14 @@ var SFUClient = class {
|
|
|
2004
2028
|
}
|
|
2005
2029
|
});
|
|
2006
2030
|
}
|
|
2031
|
+
setHandRaised(raised) {
|
|
2032
|
+
this.send({
|
|
2033
|
+
type: "set_hand_raised",
|
|
2034
|
+
payload: {
|
|
2035
|
+
raised
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2007
2039
|
removeRemoteParticipant(participantId) {
|
|
2008
2040
|
const stream = this.remoteStreams.get(participantId);
|
|
2009
2041
|
if (stream) {
|
|
@@ -2438,6 +2470,7 @@ var VideoSDKCore = class {
|
|
|
2438
2470
|
isHost,
|
|
2439
2471
|
isModerator,
|
|
2440
2472
|
permissions,
|
|
2473
|
+
handRaised: Boolean(local?.hand_raised),
|
|
2441
2474
|
media: {
|
|
2442
2475
|
micEnabled: !Boolean(local?.audio_muted),
|
|
2443
2476
|
camEnabled: !Boolean(local?.video_muted)
|
|
@@ -2465,6 +2498,7 @@ var VideoSDKCore = class {
|
|
|
2465
2498
|
this.state.updateLocalParticipant({
|
|
2466
2499
|
id: this.myId,
|
|
2467
2500
|
name: this.participantName,
|
|
2501
|
+
handRaised: Boolean(local.hand_raised),
|
|
2468
2502
|
media: {
|
|
2469
2503
|
micEnabled: !Boolean(local.audio_muted),
|
|
2470
2504
|
camEnabled: !Boolean(local.video_muted),
|
|
@@ -2543,6 +2577,10 @@ var VideoSDKCore = class {
|
|
|
2543
2577
|
onReaction: (reaction) => {
|
|
2544
2578
|
this.events.onReaction?.(reaction);
|
|
2545
2579
|
},
|
|
2580
|
+
onHandRaised: (participantId, raised) => {
|
|
2581
|
+
this.state.setParticipantHandRaised(participantId, raised);
|
|
2582
|
+
this.events.onHandRaised?.(participantId, raised);
|
|
2583
|
+
},
|
|
2546
2584
|
onJoinRequestCanceled: (requestId) => {
|
|
2547
2585
|
this.events.onJoinRequestCanceled?.(requestId);
|
|
2548
2586
|
},
|
|
@@ -2568,6 +2606,7 @@ var VideoSDKCore = class {
|
|
|
2568
2606
|
id: this.myId,
|
|
2569
2607
|
name: this.participantName,
|
|
2570
2608
|
isHost: current?.isHost,
|
|
2609
|
+
handRaised: current?.handRaised,
|
|
2571
2610
|
isModerator: Boolean(permissions?.moderate),
|
|
2572
2611
|
permissions
|
|
2573
2612
|
});
|
|
@@ -2597,6 +2636,7 @@ var VideoSDKCore = class {
|
|
|
2597
2636
|
id: pid,
|
|
2598
2637
|
name: pname,
|
|
2599
2638
|
isModerator: Boolean(participant?.permissions?.moderate),
|
|
2639
|
+
handRaised: Boolean(participant?.hand_raised),
|
|
2600
2640
|
permissions: participant?.permissions,
|
|
2601
2641
|
connectionState: "connected",
|
|
2602
2642
|
media: {
|
|
@@ -3114,6 +3154,16 @@ var VideoSDKCore = class {
|
|
|
3114
3154
|
}
|
|
3115
3155
|
this.sfuClient.sendReaction(reaction);
|
|
3116
3156
|
}
|
|
3157
|
+
setHandRaised(raised) {
|
|
3158
|
+
if (!this.sfuClient) {
|
|
3159
|
+
console.warn("SFU Client not connected");
|
|
3160
|
+
return;
|
|
3161
|
+
}
|
|
3162
|
+
this.sfuClient.setHandRaised(raised);
|
|
3163
|
+
}
|
|
3164
|
+
toggleHandRaised() {
|
|
3165
|
+
this.setHandRaised(!Boolean(this.state.localParticipant?.handRaised));
|
|
3166
|
+
}
|
|
3117
3167
|
/**
|
|
3118
3168
|
* Generic PubSub publishing entry point.
|
|
3119
3169
|
*
|
|
@@ -3234,6 +3284,9 @@ var MeetingProvider = ({
|
|
|
3234
3284
|
const recordingStartedListeners = useRef(/* @__PURE__ */ new Set());
|
|
3235
3285
|
const recordingStoppedListeners = useRef(/* @__PURE__ */ new Set());
|
|
3236
3286
|
const reactionListeners = useRef(/* @__PURE__ */ new Set());
|
|
3287
|
+
const handRaisedListeners = useRef(
|
|
3288
|
+
/* @__PURE__ */ new Set()
|
|
3289
|
+
);
|
|
3237
3290
|
const pubSubListeners = useRef(
|
|
3238
3291
|
/* @__PURE__ */ new Map()
|
|
3239
3292
|
);
|
|
@@ -3337,6 +3390,9 @@ var MeetingProvider = ({
|
|
|
3337
3390
|
);
|
|
3338
3391
|
pubSubListeners.current.get("REACTION")?.forEach((fn) => fn(message));
|
|
3339
3392
|
},
|
|
3393
|
+
onHandRaised: (participantId, raised) => {
|
|
3394
|
+
handRaisedListeners.current.forEach((fn) => fn(participantId, raised));
|
|
3395
|
+
},
|
|
3340
3396
|
onNetworkQuality: (quality) => {
|
|
3341
3397
|
networkQualityListeners.current.forEach((fn) => fn(quality));
|
|
3342
3398
|
},
|
|
@@ -3409,6 +3465,8 @@ var MeetingProvider = ({
|
|
|
3409
3465
|
stopScreenShare: sdk.stopScreenShare.bind(sdk),
|
|
3410
3466
|
sendMessage: sdk.sendChatMessage.bind(sdk),
|
|
3411
3467
|
sendReaction: sdk.sendReaction.bind(sdk),
|
|
3468
|
+
setHandRaised: sdk.setHandRaised.bind(sdk),
|
|
3469
|
+
toggleHandRaised: sdk.toggleHandRaised.bind(sdk),
|
|
3412
3470
|
room: sdk.getMeeting(),
|
|
3413
3471
|
localParticipant,
|
|
3414
3472
|
participants,
|
|
@@ -3534,6 +3592,10 @@ var MeetingProvider = ({
|
|
|
3534
3592
|
reactionListeners.current.add(cb);
|
|
3535
3593
|
return () => reactionListeners.current.delete(cb);
|
|
3536
3594
|
},
|
|
3595
|
+
onHandRaised: (cb) => {
|
|
3596
|
+
handRaisedListeners.current.add(cb);
|
|
3597
|
+
return () => handRaisedListeners.current.delete(cb);
|
|
3598
|
+
},
|
|
3537
3599
|
onNetworkQuality: (cb) => {
|
|
3538
3600
|
networkQualityListeners.current.add(cb);
|
|
3539
3601
|
return () => networkQualityListeners.current.delete(cb);
|
|
@@ -3701,6 +3763,10 @@ var useMeeting = (handlers) => {
|
|
|
3701
3763
|
if (!handlers?.onReaction) return;
|
|
3702
3764
|
return ctx.onReaction(handlers.onReaction);
|
|
3703
3765
|
}, [handlers?.onReaction]);
|
|
3766
|
+
useEffect3(() => {
|
|
3767
|
+
if (!handlers?.onHandRaised) return;
|
|
3768
|
+
return ctx.onHandRaised(handlers.onHandRaised);
|
|
3769
|
+
}, [handlers?.onHandRaised]);
|
|
3704
3770
|
const { sdk: _, ...publicApi } = ctx;
|
|
3705
3771
|
return publicApi;
|
|
3706
3772
|
};
|