@stream-io/video-client 1.16.6 → 1.16.7

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
@@ -7465,7 +7465,7 @@ const aggregate = (stats) => {
7465
7465
  return report;
7466
7466
  };
7467
7467
 
7468
- const version = "1.16.6";
7468
+ const version = "1.16.7";
7469
7469
  const [major, minor, patch] = version.split('.');
7470
7470
  let sdkInfo = {
7471
7471
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -8557,13 +8557,23 @@ const getStream = async (constraints) => {
8557
8557
  }
8558
8558
  return stream;
8559
8559
  };
8560
- function isOverconstrainedError(error) {
8561
- return (error &&
8562
- typeof error === 'object' &&
8563
- (('name' in error && error.name === 'OverconstrainedError') ||
8564
- ('message' in error &&
8565
- typeof error.message === 'string' &&
8566
- error.message.startsWith('OverconstrainedError'))));
8560
+ function isNotFoundOrOverconstrainedError(error) {
8561
+ if (!error || typeof error !== 'object') {
8562
+ return false;
8563
+ }
8564
+ if ('name' in error && typeof error.name === 'string') {
8565
+ const name = error.name;
8566
+ if (['OverconstrainedError', 'NotFoundError'].includes(name)) {
8567
+ return true;
8568
+ }
8569
+ }
8570
+ if ('message' in error && typeof error.message === 'string') {
8571
+ const message = error.message;
8572
+ if (message.startsWith('OverconstrainedError')) {
8573
+ return true;
8574
+ }
8575
+ }
8576
+ return false;
8567
8577
  }
8568
8578
  /**
8569
8579
  * Returns an audio media stream that fulfills the given constraints.
@@ -8588,7 +8598,7 @@ const getAudioStream = async (trackConstraints) => {
8588
8598
  return await getStream(constraints);
8589
8599
  }
8590
8600
  catch (error) {
8591
- if (isOverconstrainedError(error) && trackConstraints?.deviceId) {
8601
+ if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
8592
8602
  const { deviceId, ...relaxedConstraints } = trackConstraints;
8593
8603
  getLogger(['devices'])('warn', 'Failed to get audio stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
8594
8604
  return getAudioStream(relaxedConstraints);
@@ -8623,7 +8633,7 @@ const getVideoStream = async (trackConstraints) => {
8623
8633
  return await getStream(constraints);
8624
8634
  }
8625
8635
  catch (error) {
8626
- if (isOverconstrainedError(error) && trackConstraints?.deviceId) {
8636
+ if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
8627
8637
  const { deviceId, ...relaxedConstraints } = trackConstraints;
8628
8638
  getLogger(['devices'])('warn', 'Failed to get video stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
8629
8639
  return getVideoStream(relaxedConstraints);
@@ -13066,7 +13076,7 @@ class StreamClient {
13066
13076
  return await this.wsConnection.connect(this.defaultWSTimeout);
13067
13077
  };
13068
13078
  this.getUserAgent = () => {
13069
- const version = "1.16.6";
13079
+ const version = "1.16.7";
13070
13080
  return (this.userAgent ||
13071
13081
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
13072
13082
  };