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