@whereby.com/media 9.6.0 → 9.6.1

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
@@ -4486,6 +4486,13 @@ class VegaRtcManager {
4486
4486
  });
4487
4487
  this._networkIsDetectedUpBySignal = false;
4488
4488
  this._cpuOveruseDetected = false;
4489
+ this._sfuZombie = {
4490
+ offlineDetectedAt: null,
4491
+ onBrowserOffline: () => this._sfuZombieOnOffline(),
4492
+ };
4493
+ if (typeof window !== "undefined") {
4494
+ window.addEventListener("offline", this._sfuZombie.onBrowserOffline);
4495
+ }
4489
4496
  this.analytics = {
4490
4497
  vegaRequestTimeout: 0,
4491
4498
  vegaUnknownResponse: 0,
@@ -4509,6 +4516,9 @@ class VegaRtcManager {
4509
4516
  numIceConnected: 0,
4510
4517
  numIceDisconnected: 0,
4511
4518
  numIceFailed: 0,
4519
+ sfuMsFromOfflineToClose: 0,
4520
+ sfuOfflineWhileConnectedCount: 0,
4521
+ sfuOfflineToCloseCount: 0,
4512
4522
  };
4513
4523
  }
4514
4524
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }) {
@@ -4563,6 +4573,32 @@ class VegaRtcManager {
4563
4573
  (_a = this._vegaConnectionManager) === null || _a === void 0 ? void 0 : _a.networkIsPossiblyDown();
4564
4574
  }
4565
4575
  }
