@stream-io/video-client 1.8.2 → 1.8.3

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