@whereby.com/media 9.2.1 → 9.2.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.cjs CHANGED
@@ -4345,7 +4345,7 @@ function createVegaConnectionManager(config) {
4345
4345
  }, timeToWaitForEarlyServerClose);
4346
4346
  });
4347
4347
  vegaConnection.on("close", () => {
4348
- var _a;
4348
+ var _a, _b;
4349
4349
  wasClosed = true;
4350
4350
  if (vegaConnection === nominatedConnection) {
4351
4351
  nominatedConnection = undefined;
@@ -4353,6 +4353,9 @@ function createVegaConnectionManager(config) {
4353
4353
  hasNotifiedDisconnect = true;
4354
4354
  (_a = config.onDisconnected) === null || _a === void 0 ? void 0 : _a.call(config);
4355
4355
  }
4356
+ else {
4357
+ (_b = config.onAttemptFailed) === null || _b === void 0 ? void 0 : _b.call(config, { host, dc });
4358
+ }
4356
4359
  handleFailedOrAbortedConnection();
4357
4360
  });
4358
4361
  }, timeBeforeConnect));
@@ -4558,9 +4561,14 @@ class VegaRtcManager {
4558
4561
  });
4559
4562
  }
4560
4563
  _connect() {
4561
- var _a;
4562
- if (this._isConnectingOrConnected)
4564
+ var _a, _b, _c, _d, _e;
4565
+ if (this._isConnectingOrConnected) {
4566
+ rtcStats.sendEvent("SfuConnectEarlyBail", {
4567
+ readyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
4568
+ bufferedAmount: (_d = (_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.socket) === null || _d === void 0 ? void 0 : _d.bufferedAmount,
4569
+ });
4563
4570
  return;
4571
+ }
4564
4572
  if (!this._serverSocket.isConnected()) {
4565
4573
  const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
4566
4574
  if (!reconnectThresholdInMs)
@@ -4574,7 +4582,7 @@ class VegaRtcManager {
4574
4582
  const hostList = this._features.sfuServersOverride ||
4575
4583
  this._sfuServers ||
4576
4584
  this._features.sfuServerOverrideHost ||
4577
- ((_a = this._sfuServer) === null || _a === void 0 ? void 0 : _a.url);
4585
+ ((_e = this._sfuServer) === null || _e === void 0 ? void 0 : _e.url);
4578
4586
  this._vegaConnectionManager = createVegaConnectionManager({
4579
4587
  initialHostList: hostList,
4580
4588
  getUrlForHost: (host) => {
@@ -4601,6 +4609,9 @@ class VegaRtcManager {
4601
4609
  this._isConnectingOrConnected = false;
4602
4610
  this._onClose();
4603
4611
  },
4612
+ onAttemptFailed: ({ host, dc }) => {
4613
+ rtcStats.sendEvent("SfuConnectAttemptFailed", { host, dc });
4614
+ },
4604
4615
  });
4605
4616
  }
4606
4617
  this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
@@ -4620,12 +4631,14 @@ class VegaRtcManager {
4620
4631
  }
4621
4632
  this._qualityMonitor.close();
4622
4633
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
4634
+ rtcStats.sendEvent("SfuConnectionClosed", {});
4623
4635
  }
4624
4636
  _join() {
4625
4637
  return __awaiter(this, void 0, void 0, function* () {
4626
4638
  var _a, _b;
4627
4639
  logger$2.info("_join()");
4628
4640
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_OPEN);
4641
+ rtcStats.sendEvent("SfuConnectionOpened", {});
4629
4642
  try {
4630
4643
  if (!this._vegaConnection) {
4631
4644
  logger$2.error("_join() No VegaConnection found");
package/dist/index.d.cts CHANGED
@@ -1853,6 +1853,10 @@ declare function createVegaConnectionManager(config: {
1853
1853
  onConnected?: (vegaConnection: VegaConnection, info: ConnectionInfo) => void;
1854
1854
  onDisconnected?: () => void;
1855
1855
  onFailed?: () => void;
1856
+ onAttemptFailed?: (info: {
1857
+ host: string;
1858
+ dc: string;
1859
+ }) => void;
1856
1860
  }): {
1857
1861
  connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
1858
1862
  updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
package/dist/index.d.mts CHANGED
@@ -1853,6 +1853,10 @@ declare function createVegaConnectionManager(config: {
1853
1853
  onConnected?: (vegaConnection: VegaConnection, info: ConnectionInfo) => void;
1854
1854
  onDisconnected?: () => void;
1855
1855
  onFailed?: () => void;
1856
+ onAttemptFailed?: (info: {
1857
+ host: string;
1858
+ dc: string;
1859
+ }) => void;
1856
1860
  }): {
1857
1861
  connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
1858
1862
  updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
package/dist/index.d.ts CHANGED
@@ -1853,6 +1853,10 @@ declare function createVegaConnectionManager(config: {
1853
1853
  onConnected?: (vegaConnection: VegaConnection, info: ConnectionInfo) => void;
1854
1854
  onDisconnected?: () => void;
1855
1855
  onFailed?: () => void;
1856
+ onAttemptFailed?: (info: {
1857
+ host: string;
1858
+ dc: string;
1859
+ }) => void;
1856
1860
  }): {
1857
1861
  connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
1858
1862
  updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
package/dist/index.mjs CHANGED
@@ -4324,7 +4324,7 @@ function createVegaConnectionManager(config) {
4324
4324
  }, timeToWaitForEarlyServerClose);
4325
4325
  });
4326
4326
  vegaConnection.on("close", () => {
4327
- var _a;
4327
+ var _a, _b;
4328
4328
  wasClosed = true;
4329
4329
  if (vegaConnection === nominatedConnection) {
4330
4330
  nominatedConnection = undefined;
@@ -4332,6 +4332,9 @@ function createVegaConnectionManager(config) {
4332
4332
  hasNotifiedDisconnect = true;
4333
4333
  (_a = config.onDisconnected) === null || _a === void 0 ? void 0 : _a.call(config);
4334
4334
  }
4335
+ else {
4336
+ (_b = config.onAttemptFailed) === null || _b === void 0 ? void 0 : _b.call(config, { host, dc });
4337
+ }
4335
4338
  handleFailedOrAbortedConnection();
4336
4339
  });
4337
4340
  }, timeBeforeConnect));
@@ -4537,9 +4540,14 @@ class VegaRtcManager {
4537
4540
  });
4538
4541
  }
4539
4542
  _connect() {
4540
- var _a;
4541
- if (this._isConnectingOrConnected)
4543
+ var _a, _b, _c, _d, _e;
4544
+ if (this._isConnectingOrConnected) {
4545
+ rtcStats.sendEvent("SfuConnectEarlyBail", {
4546
+ readyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
4547
+ bufferedAmount: (_d = (_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.socket) === null || _d === void 0 ? void 0 : _d.bufferedAmount,
4548
+ });
4542
4549
  return;
4550
+ }
4543
4551
  if (!this._serverSocket.isConnected()) {
4544
4552
  const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
4545
4553
  if (!reconnectThresholdInMs)
@@ -4553,7 +4561,7 @@ class VegaRtcManager {
4553
4561
  const hostList = this._features.sfuServersOverride ||
4554
4562
  this._sfuServers ||
4555
4563
  this._features.sfuServerOverrideHost ||
4556
- ((_a = this._sfuServer) === null || _a === void 0 ? void 0 : _a.url);
4564
+ ((_e = this._sfuServer) === null || _e === void 0 ? void 0 : _e.url);
4557
4565
  this._vegaConnectionManager = createVegaConnectionManager({
4558
4566
  initialHostList: hostList,
4559
4567
  getUrlForHost: (host) => {
@@ -4580,6 +4588,9 @@ class VegaRtcManager {
4580
4588
  this._isConnectingOrConnected = false;
4581
4589
  this._onClose();
4582
4590
  },
4591
+ onAttemptFailed: ({ host, dc }) => {
4592
+ rtcStats.sendEvent("SfuConnectAttemptFailed", { host, dc });
4593
+ },
4583
4594
  });
4584
4595
  }
4585
4596
  this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
@@ -4599,12 +4610,14 @@ class VegaRtcManager {
4599
4610
  }
4600
4611
  this._qualityMonitor.close();
4601
4612
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
4613
+ rtcStats.sendEvent("SfuConnectionClosed", {});
4602
4614
  }
4603
4615
  _join() {
4604
4616
  return __awaiter(this, void 0, void 0, function* () {
4605
4617
  var _a, _b;
4606
4618
  logger$2.info("_join()");
4607
4619
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_OPEN);
4620
+ rtcStats.sendEvent("SfuConnectionOpened", {});
4608
4621
  try {
4609
4622
  if (!this._vegaConnection) {
4610
4623
  logger$2.error("_join() No VegaConnection found");
@@ -4324,7 +4324,7 @@ function createVegaConnectionManager(config) {
4324
4324
  }, timeToWaitForEarlyServerClose);
4325
4325
  });
4326
4326
  vegaConnection.on("close", () => {
4327
- var _a;
4327
+ var _a, _b;
4328
4328
  wasClosed = true;
4329
4329
  if (vegaConnection === nominatedConnection) {
4330
4330
  nominatedConnection = undefined;
@@ -4332,6 +4332,9 @@ function createVegaConnectionManager(config) {
4332
4332
  hasNotifiedDisconnect = true;
4333
4333
  (_a = config.onDisconnected) === null || _a === void 0 ? void 0 : _a.call(config);
4334
4334
  }
4335
+ else {
4336
+ (_b = config.onAttemptFailed) === null || _b === void 0 ? void 0 : _b.call(config, { host, dc });
4337
+ }
4335
4338
  handleFailedOrAbortedConnection();
4336
4339
  });
4337
4340
  }, timeBeforeConnect));
@@ -4537,9 +4540,14 @@ class VegaRtcManager {
4537
4540
  });
4538
4541
  }
4539
4542
  _connect() {
4540
- var _a;
4541
- if (this._isConnectingOrConnected)
4543
+ var _a, _b, _c, _d, _e;
4544
+ if (this._isConnectingOrConnected) {
4545
+ rtcStats.sendEvent("SfuConnectEarlyBail", {
4546
+ readyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
4547
+ bufferedAmount: (_d = (_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.socket) === null || _d === void 0 ? void 0 : _d.bufferedAmount,
4548
+ });
4542
4549
  return;
4550
+ }
4543
4551
  if (!this._serverSocket.isConnected()) {
4544
4552
  const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
4545
4553
  if (!reconnectThresholdInMs)
@@ -4553,7 +4561,7 @@ class VegaRtcManager {
4553
4561
  const hostList = this._features.sfuServersOverride ||
4554
4562
  this._sfuServers ||
4555
4563
  this._features.sfuServerOverrideHost ||
4556
- ((_a = this._sfuServer) === null || _a === void 0 ? void 0 : _a.url);
4564
+ ((_e = this._sfuServer) === null || _e === void 0 ? void 0 : _e.url);
4557
4565
  this._vegaConnectionManager = createVegaConnectionManager({
4558
4566
  initialHostList: hostList,
4559
4567
  getUrlForHost: (host) => {
@@ -4580,6 +4588,9 @@ class VegaRtcManager {
4580
4588
  this._isConnectingOrConnected = false;
4581
4589
  this._onClose();
4582
4590
  },
4591
+ onAttemptFailed: ({ host, dc }) => {
4592
+ rtcStats.sendEvent("SfuConnectAttemptFailed", { host, dc });
4593
+ },
4583
4594
  });
4584
4595
  }
4585
4596
  this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
@@ -4599,12 +4610,14 @@ class VegaRtcManager {
4599
4610
  }
4600
4611
  this._qualityMonitor.close();
4601
4612
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
4613
+ rtcStats.sendEvent("SfuConnectionClosed", {});
4602
4614
  }
4603
4615
  _join() {
4604
4616
  return __awaiter(this, void 0, void 0, function* () {
4605
4617
  var _a, _b;
4606
4618
  logger$2.info("_join()");
4607
4619
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_OPEN);
4620
+ rtcStats.sendEvent("SfuConnectionOpened", {});
4608
4621
  try {
4609
4622
  if (!this._vegaConnection) {
4610
4623
  logger$2.error("_join() No VegaConnection found");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whereby.com/media",
3
3
  "description": "Media library for Whereby",
4
- "version": "9.2.1",
4
+ "version": "9.2.2",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {