@stream-io/video-client 1.8.2 → 1.8.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,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.8.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.8.3...@stream-io/video-client-1.8.4) (2024-10-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * ignore camera direction for desktop devices ([#1521](https://github.com/GetStream/stream-video-js/issues/1521)) ([562b5cc](https://github.com/GetStream/stream-video-js/commit/562b5cca77264330d08dff5305eccc489970076a))
11
+
12
+ ## [1.8.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.8.2...@stream-io/video-client-1.8.3) (2024-10-10)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * do not release track if track was not removed from stream ([#1517](https://github.com/GetStream/stream-video-js/issues/1517)) ([5bfc528](https://github.com/GetStream/stream-video-js/commit/5bfc52850c36ffe0de37e47066538a8a14dc9e01))
18
+
5
19
  ## [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
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.2";
3023
+ const version = "1.8.4";
3024
3024
  const [major, minor, patch] = version.split('.');
3025
3025
  let sdkInfo = {
3026
3026
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -5237,11 +5237,6 @@ 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
- }
5245
5240
  track.addEventListener('ended', handleTrackEnded);
5246
5241
  }
5247
5242
  if (!track.enabled) {
@@ -5261,19 +5256,14 @@ class Publisher {
5261
5256
  const transceiver = this.pc
5262
5257
  .getTransceivers()
5263
5258
  .find((t) => t === this.transceiverRegistry[trackType] && t.sender.track);
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
- }
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);
5277
5267
  // We don't need to notify SFU if unpublishing in response to remote soft mute
5278
5268
  if (this.state.localParticipant?.publishedTracks.includes(trackType)) {
5279
5269
  await this.notifyTrackMuteStateChanged(undefined, trackType, true);
@@ -5320,13 +5310,7 @@ class Publisher {
5320
5310
  this.stopPublishing = () => {
5321
5311
  this.logger('debug', 'Stopping publishing all tracks');
5322
5312
  this.pc.getSenders().forEach((s) => {
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
- }
5313
+ s.track?.stop();
5330
5314
  if (this.pc.signalingState !== 'closed') {
5331
5315
  this.pc.removeTrack(s);
5332
5316
  }
@@ -7954,12 +7938,6 @@ const disposeOfMediaStream = (stream) => {
7954
7938
  return;
7955
7939
  stream.getTracks().forEach((track) => {
7956
7940
  track.stop();
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
- }
7963
7941
  });
7964
7942
  // @ts-expect-error release() is present in react-native-webrtc and must be called to dispose the stream
7965
7943
  if (typeof stream.release === 'function') {
@@ -8179,14 +8157,8 @@ class InputMediaDeviceManager {
8179
8157
  }
8180
8158
  stopTracks() {
8181
8159
  this.getTracks().forEach((track) => {
8182
- if (track.readyState === 'live') {
8160
+ if (track.readyState === 'live')
8183
8161
  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
- }
8190
8162
  });
8191
8163
  }
8192
8164
  muteLocalStream(stopTracks) {
@@ -8543,6 +8515,14 @@ class CameraManagerState extends InputMediaDeviceManagerState {
8543
8515
  }
8544
8516
  }
8545
8517
 
8518
+ /**
8519
+ * Checks if the current platform is a mobile device.
8520
+ *
8521
+ * See:
8522
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
8523
+ */
8524
+ const isMobile = () => /Mobi/i.test(navigator.userAgent);
8525
+
8546
8526
  class CameraManager extends InputMediaDeviceManager {
8547
8527
  /**
8548
8528
  * Constructs a new CameraManager.
@@ -8562,10 +8542,15 @@ class CameraManager extends InputMediaDeviceManager {
8562
8542
  * @param direction the direction of the camera to select.
8563
8543
  */
8564
8544
  async selectDirection(direction) {
8565
- this.state.setDirection(direction);
8566
- // Providing both device id and direction doesn't work, so we deselect the device
8567
- this.state.setDevice(undefined);
8568
- await this.applySettingsToStream();
8545
+ if (isMobile()) {
8546
+ this.state.setDirection(direction);
8547
+ // Providing both device id and direction doesn't work, so we deselect the device
8548
+ this.state.setDevice(undefined);
8549
+ await this.applySettingsToStream();
8550
+ }
8551
+ else {
8552
+ this.logger('warn', 'Camera direction ignored for desktop devices');
8553
+ }
8569
8554
  }
8570
8555
  /**
8571
8556
  * Flips the camera direction: if it's front it will change to back, if it's back, it will change to front.
@@ -8646,7 +8631,7 @@ class CameraManager extends InputMediaDeviceManager {
8646
8631
  constraints.height = this.targetResolution.height;
8647
8632
  // We can't set both device id and facing mode
8648
8633
  // Device id has higher priority
8649
- if (!constraints.deviceId && this.state.direction) {
8634
+ if (!constraints.deviceId && this.state.direction && isMobile()) {
8650
8635
  constraints.facingMode =
8651
8636
  this.state.direction === 'front' ? 'user' : 'environment';
8652
8637
  }
@@ -8827,14 +8812,7 @@ class RNSpeechDetector {
8827
8812
  if (!this.audioStream) {
8828
8813
  return;
8829
8814
  }
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
- });
8815
+ this.audioStream.getTracks().forEach((track) => track.stop());
8838
8816
  if (
8839
8817
  // @ts-expect-error release() is present in react-native-webrtc
8840
8818
  typeof this.audioStream.release === 'function') {
@@ -12504,7 +12482,7 @@ class StreamClient {
12504
12482
  });
12505
12483
  };
12506
12484
  this.getUserAgent = () => {
12507
- const version = "1.8.2";
12485
+ const version = "1.8.4";
12508
12486
  return (this.userAgent ||
12509
12487
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12510
12488
  };