@stream-io/video-client 1.16.4 → 1.16.5

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.5](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.16.4...@stream-io/video-client-1.16.5) (2025-02-10)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * ensure all tracks are stopped when disposing a Publisher ([#1677](https://github.com/GetStream/stream-video-js/issues/1677)) ([172d345](https://github.com/GetStream/stream-video-js/commit/172d345ceada2bf82df1aec604a2325947896c5c)), closes [#1676](https://github.com/GetStream/stream-video-js/issues/1676)
11
+
5
12
  ## [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
13
 
7
14
 
@@ -5684,6 +5684,7 @@ class Publisher extends BasePeerConnection {
5684
5684
  constructor({ publishOptions, ...baseOptions }) {
5685
5685
  super(PeerType.PUBLISHER_UNSPECIFIED, baseOptions);
5686
5686
  this.transceiverCache = new TransceiverCache();
5687
+ this.clonedTracks = new Set();
5687
5688
  /**
5688
5689
  * Starts publishing the given track of the given media stream.
5689
5690
  *
@@ -5702,7 +5703,7 @@ class Publisher extends BasePeerConnection {
5702
5703
  continue;
5703
5704
  // create a clone of the track as otherwise the same trackId will
5704
5705
  // appear in the SDP in multiple transceivers
5705
- const trackToPublish = track.clone();
5706
+ const trackToPublish = this.cloneTrack(track);
5706
5707
  const transceiver = this.transceiverCache.get(publishOption);
5707
5708
  if (!transceiver) {
5708
5709
  this.addTransceiver(trackToPublish, publishOption);
@@ -5710,7 +5711,7 @@ class Publisher extends BasePeerConnection {
5710
5711
  else {
5711
5712
  const previousTrack = transceiver.sender.track;
5712
5713
  await transceiver.sender.replaceTrack(trackToPublish);
5713
- previousTrack?.stop();
5714
+ this.stopTrack(previousTrack);
5714
5715
  }
5715
5716
  }
5716
5717
  };
@@ -5747,7 +5748,7 @@ class Publisher extends BasePeerConnection {
5747
5748
  continue;
5748
5749
  // take the track from the existing transceiver for the same track type,
5749
5750
  // clone it and publish it with the new publish options
5750
- const track = item.transceiver.sender.track.clone();
5751
+ const track = this.cloneTrack(item.transceiver.sender.track);
5751
5752
  this.addTransceiver(track, publishOption);
5752
5753
  }
5753
5754
  // stop publishing with options not required anymore -> [vp9]
@@ -5758,7 +5759,7 @@ class Publisher extends BasePeerConnection {
5758
5759
  if (hasPublishOption)
5759
5760
  continue;
5760
5761
  // it is safe to stop the track here, it is a clone
5761
- transceiver.sender.track?.stop();
5762
+ this.stopTrack(transceiver.sender.track);
5762
5763
  await transceiver.sender.replaceTrack(null);
5763
5764
  }
5764
5765
  };
@@ -5799,7 +5800,7 @@ class Publisher extends BasePeerConnection {
5799
5800
  const { publishOption, transceiver } = item;
5800
5801
  if (!trackTypes.includes(publishOption.trackType))
5801
5802
  continue;
5802
- transceiver.sender.track?.stop();
5803
+ this.stopTrack(transceiver.sender.track);
5803
5804
  }
5804
5805
  };
5805
5806
  /**
@@ -5807,7 +5808,10 @@ class Publisher extends BasePeerConnection {
5807
5808
  */
5808
5809
  this.stopAllTracks = () => {
5809
5810
  for (const { transceiver } of this.transceiverCache.items()) {
5810
- transceiver.sender.track?.stop();
5811
+ this.stopTrack(transceiver.sender.track);
5812
+ }
5813
+ for (const track of this.clonedTracks) {
5814
+ this.stopTrack(track);
5811
5815
  }
5812
5816
  };
5813
5817
  this.changePublishQuality = async (videoSender) => {
@@ -5987,6 +5991,17 @@ class Publisher extends BasePeerConnection {
5987
5991
  publishOptionId: publishOption.id,
5988
5992
  };
5989
5993
  };
5994
+ this.cloneTrack = (track) => {
5995
+ const clone = track.clone();
5996
+ this.clonedTracks.add(clone);
5997
+ return clone;
5998
+ };
5999
+ this.stopTrack = (track) => {
6000
+ if (!track)
6001
+ return;
6002
+ track.stop();
6003
+ this.clonedTracks.delete(track);
6004
+ };
5990
6005
  this.publishOptions = publishOptions;
5991
6006
  this.pc.addEventListener('negotiationneeded', this.onNegotiationNeeded);
5992
6007
  this.on('iceRestart', (iceRestart) => {
@@ -6024,6 +6039,7 @@ class Publisher extends BasePeerConnection {
6024
6039
  dispose() {
6025
6040
  super.dispose();
6026
6041
  this.stopAllTracks();
6042
+ this.clonedTracks.clear();
6027
6043
  }
6028
6044
  }
6029
6045
 
@@ -7448,7 +7464,7 @@ const aggregate = (stats) => {
7448
7464
  return report;
7449
7465
  };
7450
7466
 
7451
- const version = "1.16.4";
7467
+ const version = "1.16.5";
7452
7468
  const [major, minor, patch] = version.split('.');
7453
7469
  let sdkInfo = {
7454
7470
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -13056,7 +13072,7 @@ class StreamClient {
13056
13072
  return await this.wsConnection.connect(this.defaultWSTimeout);
13057
13073
  };
13058
13074
  this.getUserAgent = () => {
13059
- const version = "1.16.4";
13075
+ const version = "1.16.5";
13060
13076
  return (this.userAgent ||
13061
13077
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
13062
13078
  };