@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.cjs.js CHANGED
@@ -3318,7 +3318,7 @@ const retryable = async (rpc, signal) => {
3318
3318
  return result;
3319
3319
  };
3320
3320
 
3321
- const version = "1.11.8";
3321
+ const version = "1.11.9";
3322
3322
  const [major, minor, patch] = version.split('.');
3323
3323
  let sdkInfo = {
3324
3324
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -8365,7 +8365,7 @@ const getAudioStream = async (trackConstraints) => {
8365
8365
  const constraints = {
8366
8366
  audio: {
8367
8367
  ...audioDeviceConstraints.audio,
8368
- ...trackConstraints,
8368
+ ...normalizeContraints(trackConstraints),
8369
8369
  },
8370
8370
  };
8371
8371
  try {
@@ -8376,11 +8376,6 @@ const getAudioStream = async (trackConstraints) => {
8376
8376
  return await getStream(constraints);
8377
8377
  }
8378
8378
  catch (error) {
8379
- if (error instanceof OverconstrainedError && trackConstraints?.deviceId) {
8380
- const { deviceId, ...relaxedContraints } = trackConstraints;
8381
- getLogger(['devices'])('warn', 'Failed to get audio stream, will try again with relaxed contraints', { error, constraints, relaxedContraints });
8382
- return getAudioStream(relaxedContraints);
8383
- }
8384
8379
  getLogger(['devices'])('error', 'Failed to get audio stream', {
8385
8380
  error,
8386
8381
  constraints,
@@ -8400,7 +8395,7 @@ const getVideoStream = async (trackConstraints) => {
8400
8395
  const constraints = {
8401
8396
  video: {
8402
8397
  ...videoDeviceConstraints.video,
8403
- ...trackConstraints,
8398
+ ...normalizeContraints(trackConstraints),
8404
8399
  },
8405
8400
  };
8406
8401
  try {
@@ -8411,11 +8406,6 @@ const getVideoStream = async (trackConstraints) => {
8411
8406
  return await getStream(constraints);
8412
8407
  }
8413
8408
  catch (error) {
8414
- if (error instanceof OverconstrainedError && trackConstraints?.deviceId) {
8415
- const { deviceId, ...relaxedContraints } = trackConstraints;
8416
- getLogger(['devices'])('warn', 'Failed to get video stream, will try again with relaxed contraints', { error, constraints, relaxedContraints });
8417
- return getVideoStream(relaxedContraints);
8418
- }
8419
8409
  getLogger(['devices'])('error', 'Failed to get video stream', {
8420
8410
  error,
8421
8411
  constraints,
@@ -8423,6 +8413,16 @@ const getVideoStream = async (trackConstraints) => {
8423
8413
  throw error;
8424
8414
  }
8425
8415
  };
8416
+ function normalizeContraints(constraints) {
8417
+ if (constraints?.deviceId === 'default' ||
8418
+ (typeof constraints?.deviceId === 'object' &&
8419
+ 'exact' in constraints.deviceId &&
8420
+ constraints.deviceId.exact === 'default')) {
8421
+ const { deviceId, ...contraintsWithoutDeviceId } = constraints;
8422
+ return contraintsWithoutDeviceId;
8423
+ }
8424
+ return constraints;
8425
+ }
8426
8426
  /**
8427
8427
  * Prompts the user for a permission to share a screen.
8428
8428
  * If the user grants the permission, a screen sharing stream is returned. Throws otherwise.
@@ -8649,6 +8649,7 @@ class InputMediaDeviceManager {
8649
8649
  }
8650
8650
  catch (error) {
8651
8651
  this.state.setDevice(prevDeviceId);
8652
+ await this.applySettingsToStream();
8652
8653
  throw error;
8653
8654
  }
8654
8655
  }
@@ -12632,7 +12633,7 @@ class StreamClient {
12632
12633
  return await this.wsConnection.connect(this.defaultWSTimeout);
12633
12634
  };
12634
12635
  this.getUserAgent = () => {
12635
- const version = "1.11.8";
12636
+ const version = "1.11.9";
12636
12637
  return (this.userAgent ||
12637
12638
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12638
12639
  };