@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.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;
@@ -2378,9 +2387,22 @@ var VideoSDKCore = class {
2378
2387
  },
2379
2388
  // RECORDING
2380
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
+ });
2381
2397
  this.events.onRecordingStarted?.(recording);
2382
2398
  },
2383
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
+ });
2384
2406
  this.events.onRecordingStopped?.(recording);
2385
2407
  },
2386
2408
  // REMOTE MEDIA
@@ -2815,11 +2837,11 @@ var MeetingProvider = ({
2815
2837
  onTrackStateChanged: (track) => {
2816
2838
  trackStateListeners.current.forEach((fn) => fn(track));
2817
2839
  },
2818
- onRecordingStarted: (recording) => {
2819
- recordingStartedListeners.current.forEach((fn) => fn(recording));
2840
+ onRecordingStarted: (recording2) => {
2841
+ recordingStartedListeners.current.forEach((fn) => fn(recording2));
2820
2842
  },
2821
- onRecordingStopped: (recording) => {
2822
- recordingStoppedListeners.current.forEach((fn) => fn(recording));
2843
+ onRecordingStopped: (recording2) => {
2844
+ recordingStoppedListeners.current.forEach((fn) => fn(recording2));
2823
2845
  },
2824
2846
  onReaction: (reaction) => {
2825
2847
  reactionListeners.current.forEach((fn) => fn(reaction));
@@ -2833,6 +2855,7 @@ var MeetingProvider = ({
2833
2855
  "activeSpeakers",
2834
2856
  (s) => Array.from(s.activeSpeakerIds)
2835
2857
  );
2858
+ const recording = useMeetingStore(sdk.state, "recording", (s) => s.recording);
2836
2859
  const presenterId = useMeetingStore(
2837
2860
  sdk.state,
2838
2861
  "presenter",
@@ -2876,6 +2899,7 @@ var MeetingProvider = ({
2876
2899
  messages,
2877
2900
  presenterId,
2878
2901
  activeSpeakerIds,
2902
+ recording,
2879
2903
  usePubSub: (topic) => {
2880
2904
  if (topic !== "SECURE_CHAT") {
2881
2905
  throw new Error(`Unsupported PubSub argument: "${topic}"`);
@@ -2937,7 +2961,16 @@ var MeetingProvider = ({
2937
2961
  };
2938
2962
  }
2939
2963
  };
2940
- }, [config, sdk, localParticipant, participants, messages, presenterId]);
2964
+ }, [
2965
+ config,
2966
+ sdk,
2967
+ localParticipant,
2968
+ participants,
2969
+ messages,
2970
+ presenterId,
2971
+ recording,
2972
+ activeSpeakerIds
2973
+ ]);
2941
2974
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MeetingContext.Provider, { value, children });
2942
2975
  };
2943
2976
  var useMeetingContext = () => {