@defcomm/meetingsdk 0.3.9 → 0.4.0

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.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
@@ -2779,11 +2801,11 @@ var MeetingProvider = ({
2779
2801
  onTrackStateChanged: (track) => {
2780
2802
  trackStateListeners.current.forEach((fn) => fn(track));
2781
2803
  },
2782
- onRecordingStarted: (recording) => {
2783
- recordingStartedListeners.current.forEach((fn) => fn(recording));
2804
+ onRecordingStarted: (recording2) => {
2805
+ recordingStartedListeners.current.forEach((fn) => fn(recording2));
2784
2806
  },
2785
- onRecordingStopped: (recording) => {
2786
- recordingStoppedListeners.current.forEach((fn) => fn(recording));
2807
+ onRecordingStopped: (recording2) => {
2808
+ recordingStoppedListeners.current.forEach((fn) => fn(recording2));
2787
2809
  },
2788
2810
  onReaction: (reaction) => {
2789
2811
  reactionListeners.current.forEach((fn) => fn(reaction));
@@ -2797,6 +2819,7 @@ var MeetingProvider = ({
2797
2819
  "activeSpeakers",
2798
2820
  (s) => Array.from(s.activeSpeakerIds)
2799
2821
  );
2822
+ const recording = useMeetingStore(sdk.state, "recording", (s) => s.recording);
2800
2823
  const presenterId = useMeetingStore(
2801
2824
  sdk.state,
2802
2825
  "presenter",
@@ -2840,6 +2863,7 @@ var MeetingProvider = ({
2840
2863
  messages,
2841
2864
  presenterId,
2842
2865
  activeSpeakerIds,
2866
+ recording,
2843
2867
  usePubSub: (topic) => {
2844
2868
  if (topic !== "SECURE_CHAT") {
2845
2869
  throw new Error(`Unsupported PubSub argument: "${topic}"`);
@@ -2901,7 +2925,16 @@ var MeetingProvider = ({
2901
2925
  };
2902
2926
  }
2903
2927
  };
2904
- }, [config, sdk, localParticipant, participants, messages, presenterId]);
2928
+ }, [
2929
+ config,
2930
+ sdk,
2931
+ localParticipant,
2932
+ participants,
2933
+ messages,
2934
+ presenterId,
2935
+ recording,
2936
+ activeSpeakerIds
2937
+ ]);
2905
2938
  return /* @__PURE__ */ jsx(MeetingContext.Provider, { value, children });
2906
2939
  };
2907
2940
  var useMeetingContext = () => {