@defcomm/meetingsdk 0.5.3 → 0.5.4

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.js CHANGED
@@ -290,9 +290,9 @@ var MeetingState = class {
290
290
  cameraTrack: void 0,
291
291
  screenTrack: void 0,
292
292
  audioTrack: void 0,
293
- micEnabled: true,
294
- camEnabled: true,
295
- isScreenSharing: false,
293
+ micEnabled: p.media?.micEnabled ?? false,
294
+ camEnabled: p.media?.camEnabled ?? false,
295
+ isScreenSharing: p.media?.isScreenSharing ?? false,
296
296
  ...p.media,
297
297
  ...patch
298
298
  }
@@ -2271,10 +2271,24 @@ var VideoSDKCore = class {
2271
2271
  this.handleSFUState(state);
2272
2272
  },
2273
2273
  onConnected: (payload, resumed) => {
2274
- console.log(`[SFU] ${resumed ? "Resumed" : "Joined"} room`, payload);
2274
+ const local = (payload?.participants || []).find(
2275
+ (participant) => participant?.participant_id === this.myId
2276
+ );
2277
+ const permissions = local?.permissions ?? payload?.permissions ?? {};
2278
+ const isModerator = Boolean(permissions?.moderate);
2279
+ const isHost = Boolean(
2280
+ local?.is_host ?? local?.isHost ?? permissions?.host
2281
+ );
2275
2282
  this.state.updateLocalParticipant({
2276
2283
  id: this.myId,
2277
- name: this.participantName
2284
+ name: local?.user_metadata?.name,
2285
+ isHost,
2286
+ isModerator,
2287
+ permissions,
2288
+ media: {
2289
+ micEnabled: !Boolean(local?.audio_muted),
2290
+ camEnabled: !Boolean(local?.video_muted)
2291
+ }
2278
2292
  });
2279
2293
  },
2280
2294
  onDisconnected: () => {
@@ -2393,7 +2407,13 @@ var VideoSDKCore = class {
2393
2407
  onParticipantPermissionsChanged: (participantId, permissions) => {
2394
2408
  if (participantId === this.myId) {
2395
2409
  const current = this.state.localParticipant;
2396
- this.state.updateLocalParticipant({ id: this.myId, name: this.participantName, isHost: current?.isHost, isModerator: Boolean(permissions?.moderate), permissions });
2410
+ this.state.updateLocalParticipant({
2411
+ id: this.myId,
2412
+ name: this.participantName,
2413
+ isHost: current?.isHost,
2414
+ isModerator: Boolean(permissions?.moderate),
2415
+ permissions
2416
+ });
2397
2417
  }
2398
2418
  },
2399
2419
  onJoinRequested: (request) => {