4576
+ _sfuZombieOnOffline() {
4577
+ var _a, _b, _c, _d;
4578
+ if (!this._isConnectingOrConnected || this._sfuZombie.offlineDetectedAt !== null) {
4579
+ return;
4580
+ }
4581
+ this._sfuZombie.offlineDetectedAt = Date.now();
4582
+ this.analytics.sfuOfflineWhileConnectedCount++;
4583
+ rtcStats.sendEvent("SfuOfflineWhileConnected", {
4584
+ sfuWsReadyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
4585
+ sendTransportState: (_c = this._sendTransport) === null || _c === void 0 ? void 0 : _c.connectionState,
4586
+ recvTransportState: (_d = this._receiveTransport) === null || _d === void 0 ? void 0 : _d.connectionState,
4587
+ });
4588
+ }
4589
+ _sfuZombieReset() {
4590
+ this._sfuZombie.offlineDetectedAt = null;
4591
+ }
4592
+ _sfuZombieOnClose() {
4593
+ let msFromOfflineToClose;
4594
+ if (this._reconnect && this._sfuZombie.offlineDetectedAt !== null) {
4595
+ msFromOfflineToClose = Date.now() - this._sfuZombie.offlineDetectedAt;
4596
+ this.analytics.sfuMsFromOfflineToClose += msFromOfflineToClose;
4597
+ this.analytics.sfuOfflineToCloseCount++;
4598
+ }
4599
+ this._sfuZombieReset();
4600
+ return msFromOfflineToClose;
4601
+ }
4566
4602
  setupSocketListeners() {
4567
4603
  this._socketListenerDeregisterFunctions.push(() => this._clearMediaServersRefresh(), this._serverSocket.on(PROTOCOL_RESPONSES.MEDIASERVER_CONFIG, (data) => {
4568
4604
  if (data.error) {
@@ -4659,7 +4695,8 @@ class VegaRtcManager {
4659
4695
  }
4660
4696
  this._qualityMonitor.close();
4661
4697
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
4662
- rtcStats.sendEvent("SfuConnectionClosed", {});
4698
+ const msFromOfflineToClose = this._sfuZombieOnClose();
4699
+ rtcStats.sendEvent("SfuConnectionClosed", { msFromOfflineToClose });
4663
4700
  }
4664
4701
  _join() {
4665
4702
  return __awaiter(this, void 0, void 0, function* () {
@@ -5639,6 +5676,10 @@ class VegaRtcManager {
5639
5676
  clearTimeout(this._reconnectTimeOut);
5640
5677
  this._reconnectTimeOut = null;
5641
5678
  }
5679
+ this._sfuZombieReset();
5680
+ if (typeof window !== "undefined") {
5681
+ window.removeEventListener("offline", this._sfuZombie.onBrowserOffline);
5682
+ }
5642
5683
  this._socketListenerDeregisterFunctions.forEach((func) => {
5643
5684
  func();
5644
5685
  });
package/dist/index.d.cts CHANGED
@@ -449,6 +449,9 @@ type VegaAnalytics = {
449
449
  numIceConnected: number;
450
450
  numIceDisconnected: number;
451
451
  numIceFailed: number;
452
+ sfuMsFromOfflineToClose: number;
453
+ sfuOfflineWhileConnectedCount: number;
454
+ sfuOfflineToCloseCount: number;
452
455
  };
453
456
 
454
457
  type VegaAnalyticMetric = keyof VegaAnalytics;
@@ -2025,12 +2028,19 @@ declare class VegaRtcManager implements RtcManager {
2025
2028
  _vegaConnectionManager?: ReturnType<typeof createVegaConnectionManager>;
2026
2029
  _networkIsDetectedUpBySignal: boolean;
2027
2030
  _cpuOveruseDetected: boolean;
2031
+ _sfuZombie: {
2032
+ offlineDetectedAt: number | null;
2033
+ onBrowserOffline: any;
2034
+ };
2028
2035
  analytics: VegaAnalytics;
2029
2036
  constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim }: VegaRtcManagerOptions);
2030
2037
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }: SignalMediaServerConfig): void;
2031
2038
  _clearMediaServersRefresh(): void;
2032
2039
  _onNetworkIsDetectedUpBySignal(): void;
2033
2040
  _onNetworkIsDetectedPossiblyDownBySignal(): void;
2041
+ _sfuZombieOnOffline(): void;
2042
+ _sfuZombieReset(): void;
2043
+ _sfuZombieOnClose(): number | undefined;
2034
2044
  setupSocketListeners(): void;
2035
2045
  _emitScreenshareStarted(): void;
2036
2046
  _connect(): void;
package/dist/index.d.mts CHANGED
@@ -449,6 +449,9 @@ type VegaAnalytics = {
449
449
  numIceConnected: number;
450
450
  numIceDisconnected: number;
451
451
  numIceFailed: number;
452
+ sfuMsFromOfflineToClose: number;
453
+ sfuOfflineWhileConnectedCount: number;
454
+ sfuOfflineToCloseCount: number;
452
455
  };
453
456
 
454
457
  type VegaAnalyticMetric = keyof VegaAnalytics;
@@ -2025,12 +2028,19 @@ declare class VegaRtcManager implements RtcManager {
2025
2028
  _vegaConnectionManager?: ReturnType<typeof createVegaConnectionManager>;
2026
2029
  _networkIsDetectedUpBySignal: boolean;
2027
2030
  _cpuOveruseDetected: boolean;
2031
+ _sfuZombie: {
2032
+ offlineDetectedAt: number | null;
2033
+ onBrowserOffline: any;
2034
+ };
2028
2035
  analytics: VegaAnalytics;
2029
2036
  constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim }: VegaRtcManagerOptions);
2030
2037
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }: SignalMediaServerConfig): void;
2031
2038
  _clearMediaServersRefresh(): void;
2032
2039
  _onNetworkIsDetectedUpBySignal(): void;
2033
2040
  _onNetworkIsDetectedPossiblyDownBySignal(): void;
2041
+ _sfuZombieOnOffline(): void;
2042
+ _sfuZombieReset(): void;
2043
+ _sfuZombieOnClose(): number | undefined;
2034
2044
  setupSocketListeners(): void;
2035
2045
  _emitScreenshareStarted(): void;
2036
2046
  _connect(): void;
package/dist/index.d.ts CHANGED
@@ -449,6 +449,9 @@ type VegaAnalytics = {
449
449
  numIceConnected: number;
450
450
  numIceDisconnected: number;
451
451
  numIceFailed: number;
452
+ sfuMsFromOfflineToClose: number;
453
+ sfuOfflineWhileConnectedCount: number;
454
+ sfuOfflineToCloseCount: number;
452
455
  };
453
456
 
454
457
  type VegaAnalyticMetric = keyof VegaAnalytics;
@@ -2025,12 +2028,19 @@ declare class VegaRtcManager implements RtcManager {
2025
2028
  _vegaConnectionManager?: ReturnType<typeof createVegaConnectionManager>;
2026
2029
  _networkIsDetectedUpBySignal: boolean;
2027
2030
  _cpuOveruseDetected: boolean;
2031
+ _sfuZombie: {
2032
+ offlineDetectedAt: number | null;
2033
+ onBrowserOffline: any;
2034
+ };
2028
2035
  analytics: VegaAnalytics;
2029
2036
  constructor({ selfId, room, emitter, serverSocket, webrtcProvider, features, eventClaim }: VegaRtcManagerOptions);
2030
2037
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }: SignalMediaServerConfig): void;
2031
2038
  _clearMediaServersRefresh(): void;
2032
2039
  _onNetworkIsDetectedUpBySignal(): void;
2033
2040
  _onNetworkIsDetectedPossiblyDownBySignal(): void;
