@defcomm/meetingsdk 0.3.8 → 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;
@@ -757,7 +766,12 @@ var SFUClient = class {
757
766
  room_code: this.room,
758
767
  resume_token: this.resumeToken,
759
768
  display_name: this.joinOptions.displayName,
760
- avatar_url: this.joinOptions.avatarUrl
769
+ avatar_url: this.joinOptions.avatarUrl,
770
+ // Preserve the media state requested before host approval.
771
+ // The approval continuation is a second JOIN, so these values
772
+ // must be sent again instead of falling back to the SFU defaults.
773
+ audio_muted: this.desiredAudioMuted,
774
+ video_muted: this.desiredVideoMuted
761
775
  }
762
776
  });
763
777
  }
@@ -1022,10 +1036,7 @@ var SFUClient = class {
1022
1036
  source: normalizedSource
1023
1037
  };
1024
1038
  this.trackMetadata.set(normalized.track_id, normalized);
1025
- this.trackToParticipant.set(
1026
- normalized.track_id,
1027
- normalized.participant_id
1028
- );
1039
+ this.trackToParticipant.set(normalized.track_id, normalized.participant_id);
1029
1040
  if (normalizedSource) {
1030
1041
  this.trackToSource.set(normalized.track_id, normalizedSource);
1031
1042
  } else {
@@ -2340,9 +2351,22 @@ var VideoSDKCore = class {
2340
2351
  },
2341
2352
  // RECORDING
2342
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
+ });
2343
2361
  this.events.onRecordingStarted?.(recording);
2344
2362
  },
2345
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
+ });
2346
2370
  this.events.onRecordingStopped?.(recording);
2347
2371
  },
2348
2372
  // REMOTE MEDIA
@@ -2777,11 +2801,11 @@ var MeetingProvider = ({
2777
2801
  onTrackStateChanged: (track) => {
2778
2802
  trackStateListeners.current.forEach((fn) => fn(track));
2779
2803
  },
2780
- onRecordingStarted: (recording) => {
2781
- recordingStartedListeners.current.forEach((fn) => fn(recording));
2804
+ onRecordingStarted: (recording2) => {
2805
+ recordingStartedListeners.current.forEach((fn) => fn(recording2));
2782
2806
  },
2783
- onRecordingStopped: (recording) => {
2784
- recordingStoppedListeners.current.forEach((fn) => fn(recording));
2807
+ onRecordingStopped: (recording2) => {
2808
+ recordingStoppedListeners.current.forEach((fn) => fn(recording2));
2785
2809
  },
2786
2810
  onReaction: (reaction) => {
2787
2811
  reactionListeners.current.forEach((fn) => fn(reaction));
@@ -2795,6 +2819,7 @@ var MeetingProvider = ({
2795
2819
  "activeSpeakers",
2796
2820
  (s) => Array.from(s.activeSpeakerIds)
2797
2821
  );
2822
+ const recording = useMeetingStore(sdk.state, "recording", (s) => s.recording);
2798
2823
  const presenterId = useMeetingStore(
2799
2824
  sdk.state,
2800
2825
  "presenter",
@@ -2838,6 +2863,7 @@ var MeetingProvider = ({
2838
2863
  messages,
2839
2864
  presenterId,
2840
2865
  activeSpeakerIds,
2866
+ recording,
2841
2867
  usePubSub: (topic) => {
2842
2868
  if (topic !== "SECURE_CHAT") {
2843
2869
  throw new Error(`Unsupported PubSub argument: "${topic}"`);
@@ -2899,7 +2925,16 @@ var MeetingProvider = ({
2899
2925
  };
2900
2926
  }
2901
2927
  };
2902
- }, [config, sdk, localParticipant, participants, messages, presenterId]);
2928
+ }, [
2929
+ config,
2930
+ sdk,
2931
+ localParticipant,
2932
+ participants,
2933
+ messages,
2934
+ presenterId,
2935
+ recording,
2936
+ activeSpeakerIds
2937
+ ]);
2903
2938
  return /* @__PURE__ */ jsx(MeetingContext.Provider, { value, children });
2904
2939
  };
2905
2940
  var useMeetingContext = () => {