@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.js CHANGED
@@ -1362,11 +1362,14 @@ var SFUClient = class {
1362
1362
  sdp: answer.sdp
1363
1363
  }
1364
1364
  });
1365
- const waiters = this.subscriptionWaiters.splice(0);
1366
- waiters.forEach((w) => w.resolve());
1365
+ const waiter = this.subscriptionWaiters.shift();
1366
+ waiter?.resolve();
1367
1367
  } catch (error) {
1368
- const waiters = this.subscriptionWaiters.splice(0);
1369
- waiters.forEach((w) => w.reject(error));
1368
+ const waiter = this.subscriptionWaiters.shift();
1369
+ if (waiter) {
1370
+ waiter.trackIds.forEach((id) => this.subscribedTracks.delete(id));
1371
+ waiter.reject(error);
1372
+ }
1370
1373
  this.onError(
1371
1374
  new Error(`Failed to process subscriber offer: ${String(error)}`)
1372
1375
  );
@@ -1388,11 +1391,20 @@ var SFUClient = class {
1388
1391
  if (!uniqueIds.length || !this.isSocketOpen()) return;
1389
1392
  uniqueIds.forEach((id) => this.subscribedTracks.add(id));
1390
1393
  return new Promise((resolve, reject) => {
1391
- this.subscriptionWaiters.push({ resolve, reject });
1392
- this.send({
1394
+ const sent = this.send({
1393
1395
  type: "subscribe",
1394
1396
  payload: { track_ids: uniqueIds }
1395
1397
  });
1398
+ if (!sent) {
1399
+ uniqueIds.forEach((id) => this.subscribedTracks.delete(id));
1400
+ reject(new Error("Signaling socket is not open"));
1401
+ return;
1402
+ }
1403
+ this.subscriptionWaiters.push({
1404
+ trackIds: uniqueIds,
1405
+ resolve,
1406
+ reject
1407
+ });
1396
1408
  });
1397
1409
  }
1398
1410
  async processSubscriptionQueue() {
@@ -1405,11 +1417,20 @@ var SFUClient = class {
1405
1417
  continue;
1406
1418
  }
1407
1419
  await new Promise((resolve, reject) => {
1408
- this.subscriptionWaiters.push({ resolve, reject });
1409
- this.send({
1420
+ const sent = this.send({
1410
1421
  type: "subscribe",
1411
1422
  payload: { track_ids: [trackId] }
1412
1423
  });
1424
+ if (!sent) {
1425
+ this.subscribedTracks.delete(trackId);
1426
+ reject(new Error("Signaling socket is not open"));
1427
+ return;
1428
+ }
1429
+ this.subscriptionWaiters.push({
1430
+ trackIds: [trackId],
1431
+ resolve,
1432
+ reject
1433
+ });
1413
1434
  });
1414
1435
  }
1415
1436
  } finally {
@@ -2410,7 +2431,9 @@ var VideoSDKCore = class {
2410
2431
  client.setLocalStream(this.localStream);
2411
2432
  await client.getToken(roomId, {
2412
2433
  displayName: name,
2413
- participantId: this.myId
2434
+ participantId: this.myId,
2435
+ audioMuted: this.state.localParticipant?.media?.micEnabled,
2436
+ videoMuted: this.state.localParticipant?.media?.camEnabled
2414
2437
  });
2415
2438
  }
2416
2439
  // SFU STATE