@stream-io/video-client 1.9.2 → 1.9.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/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.9.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.9.2...@stream-io/video-client-1.9.3) (2024-10-28)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * make device selection by device id exact ([#1538](https://github.com/GetStream/stream-video-js/issues/1538)) ([6274cac](https://github.com/GetStream/stream-video-js/commit/6274cac2ecf155aa6ce0c6d764229e0e9cd39a6a))
11
+
5
12
  ## [1.9.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.9.1...@stream-io/video-client-1.9.2) (2024-10-21)
6
13
 
7
14
 
@@ -2938,7 +2938,7 @@ const retryable = async (rpc, signal) => {
2938
2938
  return result;
2939
2939
  };
2940
2940
 
2941
- const version = "1.9.2";
2941
+ const version = "1.9.3";
2942
2942
  const [major, minor, patch] = version.split('.');
2943
2943
  let sdkInfo = {
2944
2944
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -7847,14 +7847,19 @@ const getAudioStream = async (trackConstraints) => {
7847
7847
  throwOnNotAllowed: true,
7848
7848
  forcePrompt: true,
7849
7849
  });
7850
- return getStream(constraints);
7850
+ return await getStream(constraints);
7851
7851
  }
7852
- catch (e) {
7852
+ catch (error) {
7853
+ if (error instanceof OverconstrainedError && trackConstraints?.deviceId) {
7854
+ const { deviceId, ...relaxedContraints } = trackConstraints;
7855
+ getLogger(['devices'])('warn', 'Failed to get audio stream, will try again with relaxed contraints', { error, constraints, relaxedContraints });
7856
+ return getAudioStream(relaxedContraints);
7857
+ }
7853
7858
  getLogger(['devices'])('error', 'Failed to get audio stream', {
7854
- error: e,
7855
- constraints: constraints,
7859
+ error,
7860
+ constraints,
7856
7861
  });
7857
- throw e;
7862
+ throw error;
7858
7863
  }
7859
7864
  };
7860
7865
  /**
@@ -7877,14 +7882,19 @@ const getVideoStream = async (trackConstraints) => {
7877
7882
  throwOnNotAllowed: true,
7878
7883
  forcePrompt: true,
7879
7884
  });
7880
- return getStream(constraints);
7885
+ return await getStream(constraints);
7881
7886
  }
7882
- catch (e) {
7887
+ catch (error) {
7888
+ if (error instanceof OverconstrainedError && trackConstraints?.deviceId) {
7889
+ const { deviceId, ...relaxedContraints } = trackConstraints;
7890
+ getLogger(['devices'])('warn', 'Failed to get video stream, will try again with relaxed contraints', { error, constraints, relaxedContraints });
7891
+ return getVideoStream(relaxedContraints);
7892
+ }
7883
7893
  getLogger(['devices'])('error', 'Failed to get video stream', {
7884
- error: e,
7885
- constraints: constraints,
7894
+ error,
7895
+ constraints,
7886
7896
  });
7887
- throw e;
7897
+ throw error;
7888
7898
  }
7889
7899
  };
7890
7900
  /**
@@ -8102,11 +8112,18 @@ class InputMediaDeviceManager {
8102
8112
  if (isReactNative()) {
8103
8113
  throw new Error('This method is not supported in React Native. Please visit https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaker-management for reference.');
8104
8114
  }
8105
- if (deviceId === this.state.selectedDevice) {
8115
+ const prevDeviceId = this.state.selectedDevice;
8116
+ if (deviceId === prevDeviceId) {
8106
8117
  return;
8107
8118
  }
8108
- this.state.setDevice(deviceId);
8109
- await this.applySettingsToStream();
8119
+ try {
8120
+ this.state.setDevice(deviceId);
8121
+ await this.applySettingsToStream();
8122
+ }
8123
+ catch (error) {
8124
+ this.state.setDevice(prevDeviceId);
8125
+ throw error;
8126
+ }
8110
8127
  }
8111
8128
  async applySettingsToStream() {
8112
8129
  await withCancellation(this.statusChangeConcurrencyTag, async () => {
@@ -8181,7 +8198,9 @@ class InputMediaDeviceManager {
8181
8198
  const defaultConstraints = this.state.defaultConstraints;
8182
8199
  const constraints = {
8183
8200
  ...defaultConstraints,
8184
- deviceId: this.state.selectedDevice,
8201
+ deviceId: this.state.selectedDevice
8202
+ ? { exact: this.state.selectedDevice }
8203
+ : undefined,
8185
8204
  };
8186
8205
  /**
8187
8206
  * Chains two media streams together.
@@ -12450,7 +12469,7 @@ class StreamClient {
12450
12469
  });
12451
12470
  };
12452
12471
  this.getUserAgent = () => {
12453
- const version = "1.9.2";
12472
+ const version = "1.9.3";
12454
12473
  return (this.userAgent ||
12455
12474
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12456
12475
  };