@stream-io/video-client 1.11.8 → 1.11.9

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.11.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.8...@stream-io/video-client-1.11.9) (2024-11-27)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * cover some device selection edge cases ([#1604](https://github.com/GetStream/stream-video-js/issues/1604)) ([a8fc0ea](https://github.com/GetStream/stream-video-js/commit/a8fc0eaf1ed6c79ce24f77f52351a1e90701bd02))
11
+
5
12
  ## [1.11.8](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.7...@stream-io/video-client-1.11.8) (2024-11-27)
6
13
 
7
14
 
@@ -3297,7 +3297,7 @@ const retryable = async (rpc, signal) => {
3297
3297
  return result;
3298
3298
  };
3299
3299
 
3300
- const version = "1.11.8";
3300
+ const version = "1.11.9";
3301
3301
  const [major, minor, patch] = version.split('.');
3302
3302
  let sdkInfo = {
3303
3303
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -8344,7 +8344,7 @@ const getAudioStream = async (trackConstraints) => {
8344
8344
  const constraints = {
8345
8345
  audio: {
8346
8346
  ...audioDeviceConstraints.audio,
8347
- ...trackConstraints,
8347
+ ...normalizeContraints(trackConstraints),
8348
8348
  },
8349
8349
  };
8350
8350
  try {
@@ -8355,11 +8355,6 @@ const getAudioStream = async (trackConstraints) => {
8355
8355
  return await getStream(constraints);
8356
8356
  }
8357
8357
  catch (error) {
8358
- if (error instanceof OverconstrainedError && trackConstraints?.deviceId) {
8359
- const { deviceId, ...relaxedContraints } = trackConstraints;
8360
- getLogger(['devices'])('warn', 'Failed to get audio stream, will try again with relaxed contraints', { error, constraints, relaxedContraints });
8361
- return getAudioStream(relaxedContraints);
8362
- }
8363
8358
  getLogger(['devices'])('error', 'Failed to get audio stream', {
8364
8359
  error,
8365
8360
  constraints,
@@ -8379,7 +8374,7 @@ const getVideoStream = async (trackConstraints) => {
8379
8374
  const constraints = {
8380
8375
  video: {
8381
8376
  ...videoDeviceConstraints.video,
8382
- ...trackConstraints,
8377
+ ...normalizeContraints(trackConstraints),
8383
8378
  },
8384
8379
  };
8385
8380
  try {
@@ -8390,11 +8385,6 @@ const getVideoStream = async (trackConstraints) => {
8390
8385
  return await getStream(constraints);
8391
8386
  }
8392
8387
  catch (error) {
8393
- if (error instanceof OverconstrainedError && trackConstraints?.deviceId) {
8394
- const { deviceId, ...relaxedContraints } = trackConstraints;
8395
- getLogger(['devices'])('warn', 'Failed to get video stream, will try again with relaxed contraints', { error, constraints, relaxedContraints });
8396
- return getVideoStream(relaxedContraints);
8397
- }
8398
8388
  getLogger(['devices'])('error', 'Failed to get video stream', {
8399
8389
  error,
8400
8390
  constraints,
@@ -8402,6 +8392,16 @@ const getVideoStream = async (trackConstraints) => {
8402
8392
  throw error;
8403
8393
  }
8404
8394
  };
8395
+ function normalizeContraints(constraints) {
8396
+ if (constraints?.deviceId === 'default' ||
8397
+ (typeof constraints?.deviceId === 'object' &&
8398
+ 'exact' in constraints.deviceId &&
8399
+ constraints.deviceId.exact === 'default')) {
8400
+ const { deviceId, ...contraintsWithoutDeviceId } = constraints;
8401
+ return contraintsWithoutDeviceId;
8402
+ }
8403
+ return constraints;
8404
+ }
8405
8405
  /**
8406
8406
  * Prompts the user for a permission to share a screen.
8407
8407
  * If the user grants the permission, a screen sharing stream is returned. Throws otherwise.
@@ -8628,6 +8628,7 @@ class InputMediaDeviceManager {
8628
8628
  }
8629
8629
  catch (error) {
8630
8630
  this.state.setDevice(prevDeviceId);
8631
+ await this.applySettingsToStream();
8631
8632
  throw error;
8632
8633
  }
8633
8634
  }
@@ -12613,7 +12614,7 @@ class StreamClient {
12613
12614
  return await this.wsConnection.connect(this.defaultWSTimeout);
12614
12615
  };
12615
12616
  this.getUserAgent = () => {
12616
- const version = "1.11.8";
12617
+ const version = "1.11.9";
12617
12618
  return (this.userAgent ||
12618
12619
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12619
12620
  };