@stream-io/video-client 1.16.3 → 1.16.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.16.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.16.3...@stream-io/video-client-1.16.4) (2025-02-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * ensure tracks are stopped when disposing a Publisher ([#1676](https://github.com/GetStream/stream-video-js/issues/1676)) ([948f672](https://github.com/GetStream/stream-video-js/commit/948f672243e1f2a0e9499184ee31db4bc88f9952))
11
+
5
12
  ## [1.16.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.16.2...@stream-io/video-client-1.16.3) (2025-02-06)
6
13
 
7
14
 
@@ -5203,15 +5203,6 @@ class BasePeerConnection {
5203
5203
  this.isIceRestarting = false;
5204
5204
  this.isDisposed = false;
5205
5205
  this.subscriptions = [];
5206
- /**
5207
- * Disposes the `RTCPeerConnection` instance.
5208
- */
5209
- this.dispose = () => {
5210
- this.onUnrecoverableError = undefined;
5211
- this.isDisposed = true;
5212
- this.detachEventHandlers();
5213
- this.pc.close();
5214
- };
5215
5206
  /**
5216
5207
  * Handles events synchronously.
5217
5208
  * Consecutive events are queued and executed one after the other.
@@ -5348,6 +5339,15 @@ class BasePeerConnection {
5348
5339
  this.pc.addEventListener('icegatheringstatechange', this.onIceGatherChange);
5349
5340
  this.pc.addEventListener('signalingstatechange', this.onSignalingChange);
5350
5341
  }
5342
+ /**
5343
+ * Disposes the `RTCPeerConnection` instance.
5344
+ */
5345
+ dispose() {
5346
+ this.onUnrecoverableError = undefined;
5347
+ this.isDisposed = true;
5348
+ this.detachEventHandlers();
5349
+ this.pc.close();
5350
+ }
5351
5351
  /**
5352
5352
  * Detaches the event handlers from the `RTCPeerConnection`.
5353
5353
  */
@@ -5708,7 +5708,9 @@ class Publisher extends BasePeerConnection {
5708
5708
  this.addTransceiver(trackToPublish, publishOption);
5709
5709
  }
5710
5710
  else {
5711
+ const previousTrack = transceiver.sender.track;
5711
5712
  await transceiver.sender.replaceTrack(trackToPublish);
5713
+ previousTrack?.stop();
5712
5714
  }
5713
5715
  }
5714
5716
  };
@@ -5800,6 +5802,14 @@ class Publisher extends BasePeerConnection {
5800
5802
  transceiver.sender.track?.stop();
5801
5803
  }
5802
5804
  };
5805
+ /**
5806
+ * Stops all the cloned tracks that are being published to the SFU.
5807
+ */
5808
+ this.stopAllTracks = () => {
5809
+ for (const { transceiver } of this.transceiverCache.items()) {
5810
+ transceiver.sender.track?.stop();
5811
+ }
5812
+ };
5803
5813
  this.changePublishQuality = async (videoSender) => {
5804
5814
  const { trackType, layers, publishOptionId } = videoSender;
5805
5815
  const enabledLayers = layers.filter((l) => l.active);
@@ -6008,6 +6018,13 @@ class Publisher extends BasePeerConnection {
6008
6018
  // abort any ongoing negotiation
6009
6019
  withCancellation('publisher.negotiate', () => Promise.resolve());
6010
6020
  }
6021
+ /**
6022
+ * Disposes this Publisher instance.
6023
+ */
6024
+ dispose() {
6025
+ super.dispose();
6026
+ this.stopAllTracks();
6027
+ }
6011
6028
  }
6012
6029
 
6013
6030
  /**
@@ -7431,7 +7448,7 @@ const aggregate = (stats) => {
7431
7448
  return report;
7432
7449
  };
7433
7450
 
7434
- const version = "1.16.3";
7451
+ const version = "1.16.4";
7435
7452
  const [major, minor, patch] = version.split('.');
7436
7453
  let sdkInfo = {
7437
7454
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -13039,7 +13056,7 @@ class StreamClient {
13039
13056
  return await this.wsConnection.connect(this.defaultWSTimeout);
13040
13057
  };
13041
13058
  this.getUserAgent = () => {
13042
- const version = "1.16.3";
13059
+ const version = "1.16.4";
13043
13060
  return (this.userAgent ||
13044
13061
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
13045
13062
  };