@stream-io/video-client 1.8.1 → 1.8.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/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.8.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.8.1...@stream-io/video-client-1.8.2) (2024-10-10)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add track release for react-native whenever track stop is called ([#1516](https://github.com/GetStream/stream-video-js/issues/1516)) ([5074510](https://github.com/GetStream/stream-video-js/commit/50745101d28d0339592c22ca02b076040ad3bdeb))
11
+
5
12
  ## [1.8.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.8.0...@stream-io/video-client-1.8.1) (2024-10-10)
6
13
 
7
14
 
@@ -3020,7 +3020,7 @@ const retryable = async (rpc, signal) => {
3020
3020
  return result;
3021
3021
  };
3022
3022
 
3023
- const version = "1.8.1";
3023
+ const version = "1.8.2";
3024
3024
  const [major, minor, patch] = version.split('.');
3025
3025
  let sdkInfo = {
3026
3026
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -5237,6 +5237,11 @@ class Publisher {
5237
5237
  if (previousTrack && previousTrack !== track) {
5238
5238
  previousTrack.stop();
5239
5239
  previousTrack.removeEventListener('ended', handleTrackEnded);
5240
+ // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
5241
+ if (typeof previousTrack.release === 'function') {
5242
+ // @ts-expect-error
5243
+ track.release();
5244
+ }
5240
5245
  track.addEventListener('ended', handleTrackEnded);
5241
5246
  }
5242
5247
  if (!track.enabled) {
@@ -5256,14 +5261,19 @@ class Publisher {
5256
5261
  const transceiver = this.pc
5257
5262
  .getTransceivers()
5258
5263
  .find((t) => t === this.transceiverRegistry[trackType] && t.sender.track);
5259
- if (transceiver &&
5260
- transceiver.sender.track &&
5261
- (stopTrack
5262
- ? transceiver.sender.track.readyState === 'live'
5263
- : transceiver.sender.track.enabled)) {
5264
- stopTrack
5265
- ? transceiver.sender.track.stop()
5266
- : (transceiver.sender.track.enabled = false);
5264
+ const track = transceiver?.sender.track;
5265
+ if (track && (stopTrack ? track.readyState === 'live' : track.enabled)) {
5266
+ if (stopTrack) {
5267
+ track.stop();
5268
+ // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
5269
+ if (typeof track.release === 'function') {
5270
+ // @ts-expect-error
5271
+ track.release();
5272
+ }
5273
+ }
5274
+ else {
5275
+ track.enabled = false;
5276
+ }
5267
5277
  // We don't need to notify SFU if unpublishing in response to remote soft mute
5268
5278
  if (this.state.localParticipant?.publishedTracks.includes(trackType)) {
5269
5279
  await this.notifyTrackMuteStateChanged(undefined, trackType, true);
@@ -5310,7 +5320,13 @@ class Publisher {
5310
5320
  this.stopPublishing = () => {
5311
5321
  this.logger('debug', 'Stopping publishing all tracks');
5312
5322
  this.pc.getSenders().forEach((s) => {
5313
- s.track?.stop();
5323
+ const track = s.track;
5324
+ track?.stop();
5325
+ // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
5326
+ if (typeof track?.release === 'function') {
5327
+ // @ts-expect-error
5328
+ track.release();
5329
+ }
5314
5330
  if (this.pc.signalingState !== 'closed') {
5315
5331
  this.pc.removeTrack(s);
5316
5332
  }
@@ -7939,6 +7955,11 @@ const disposeOfMediaStream = (stream) => {
7939
7955
  stream.getTracks().forEach((track) => {
7940
7956
  track.stop();
7941
7957
  stream.removeTrack(track);
7958
+ // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
7959
+ if (typeof track.release === 'function') {
7960
+ // @ts-expect-error
7961
+ track.release();
7962
+ }
7942
7963
  });
7943
7964
  // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the stream
7944
7965
  if (typeof stream.release === 'function') {
@@ -8158,8 +8179,14 @@ class InputMediaDeviceManager {
8158
8179
  }
8159
8180
  stopTracks() {
8160
8181
  this.getTracks().forEach((track) => {
8161
- if (track.readyState === 'live')
8182
+ if (track.readyState === 'live') {
8162
8183
  track.stop();
8184
+ // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
8185
+ if (typeof track.release === 'function') {
8186
+ // @ts-expect-error
8187
+ track.release();
8188
+ }
8189
+ }
8163
8190
  });
8164
8191
  }
8165
8192
  muteLocalStream(stopTracks) {
@@ -8800,7 +8827,14 @@ class RNSpeechDetector {
8800
8827
  if (!this.audioStream) {
8801
8828
  return;
8802
8829
  }
8803
- this.audioStream.getTracks().forEach((track) => track.stop());
8830
+ this.audioStream.getTracks().forEach((track) => {
8831
+ track.stop();
8832
+ // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the track
8833
+ if (typeof track.release === 'function') {
8834
+ // @ts-expect-error
8835
+ track.release();
8836
+ }
8837
+ });
8804
8838
  if (
8805
8839
  // @ts-expect-error release() is present in react-native-webrtc
8806
8840
  typeof this.audioStream.release === 'function') {
@@ -12470,7 +12504,7 @@ class StreamClient {
12470
12504
  });
12471
12505
  };
12472
12506
  this.getUserAgent = () => {
12473
- const version = "1.8.1";
12507
+ const version = "1.8.2";
12474
12508
  return (this.userAgent ||
12475
12509
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12476
12510
  };