@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.js
CHANGED
|
@@ -23,7 +23,6 @@ __export(index_exports, {
|
|
|
23
23
|
ActiveSpeakerDetector: () => ActiveSpeakerDetector,
|
|
24
24
|
MeetingProvider: () => MeetingProvider,
|
|
25
25
|
MeetingState: () => MeetingState,
|
|
26
|
-
SFUClient: () => SFUClient,
|
|
27
26
|
VideoSDKCore: () => VideoSDKCore,
|
|
28
27
|
useLocalParticipant: () => useLocalParticipant,
|
|
29
28
|
useMeeting: () => useMeeting,
|
|
@@ -226,6 +225,7 @@ var MeetingState = class {
|
|
|
226
225
|
this.chatMessages = /* @__PURE__ */ new Map();
|
|
227
226
|
this.presenterId = null;
|
|
228
227
|
this.activeSpeakerIds = /* @__PURE__ */ new Set();
|
|
228
|
+
this.recording = null;
|
|
229
229
|
this.listeners = /* @__PURE__ */ new Map();
|
|
230
230
|
}
|
|
231
231
|
// ---- reactive system ----
|
|
@@ -255,6 +255,14 @@ var MeetingState = class {
|
|
|
255
255
|
this.activeSpeakerIds = next;
|
|
256
256
|
this.notify("activeSpeakers");
|
|
257
257
|
}
|
|
258
|
+
setRecording(recording) {
|
|
259
|
+
this.recording = recording;
|
|
260
|
+
this.notify("recording");
|
|
261
|
+
}
|
|
262
|
+
clearRecording() {
|
|
263
|
+
this.recording = null;
|
|
264
|
+
this.notify("recording");
|
|
265
|
+
}
|
|
258
266
|
// ---- participants ----
|
|
259
267
|
addParticipant(p) {
|
|
260
268
|
if (this.participants.has(p.id)) return false;
|
|
@@ -2378,9 +2386,22 @@ var VideoSDKCore = class {
|
|
|
2378
2386
|
},
|
|
2379
2387
|
// RECORDING
|
|
2380
2388
|
onRecordingStarted: (recording) => {
|
|
2389
|
+
this.state.setRecording({
|
|
2390
|
+
recording_id: recording.recording_id,
|
|
2391
|
+
started_at: recording.started_at,
|
|
2392
|
+
status: "recording",
|
|
2393
|
+
active: true,
|
|
2394
|
+
late_join: true
|
|
2395
|
+
});
|
|
2381
2396
|
this.events.onRecordingStarted?.(recording);
|
|
2382
2397
|
},
|
|
2383
2398
|
onRecordingStopped: (recording) => {
|
|
2399
|
+
this.state.setRecording({
|
|
2400
|
+
recording_id: recording.recording_id,
|
|
2401
|
+
stopped_at: recording.stopped_at,
|
|
2402
|
+
status: "stopped",
|
|
2403
|
+
active: false
|
|
2404
|
+
});
|
|
2384
2405
|
this.events.onRecordingStopped?.(recording);
|
|
2385
2406
|
},
|
|
2386
2407
|
// REMOTE MEDIA
|
|
@@ -2794,6 +2815,9 @@ var MeetingProvider = ({
|
|
|
2794
2815
|
const activeSpeakerListeners = (0, import_react2.useRef)(
|
|
2795
2816
|
/* @__PURE__ */ new Set()
|
|
2796
2817
|
);
|
|
2818
|
+
const connectionStateListeners = (0, import_react2.useRef)(
|
|
2819
|
+
/* @__PURE__ */ new Set()
|
|
2820
|
+
);
|
|
2797
2821
|
if (!sdkRef.current) {
|
|
2798
2822
|
sdkRef.current = new VideoSDKCore(
|
|
2799
2823
|
{
|
|
@@ -2815,14 +2839,19 @@ var MeetingProvider = ({
|
|
|
2815
2839
|
onTrackStateChanged: (track) => {
|
|
2816
2840
|
trackStateListeners.current.forEach((fn) => fn(track));
|
|
2817
2841
|
},
|
|
2818
|
-
onRecordingStarted: (
|
|
2819
|
-
recordingStartedListeners.current.forEach((fn) => fn(
|
|
2842
|
+
onRecordingStarted: (recording2) => {
|
|
2843
|
+
recordingStartedListeners.current.forEach((fn) => fn(recording2));
|
|
2820
2844
|
},
|
|
2821
|
-
onRecordingStopped: (
|
|
2822
|
-
recordingStoppedListeners.current.forEach((fn) => fn(
|
|
2845
|
+
onRecordingStopped: (recording2) => {
|
|
2846
|
+
recordingStoppedListeners.current.forEach((fn) => fn(recording2));
|
|
2823
2847
|
},
|
|
2824
2848
|
onReaction: (reaction) => {
|
|
2825
2849
|
reactionListeners.current.forEach((fn) => fn(reaction));
|
|
2850
|
+
},
|
|
2851
|
+
onConnectionStateChanged: (state) => {
|
|
2852
|
+
connectionStateListeners.current.forEach(
|
|
2853
|
+
(fn) => fn(state)
|
|
2854
|
+
);
|
|
2826
2855
|
}
|
|
2827
2856
|
}
|
|
2828
2857
|
);
|
|
@@ -2833,6 +2862,7 @@ var MeetingProvider = ({
|
|
|
2833
2862
|
"activeSpeakers",
|
|
2834
2863
|
(s) => Array.from(s.activeSpeakerIds)
|
|
2835
2864
|
);
|
|
2865
|
+
const recording = useMeetingStore(sdk.state, "recording", (s) => s.recording);
|
|
2836
2866
|
const presenterId = useMeetingStore(
|
|
2837
2867
|
sdk.state,
|
|
2838
2868
|
"presenter",
|
|
@@ -2876,6 +2906,7 @@ var MeetingProvider = ({
|
|
|
2876
2906
|
messages,
|
|
2877
2907
|
presenterId,
|
|
2878
2908
|
activeSpeakerIds,
|
|
2909
|
+
recording,
|
|
2879
2910
|
usePubSub: (topic) => {
|
|
2880
2911
|
if (topic !== "SECURE_CHAT") {
|
|
2881
2912
|
throw new Error(`Unsupported PubSub argument: "${topic}"`);
|
|
@@ -2930,6 +2961,12 @@ var MeetingProvider = ({
|
|
|
2930
2961
|
reactionListeners.current.add(cb);
|
|
2931
2962
|
return () => reactionListeners.current.delete(cb);
|
|
2932
2963
|
},
|
|
2964
|
+
onConnectionStateChanged: (cb) => {
|
|
2965
|
+
connectionStateListeners.current.add(cb);
|
|
2966
|
+
return () => {
|
|
2967
|
+
connectionStateListeners.current.delete(cb);
|
|
2968
|
+
};
|
|
2969
|
+
},
|
|
2933
2970
|
onActiveSpeakersChanged: (cb) => {
|
|
2934
2971
|
activeSpeakerListeners.current.add(cb);
|
|
2935
2972
|
return () => {
|
|
@@ -2937,7 +2974,16 @@ var MeetingProvider = ({
|
|
|
2937
2974
|
};
|
|
2938
2975
|
}
|
|
2939
2976
|
};
|
|
2940
|
-
}, [
|
|
2977
|
+
}, [
|
|
2978
|
+
config,
|
|
2979
|
+
sdk,
|
|
2980
|
+
localParticipant,
|
|
2981
|
+
participants,
|
|
2982
|
+
messages,
|
|
2983
|
+
presenterId,
|
|
2984
|
+
recording,
|
|
2985
|
+
activeSpeakerIds
|
|
2986
|
+
]);
|
|
2941
2987
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MeetingContext.Provider, { value, children });
|
|
2942
2988
|
};
|
|
2943
2989
|
var useMeetingContext = () => {
|
|
@@ -3026,6 +3072,10 @@ var useMeeting = (handlers) => {
|
|
|
3026
3072
|
if (!handlers?.onRecordingStopped) return;
|
|
3027
3073
|
return ctx.onRecordingStopped(handlers.onRecordingStopped);
|
|
3028
3074
|
}, [handlers?.onRecordingStopped]);
|
|
3075
|
+
(0, import_react4.useEffect)(() => {
|
|
3076
|
+
if (!handlers?.onConnectionStateChanged) return;
|
|
3077
|
+
return ctx.onConnectionStateChanged(handlers.onConnectionStateChanged);
|
|
3078
|
+
}, [handlers?.onConnectionStateChanged]);
|
|
3029
3079
|
(0, import_react4.useEffect)(() => {
|
|
3030
3080
|
if (!handlers?.onReaction) return;
|
|
3031
3081
|
return ctx.onReaction(handlers.onReaction);
|
|
@@ -3167,7 +3217,6 @@ function useMeetingPreview(roomId, participantId) {
|
|
|
3167
3217
|
ActiveSpeakerDetector,
|
|
3168
3218
|
MeetingProvider,
|
|
3169
3219
|
MeetingState,
|
|
3170
|
-
SFUClient,
|
|
3171
3220
|
VideoSDKCore,
|
|
3172
3221
|
useLocalParticipant,
|
|
3173
3222
|
useMeeting,
|