@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.d.mts CHANGED
@@ -106,7 +106,7 @@ type RecordingInfo = {
106
106
  active?: boolean;
107
107
  late_join?: boolean;
108
108
  };
109
- type StateScope = "participants" | "localParticipant" | "chat" | "presenter" | "activeSpeakers" | `participant:${string}`;
109
+ type StateScope = "participants" | "localParticipant" | "chat" | "presenter" | "activeSpeakers" | "recording" | `participant:${string}`;
110
110
  type SDKError = {
111
111
  code: string;
112
112
  message: string;
@@ -162,11 +162,14 @@ declare class MeetingState {
162
162
  chatMessages: Map<string, ChatMessage>;
163
163
  presenterId: string | null;
164
164
  activeSpeakerIds: Set<string>;
165
+ recording: RecordingInfo | null;
165
166
  private listeners;
166
167
  subscribe(scope: StateScope, fn: Listener): () => void;
167
168
  notify(scope: StateScope): void;
168
169
  setPresenterId(id: string | null): void;
169
170
  setActiveSpeakers(ids: string[]): void;
171
+ setRecording(recording: RecordingInfo | null): void;
172
+ clearRecording(): void;
170
173
  addParticipant(p: Participant): boolean;
171
174
  removeParticipant(id: string): void;
172
175
  updateParticipantMedia(id: string, patch: Partial<NonNullable<Participant["media"]>>): void;
@@ -495,6 +498,7 @@ type MeetingContextValue = {
495
498
  messages: ChatMessage[];
496
499
  presenterId: string | null;
497
500
  activeSpeakerIds: string[];
501
+ recording: RecordingInfo | null;
498
502
  usePubSub: (topic: PubSubTopic) => PubSubHandle;
499
503
  approveJoinRequest: (requestId: string) => void;
500
504
  rejectJoinRequest: (requestId: string) => void;
@@ -553,6 +557,7 @@ declare const useMeeting: (handlers?: {
553
557
  messages: ChatMessage[];
554
558
  presenterId: string | null;
555
559
  activeSpeakerIds: string[];
560
+ recording: RecordingInfo | null;
556
561
  usePubSub: (topic: PubSubTopic) => {
557
562
  messages: ChatMessage[];
558
563
  publish: (input: ChatInput) => void;
package/dist/index.d.ts CHANGED
@@ -106,7 +106,7 @@ type RecordingInfo = {
106
106
  active?: boolean;
107
107
  late_join?: boolean;
108
108
  };
109
- type StateScope = "participants" | "localParticipant" | "chat" | "presenter" | "activeSpeakers" | `participant:${string}`;
109
+ type StateScope = "participants" | "localParticipant" | "chat" | "presenter" | "activeSpeakers" | "recording" | `participant:${string}`;
110
110
  type SDKError = {
111
111
  code: string;
112
112
  message: string;
@@ -162,11 +162,14 @@ declare class MeetingState {
162
162
  chatMessages: Map<string, ChatMessage>;
163
163
  presenterId: string | null;
164
164
  activeSpeakerIds: Set<string>;
165
+ recording: RecordingInfo | null;
165
166
  private listeners;
166
167
  subscribe(scope: StateScope, fn: Listener): () => void;
167
168
  notify(scope: StateScope): void;
168
169
  setPresenterId(id: string | null): void;
169
170
  setActiveSpeakers(ids: string[]): void;
171
+ setRecording(recording: RecordingInfo | null): void;
172
+ clearRecording(): void;
170
173
  addParticipant(p: Participant): boolean;
171
174
  removeParticipant(id: string): void;
172
175
  updateParticipantMedia(id: string, patch: Partial<NonNullable<Participant["media"]>>): void;
@@ -495,6 +498,7 @@ type MeetingContextValue = {
495
498
  messages: ChatMessage[];
496
499
  presenterId: string | null;
497
500
  activeSpeakerIds: string[];
501
+ recording: RecordingInfo | null;
498
502
  usePubSub: (topic: PubSubTopic) => PubSubHandle;
499
503
  approveJoinRequest: (requestId: string) => void;
500
504
  rejectJoinRequest: (requestId: string) => void;
@@ -553,6 +557,7 @@ declare const useMeeting: (handlers?: {
553
557
  messages: ChatMessage[];
554
558
  presenterId: string | null;
555
559
  activeSpeakerIds: string[];
560
+ recording: RecordingInfo | null;
556
561
  usePubSub: (topic: PubSubTopic) => {
557
562
  messages: ChatMessage[];
558
563
  publish: (input: ChatInput) => void;
package/dist/index.js CHANGED
@@ -226,6 +226,7 @@ var MeetingState = class {
226
226
  this.chatMessages = /* @__PURE__ */ new Map();
227
227
  this.presenterId = null;
228
228
  this.activeSpeakerIds = /* @__PURE__ */ new Set();
229
+ this.recording = null;
229
230
  this.listeners = /* @__PURE__ */ new Map();
230
231
  }
231
232
  // ---- reactive system ----
@@ -255,6 +256,14 @@ var MeetingState = class {
255
256
  this.activeSpeakerIds = next;
256
257
  this.notify("activeSpeakers");
257
258
  }
259
+ setRecording(recording) {
260
+ this.recording = recording;
261
+ this.notify("recording");
262
+ }
263
+ clearRecording() {
264
+ this.recording = null;
265
+ this.notify("recording");
266
+ }
258
267
  // ---- participants ----
259
268
  addParticipant(p) {
260
269
  if (this.participants.has(p.id)) return false;
@@ -793,7 +802,12 @@ var SFUClient = class {
793
802
  room_code: this.room,
794
803
  resume_token: this.resumeToken,
795
804
  display_name: this.joinOptions.displayName,
796
- avatar_url: this.joinOptions.avatarUrl
805
+ avatar_url: this.joinOptions.avatarUrl,
806
+ // Preserve the media state requested before host approval.
807
+ // The approval continuation is a second JOIN, so these values
808
+ // must be sent again instead of falling back to the SFU defaults.
809
+ audio_muted: this.desiredAudioMuted,
810
+ video_muted: this.desiredVideoMuted
797
811
  }
798
812
  });
799
813
  }
@@ -1058,10 +1072,7 @@ var SFUClient = class {
1058
1072
  source: normalizedSource
1059
1073
  };
1060
1074
  this.trackMetadata.set(normalized.track_id, normalized);
1061
- this.trackToParticipant.set(
1062
- normalized.track_id,
1063
- normalized.participant_id
1064
- );
1075
+ this.trackToParticipant.set(normalized.track_id, normalized.participant_id);
1065
1076
  if (normalizedSource) {
1066
1077
  this.trackToSource.set(normalized.track_id, normalizedSource);
1067
1078
  } else {
@@ -2376,9 +2387,22 @@ var VideoSDKCore = class {
2376
2387
  },
2377
2388
  // RECORDING
2378
2389
  onRecordingStarted: (recording) => {
2390
+ this.state.setRecording({
2391
+ recording_id: recording.recording_id,
2392
+ started_at: recording.started_at,
2393
+ status: "recording",
2394
+ active: true,
2395
+ late_join: true
2396
+ });
2379
2397
  this.events.onRecordingStarted?.(recording);
2380
2398
  },
2381
2399
  onRecordingStopped: (recording) => {
2400
+ this.state.setRecording({
2401
+ recording_id: recording.recording_id,
2402
+ stopped_at: recording.stopped_at,
2403
+ status: "stopped",
2404
+ active: false
2405
+ });
2382
2406
  this.events.onRecordingStopped?.(recording);
2383
2407
  },
2384
2408
  // REMOTE MEDIA
@@ -2813,11 +2837,11 @@ var MeetingProvider = ({
2813
2837
  onTrackStateChanged: (track) => {
2814
2838
  trackStateListeners.current.forEach((fn) => fn(track));
2815
2839
  },
2816
- onRecordingStarted: (recording) => {
2817
- recordingStartedListeners.current.forEach((fn) => fn(recording));
2840
+ onRecordingStarted: (recording2) => {
2841
+ recordingStartedListeners.current.forEach((fn) => fn(recording2));
2818
2842
  },
2819
- onRecordingStopped: (recording) => {
2820
- recordingStoppedListeners.current.forEach((fn) => fn(recording));
2843
+ onRecordingStopped: (recording2) => {
2844
+ recordingStoppedListeners.current.forEach((fn) => fn(recording2));
2821
2845
  },
2822
2846
  onReaction: (reaction) => {
2823
2847
  reactionListeners.current.forEach((fn) => fn(reaction));
@@ -2831,6 +2855,7 @@ var MeetingProvider = ({
2831
2855
  "activeSpeakers",
2832
2856
  (s) => Array.from(s.activeSpeakerIds)
2833
2857
  );
2858
+ const recording = useMeetingStore(sdk.state, "recording", (s) => s.recording);
2834
2859
  const presenterId = useMeetingStore(
2835
2860
  sdk.state,
2836
2861
  "presenter",
@@ -2874,6 +2899,7 @@ var MeetingProvider = ({
2874
2899
  messages,
2875
2900
  presenterId,
2876
2901
  activeSpeakerIds,
2902
+ recording,
2877
2903
  usePubSub: (topic) => {
2878
2904
  if (topic !== "SECURE_CHAT") {
2879
2905
  throw new Error(`Unsupported PubSub argument: "${topic}"`);
@@ -2935,7 +2961,16 @@ var MeetingProvider = ({
2935
2961
  };
2936
2962
  }
2937
2963
  };
2938
- }, [config, sdk, localParticipant, participants, messages, presenterId]);
2964
+ }, [
2965
+ config,
2966
+ sdk,
2967
+ localParticipant,
2968
+ participants,
2969
+ messages,
2970
+ presenterId,
2971
+ recording,
2972
+ activeSpeakerIds
2973
+ ]);
2939
2974
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MeetingContext.Provider, { value, children });
2940
2975
  };
2941
2976
  var useMeetingContext = () => {