@defcomm/meetingsdk 0.3.9 → 0.4.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 +12 -206
- package/dist/index.d.ts +12 -206
- package/dist/index.js +56 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -190,6 +190,7 @@ var MeetingState = class {
|
|
|
190
190
|
this.chatMessages = /* @__PURE__ */ new Map();
|
|
191
191
|
this.presenterId = null;
|
|
192
192
|
this.activeSpeakerIds = /* @__PURE__ */ new Set();
|
|
193
|
+
this.recording = null;
|
|
193
194
|
this.listeners = /* @__PURE__ */ new Map();
|
|
194
195
|
}
|
|
195
196
|
// ---- reactive system ----
|
|
@@ -219,6 +220,14 @@ var MeetingState = class {
|
|
|
219
220
|
this.activeSpeakerIds = next;
|
|
220
221
|
this.notify("activeSpeakers");
|
|
221
222
|
}
|
|
223
|
+
setRecording(recording) {
|
|
224
|
+
this.recording = recording;
|
|
225
|
+
this.notify("recording");
|
|
226
|
+
}
|
|
227
|
+
clearRecording() {
|
|
228
|
+
this.recording = null;
|
|
229
|
+
this.notify("recording");
|
|
230
|
+
}
|
|
222
231
|
// ---- participants ----
|
|
223
232
|
addParticipant(p) {
|
|
224
233
|
if (this.participants.has(p.id)) return false;
|
|
@@ -2342,9 +2351,22 @@ var VideoSDKCore = class {
|
|
|
2342
2351
|
},
|
|
2343
2352
|
// RECORDING
|
|
2344
2353
|
onRecordingStarted: (recording) => {
|
|
2354
|
+
this.state.setRecording({
|
|
2355
|
+
recording_id: recording.recording_id,
|
|
2356
|
+
started_at: recording.started_at,
|
|
2357
|
+
status: "recording",
|
|
2358
|
+
active: true,
|
|
2359
|
+
late_join: true
|
|
2360
|
+
});
|
|
2345
2361
|
this.events.onRecordingStarted?.(recording);
|
|
2346
2362
|
},
|
|
2347
2363
|
onRecordingStopped: (recording) => {
|
|
2364
|
+
this.state.setRecording({
|
|
2365
|
+
recording_id: recording.recording_id,
|
|
2366
|
+
stopped_at: recording.stopped_at,
|
|
2367
|
+
status: "stopped",
|
|
2368
|
+
active: false
|
|
2369
|
+
});
|
|
2348
2370
|
this.events.onRecordingStopped?.(recording);
|
|
2349
2371
|
},
|
|
2350
2372
|
// REMOTE MEDIA
|
|
@@ -2758,6 +2780,9 @@ var MeetingProvider = ({
|
|
|
2758
2780
|
const activeSpeakerListeners = useRef(
|
|
2759
2781
|
/* @__PURE__ */ new Set()
|
|
2760
2782
|
);
|
|
2783
|
+
const connectionStateListeners = useRef(
|
|
2784
|
+
/* @__PURE__ */ new Set()
|
|
2785
|
+
);
|
|
2761
2786
|
if (!sdkRef.current) {
|
|
2762
2787
|
sdkRef.current = new VideoSDKCore(
|
|
2763
2788
|
{
|
|
@@ -2779,14 +2804,19 @@ var MeetingProvider = ({
|
|
|
2779
2804
|
onTrackStateChanged: (track) => {
|
|
2780
2805
|
trackStateListeners.current.forEach((fn) => fn(track));
|
|
2781
2806
|
},
|
|
2782
|
-
onRecordingStarted: (
|
|
2783
|
-
recordingStartedListeners.current.forEach((fn) => fn(
|
|
2807
|
+
onRecordingStarted: (recording2) => {
|
|
2808
|
+
recordingStartedListeners.current.forEach((fn) => fn(recording2));
|
|
2784
2809
|
},
|
|
2785
|
-
onRecordingStopped: (
|
|
2786
|
-
recordingStoppedListeners.current.forEach((fn) => fn(
|
|
2810
|
+
onRecordingStopped: (recording2) => {
|
|
2811
|
+
recordingStoppedListeners.current.forEach((fn) => fn(recording2));
|
|
2787
2812
|
},
|
|
2788
2813
|
onReaction: (reaction) => {
|
|
2789
2814
|
reactionListeners.current.forEach((fn) => fn(reaction));
|
|
2815
|
+
},
|
|
2816
|
+
onConnectionStateChanged: (state) => {
|
|
2817
|
+
connectionStateListeners.current.forEach(
|
|
2818
|
+
(fn) => fn(state)
|
|
2819
|
+
);
|
|
2790
2820
|
}
|
|
2791
2821
|
}
|
|
2792
2822
|
);
|
|
@@ -2797,6 +2827,7 @@ var MeetingProvider = ({
|
|
|
2797
2827
|
"activeSpeakers",
|
|
2798
2828
|
(s) => Array.from(s.activeSpeakerIds)
|
|
2799
2829
|
);
|
|
2830
|
+
const recording = useMeetingStore(sdk.state, "recording", (s) => s.recording);
|
|
2800
2831
|
const presenterId = useMeetingStore(
|
|
2801
2832
|
sdk.state,
|
|
2802
2833
|
"presenter",
|
|
@@ -2840,6 +2871,7 @@ var MeetingProvider = ({
|
|
|
2840
2871
|
messages,
|
|
2841
2872
|
presenterId,
|
|
2842
2873
|
activeSpeakerIds,
|
|
2874
|
+
recording,
|
|
2843
2875
|
usePubSub: (topic) => {
|
|
2844
2876
|
if (topic !== "SECURE_CHAT") {
|
|
2845
2877
|
throw new Error(`Unsupported PubSub argument: "${topic}"`);
|
|
@@ -2894,6 +2926,12 @@ var MeetingProvider = ({
|
|
|
2894
2926
|
reactionListeners.current.add(cb);
|
|
2895
2927
|
return () => reactionListeners.current.delete(cb);
|
|
2896
2928
|
},
|
|
2929
|
+
onConnectionStateChanged: (cb) => {
|
|
2930
|
+
connectionStateListeners.current.add(cb);
|
|
2931
|
+
return () => {
|
|
2932
|
+
connectionStateListeners.current.delete(cb);
|
|
2933
|
+
};
|
|
2934
|
+
},
|
|
2897
2935
|
onActiveSpeakersChanged: (cb) => {
|
|
2898
2936
|
activeSpeakerListeners.current.add(cb);
|
|
2899
2937
|
return () => {
|
|
@@ -2901,7 +2939,16 @@ var MeetingProvider = ({
|
|
|
2901
2939
|
};
|
|
2902
2940
|
}
|
|
2903
2941
|
};
|
|
2904
|
-
}, [
|
|
2942
|
+
}, [
|
|
2943
|
+
config,
|
|
2944
|
+
sdk,
|
|
2945
|
+
localParticipant,
|
|
2946
|
+
participants,
|
|
2947
|
+
messages,
|
|
2948
|
+
presenterId,
|
|
2949
|
+
recording,
|
|
2950
|
+
activeSpeakerIds
|
|
2951
|
+
]);
|
|
2905
2952
|
return /* @__PURE__ */ jsx(MeetingContext.Provider, { value, children });
|
|
2906
2953
|
};
|
|
2907
2954
|
var useMeetingContext = () => {
|
|
@@ -2990,6 +3037,10 @@ var useMeeting = (handlers) => {
|
|
|
2990
3037
|
if (!handlers?.onRecordingStopped) return;
|
|
2991
3038
|
return ctx.onRecordingStopped(handlers.onRecordingStopped);
|
|
2992
3039
|
}, [handlers?.onRecordingStopped]);
|
|
3040
|
+
useEffect3(() => {
|
|
3041
|
+
if (!handlers?.onConnectionStateChanged) return;
|
|
3042
|
+
return ctx.onConnectionStateChanged(handlers.onConnectionStateChanged);
|
|
3043
|
+
}, [handlers?.onConnectionStateChanged]);
|
|
2993
3044
|
useEffect3(() => {
|
|
2994
3045
|
if (!handlers?.onReaction) return;
|
|
2995
3046
|
return ctx.onReaction(handlers.onReaction);
|
|
@@ -3130,7 +3181,6 @@ export {
|
|
|
3130
3181
|
ActiveSpeakerDetector,
|
|
3131
3182
|
MeetingProvider,
|
|
3132
3183
|
MeetingState,
|
|
3133
|
-
SFUClient,
|
|
3134
3184
|
VideoSDKCore,
|
|
3135
3185
|
useLocalParticipant,
|
|
3136
3186
|
useMeeting,
|