@stream-io/video-client 1.8.0 → 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,20 @@
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
+
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)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * mic not fully released in some cases ([#1515](https://github.com/GetStream/stream-video-js/issues/1515)) ([b7bf90b](https://github.com/GetStream/stream-video-js/commit/b7bf90b9b1a83fb80d01a82ebee8754343963ae5))
18
+
5
19
  ## [1.8.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.7.4...@stream-io/video-client-1.8.0) (2024-10-02)
6
20
 
7
21
 
@@ -3020,7 +3020,7 @@ const retryable = async (rpc, signal) => {
3020
3020
  return result;
3021
3021
  };
3022
3022
 
3023
- const version = "1.8.0";
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
  }
@@ -6292,9 +6308,8 @@ const watchCallRejected = (call) => {
6292
6308
  const watchCallEnded = (call) => {
6293
6309
  return function onCallEnded() {
6294
6310
  const { callingState } = call.state;
6295
- if (callingState === CallingState.RINGING ||
6296
- callingState === CallingState.JOINED ||
6297
- callingState === CallingState.JOINING) {
6311
+ if (callingState !== CallingState.IDLE &&
6312
+ callingState !== CallingState.LEFT) {
6298
6313
  call.leave({ reason: 'call.ended event received' }).catch((err) => {
6299
6314
  call.logger('error', 'Failed to leave call after call.ended ', err);
6300
6315
  });
@@ -7940,6 +7955,11 @@ const disposeOfMediaStream = (stream) => {
7940
7955
  stream.getTracks().forEach((track) => {
7941
7956
  track.stop();
7942
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
+ }
7943
7963
  });
7944
7964
  // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the stream
7945
7965
  if (typeof stream.release === 'function') {
@@ -8159,8 +8179,14 @@ class InputMediaDeviceManager {
8159
8179
  }
8160
8180
  stopTracks() {
8161
8181
  this.getTracks().forEach((track) => {
8162
- if (track.readyState === 'live')
8182
+ if (track.readyState === 'live') {
8163
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
+ }
8164
8190
  });
8165
8191
  }
8166
8192
  muteLocalStream(stopTracks) {
@@ -8726,9 +8752,11 @@ class RNSpeechDetector {
8726
8752
  */
8727
8753
  async start() {
8728
8754
  try {
8755
+ this.cleanupAudioStream();
8729
8756
  const audioStream = await navigator.mediaDevices.getUserMedia({
8730
8757
  audio: true,
8731
8758
  });
8759
+ this.audioStream = audioStream;
8732
8760
  this.pc1.addEventListener('icecandidate', async (e) => {
8733
8761
  await this.pc2.addIceCandidate(e.candidate);
8734
8762
  });
@@ -8758,6 +8786,7 @@ class RNSpeechDetector {
8758
8786
  stop() {
8759
8787
  this.pc1.close();
8760
8788
  this.pc2.close();
8789
+ this.cleanupAudioStream();
8761
8790
  if (this.intervalId) {
8762
8791
  clearInterval(this.intervalId);
8763
8792
  }
@@ -8794,6 +8823,25 @@ class RNSpeechDetector {
8794
8823
  clearInterval(this.intervalId);
8795
8824
  };
8796
8825
  }
8826
+ cleanupAudioStream() {
8827
+ if (!this.audioStream) {
8828
+ return;
8829
+ }
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
+ });
8838
+ if (
8839
+ // @ts-expect-error release() is present in react-native-webrtc
8840
+ typeof this.audioStream.release === 'function') {
8841
+ // @ts-expect-error called to dispose the stream in RN
8842
+ this.audioStream.release();
8843
+ }
8844
+ }
8797
8845
  }
8798
8846
 
8799
8847
  class MicrophoneManager extends InputMediaDeviceManager {
@@ -12456,7 +12504,7 @@ class StreamClient {
12456
12504
  });
12457
12505
  };
12458
12506
  this.getUserAgent = () => {
12459
- const version = "1.8.0";
12507
+ const version = "1.8.2";
12460
12508
  return (this.userAgent ||
12461
12509
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12462
12510
  };