2041
+ _sfuZombieOnOffline(): void;
2042
+ _sfuZombieReset(): void;
2043
+ _sfuZombieOnClose(): number | undefined;
2034
2044
  setupSocketListeners(): void;
2035
2045
  _emitScreenshareStarted(): void;
2036
2046
  _connect(): void;
package/dist/index.mjs CHANGED
@@ -4466,6 +4466,13 @@ class VegaRtcManager {
4466
4466
  });
4467
4467
  this._networkIsDetectedUpBySignal = false;
4468
4468
  this._cpuOveruseDetected = false;
4469
+ this._sfuZombie = {
4470
+ offlineDetectedAt: null,
4471
+ onBrowserOffline: () => this._sfuZombieOnOffline(),
4472
+ };
4473
+ if (typeof window !== "undefined") {
4474
+ window.addEventListener("offline", this._sfuZombie.onBrowserOffline);
4475
+ }
4469
4476
  this.analytics = {
4470
4477
  vegaRequestTimeout: 0,
4471
4478
  vegaUnknownResponse: 0,
@@ -4489,6 +4496,9 @@ class VegaRtcManager {
4489
4496
  numIceConnected: 0,
4490
4497
  numIceDisconnected: 0,
4491
4498
  numIceFailed: 0,
4499
+ sfuMsFromOfflineToClose: 0,
4500
+ sfuOfflineWhileConnectedCount: 0,
4501
+ sfuOfflineToCloseCount: 0,
4492
4502
  };
4493
4503
  }
4494
4504
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }) {
@@ -4543,6 +4553,32 @@ class VegaRtcManager {
4543
4553
  (_a = this._vegaConnectionManager) === null || _a === void 0 ? void 0 : _a.networkIsPossiblyDown();
4544
4554
  }
4545
4555
  }
