@defcomm/meetingsdk 0.3.0 → 0.3.2

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
@@ -1326,11 +1326,14 @@ var SFUClient = class {
1326
1326
  sdp: answer.sdp
1327
1327
  }
1328
1328
  });
1329
- const waiters = this.subscriptionWaiters.splice(0);
1330
- waiters.forEach((w) => w.resolve());
1329
+ const waiter = this.subscriptionWaiters.shift();
1330
+ waiter?.resolve();
1331
1331
  } catch (error) {
1332
- const waiters = this.subscriptionWaiters.splice(0);
1333
- waiters.forEach((w) => w.reject(error));
1332
+ const waiter = this.subscriptionWaiters.shift();
1333
+ if (waiter) {
1334
+ waiter.trackIds.forEach((id) => this.subscribedTracks.delete(id));
1335
+ waiter.reject(error);
1336
+ }
1334
1337
  this.onError(
1335
1338
  new Error(`Failed to process subscriber offer: ${String(error)}`)
1336
1339
  );
@@ -1352,11 +1355,20 @@ var SFUClient = class {
1352
1355
  if (!uniqueIds.length || !this.isSocketOpen()) return;
1353
1356
  uniqueIds.forEach((id) => this.subscribedTracks.add(id));
1354
1357
  return new Promise((resolve, reject) => {
1355
- this.subscriptionWaiters.push({ resolve, reject });
1356
- this.send({
1358
+ const sent = this.send({
1357
1359
  type: "subscribe",
1358
1360
  payload: { track_ids: uniqueIds }
1359
1361
  });
1362
+ if (!sent) {
1363
+ uniqueIds.forEach((id) => this.subscribedTracks.delete(id));
1364
+ reject(new Error("Signaling socket is not open"));
1365
+ return;
1366
+ }
1367
+ this.subscriptionWaiters.push({
1368
+ trackIds: uniqueIds,
1369
+ resolve,
1370
+ reject
1371
+ });
1360
1372
  });
1361
1373
  }
1362
1374
  async processSubscriptionQueue() {
@@ -1369,11 +1381,20 @@ var SFUClient = class {
1369
1381
  continue;
1370
1382
  }
1371
1383
  await new Promise((resolve, reject) => {
1372
- this.subscriptionWaiters.push({ resolve, reject });
1373
- this.send({
1384
+ const sent = this.send({
1374
1385
  type: "subscribe",
1375
1386
  payload: { track_ids: [trackId] }
1376
1387
  });
1388
+ if (!sent) {
1389
+ this.subscribedTracks.delete(trackId);
1390
+ reject(new Error("Signaling socket is not open"));
1391
+ return;
1392
+ }
1393
+ this.subscriptionWaiters.push({
1394
+ trackIds: [trackId],
1395
+ resolve,
1396
+ reject
1397
+ });
1377
1398
  });
1378
1399
  }
1379
1400
  } finally {
@@ -2374,7 +2395,9 @@ var VideoSDKCore = class {
2374
2395
  client.setLocalStream(this.localStream);
2375
2396
  await client.getToken(roomId, {
2376
2397
  displayName: name,
2377
- participantId: this.myId
2398
+ participantId: this.myId,
2399
+ audioMuted: this.state.localParticipant?.media?.micEnabled,
2400
+ videoMuted: this.state.localParticipant?.media?.camEnabled
2378
2401
  });
2379
2402
  }
2380
2403
  // SFU STATE