4556
+ _sfuZombieOnOffline() {
4557
+ var _a, _b, _c, _d;
4558
+ if (!this._isConnectingOrConnected || this._sfuZombie.offlineDetectedAt !== null) {
4559
+ return;
4560
+ }
4561
+ this._sfuZombie.offlineDetectedAt = Date.now();
4562
+ this.analytics.sfuOfflineWhileConnectedCount++;
4563
+ rtcStats.sendEvent("SfuOfflineWhileConnected", {
4564
+ sfuWsReadyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
4565
+ sendTransportState: (_c = this._sendTransport) === null || _c === void 0 ? void 0 : _c.connectionState,
4566
+ recvTransportState: (_d = this._receiveTransport) === null || _d === void 0 ? void 0 : _d.connectionState,
4567
+ });
4568
+ }
4569
+ _sfuZombieReset() {
4570
+ this._sfuZombie.offlineDetectedAt = null;
4571
+ }
4572
+ _sfuZombieOnClose() {
4573
+ let msFromOfflineToClose;
4574
+ if (this._reconnect && this._sfuZombie.offlineDetectedAt !== null) {
4575
+ msFromOfflineToClose = Date.now() - this._sfuZombie.offlineDetectedAt;
4576
+ this.analytics.sfuMsFromOfflineToClose += msFromOfflineToClose;
4577
+ this.analytics.sfuOfflineToCloseCount++;
4578
+ }
4579
+ this._sfuZombieReset();
4580
+ return msFromOfflineToClose;
4581
+ }
4546
4582
  setupSocketListeners() {
4547
4583
  this._socketListenerDeregisterFunctions.push(() => this._clearMediaServersRefresh(), this._serverSocket.on(PROTOCOL_RESPONSES.MEDIASERVER_CONFIG, (data) => {
4548
4584
  if (data.error) {
@@ -4639,7 +4675,8 @@ class VegaRtcManager {
4639
4675
  }
4640
4676
  this._qualityMonitor.close();
4641
4677
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
4642
- rtcStats.sendEvent("SfuConnectionClosed", {});
4678
+ const msFromOfflineToClose = this._sfuZombieOnClose();
4679
+ rtcStats.sendEvent("SfuConnectionClosed", { msFromOfflineToClose });
4643
4680
  }
4644
4681
  _join() {
4645
4682
  return __awaiter(this, void 0, void 0, function* () {
@@ -5619,6 +5656,10 @@ class VegaRtcManager {
5619
5656
  clearTimeout(this._reconnectTimeOut);
5620
5657
  this._reconnectTimeOut = null;
5621
5658
  }
5659
+ this._sfuZombieReset();
5660
+ if (typeof window !== "undefined") {
5661
+ window.removeEventListener("offline", this._sfuZombie.onBrowserOffline);
5662
+ }
5622
5663
  this._socketListenerDeregisterFunctions.forEach((func) => {
5623
5664
  func();
5624
5665
  });
@@ -4466,6 +4466,13 @@ class VegaRtcManager {
4466
4466
  });
4467
4467
  this._networkIsDetectedUpBySignal = false;
4468
4468
  this._cpuOveruseDetected = false;
4469
+ this._sfuZombie = {
4470
+ offlineDetectedAt: null,
4471
+ onBrowserOffline: () => this._sfuZombieOnOffline(),
4472
+ };
4473
+ if (typeof window !== "undefined") {
4474
+ window.addEventListener("offline", this._sfuZombie.onBrowserOffline);
4475
+ }
4469
4476
  this.analytics = {
4470
4477
  vegaRequestTimeout: 0,
4471
4478
  vegaUnknownResponse: 0,
@@ -4489,6 +4496,9 @@ class VegaRtcManager {
4489
4496
  numIceConnected: 0,
4490
4497
  numIceDisconnected: 0,
4491
4498
  numIceFailed: 0,
4499
+ sfuMsFromOfflineToClose: 0,
4500
+ sfuOfflineWhileConnectedCount: 0,
4501
+ sfuOfflineToCloseCount: 0,
4492
4502
  };
4493
4503
  }
4494
4504
  _updateAndScheduleMediaServersRefresh({ iceServers, turnServers, sfuServer, mediaserverConfigTtlSeconds, }) {
@@ -4543,6 +4553,32 @@ class VegaRtcManager {
4543
4553
  (_a = this._vegaConnectionManager) === null || _a === void 0 ? void 0 : _a.networkIsPossiblyDown();
4544
4554
  }
4545
4555
  }
4556
+ _sfuZombieOnOffline() {
4557
+ var _a, _b, _c, _d;
4558
+ if (!this._isConnectingOrConnected || this._sfuZombie.offlineDetectedAt !== null) {
4559
+ return;
4560
+ }
4561
+ this._sfuZombie.offlineDetectedAt = Date.now();
4562
+ this.analytics.sfuOfflineWhileConnectedCount++;
4563
+ rtcStats.sendEvent("SfuOfflineWhileConnected", {
4564
+ sfuWsReadyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
4565
+ sendTransportState: (_c = this._sendTransport) === null || _c === void 0 ? void 0 : _c.connectionState,
4566
+ recvTransportState: (_d = this._receiveTransport) === null || _d === void 0 ? void 0 : _d.connectionState,
4567
+ });
4568
+ }
4569
+ _sfuZombieReset() {
4570
+ this._sfuZombie.offlineDetectedAt = null;
4571
+ }
4572
+ _sfuZombieOnClose() {
4573
+ let msFromOfflineToClose;
4574
+ if (this._reconnect && this._sfuZombie.offlineDetectedAt !== null) {
4575
+ msFromOfflineToClose = Date.now() - this._sfuZombie.offlineDetectedAt;
4576
+ this.analytics.sfuMsFromOfflineToClose += msFromOfflineToClose;
4577
+ this.analytics.sfuOfflineToCloseCount++;
4578
+ }
4579
+ this._sfuZombieReset();
4580
+ return msFromOfflineToClose;
4581
+ }
4546
4582
  setupSocketListeners() {
4547
4583
  this._socketListenerDeregisterFunctions.push(() => this._clearMediaServersRefresh(), this._serverSocket.on(PROTOCOL_RESPONSES.MEDIASERVER_CONFIG, (data) => {
4548
4584
  if (data.error) {
@@ -4639,7 +4675,8 @@ class VegaRtcManager {
4639
4675
  }
4640
4676
  this._qualityMonitor.close();
4641
4677
  this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
4642
- rtcStats.sendEvent("SfuConnectionClosed", {});
4678
+ const msFromOfflineToClose = this._sfuZombieOnClose();
4679
+ rtcStats.sendEvent("SfuConnectionClosed", { msFromOfflineToClose });
4643
4680
  }
4644
4681
  _join() {
4645
4682
  return __awaiter(this, void 0, void 0, function* () {
@@ -5619,6 +5656,10 @@ class VegaRtcManager {
5619
5656
  clearTimeout(this._reconnectTimeOut);
5620
5657
  this._reconnectTimeOut = null;
5621
5658
  }
5659
+ this._sfuZombieReset();
5660
+ if (typeof window !== "undefined") {
5661
+ window.removeEventListener("offline", this._sfuZombie.onBrowserOffline);
5662
+ }
5622
5663
  this._socketListenerDeregisterFunctions.forEach((func) => {
5623
5664
  func();
5624
5665
  });
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.6.0",
4
+ "version": "9.6.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {