@stream-io/video-client 1.25.1 → 1.25.2

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
@@ -5812,7 +5812,7 @@ const aggregate = (stats) => {
5812
5812
  return report;
5813
5813
  };
5814
5814
 
5815
- const version = "1.25.1";
5815
+ const version = "1.25.2";
5816
5816
  const [major, minor, patch] = version.split('.');
5817
5817
  let sdkInfo = {
5818
5818
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -9669,6 +9669,26 @@ const disposeOfMediaStream = (stream) => {
9669
9669
  stream.release();
9670
9670
  }
9671
9671
  };
9672
+ /**
9673
+ * Resolves `default` device id into the real device id. Some browsers (notably,
9674
+ * Chromium-based) report device with id `default` among audio input and output
9675
+ * devices. Since not every browser does that, we never want `default` id to be
9676
+ * used within our SDK. This function tries to find the real id for the `default`
9677
+ * device.
9678
+ */
9679
+ function resolveDeviceId(deviceId, kind) {
9680
+ if (deviceId !== 'default')
9681
+ return deviceId;
9682
+ const devices = deviceIds$ && getCurrentValue(deviceIds$);
9683
+ if (!devices)
9684
+ return deviceId;
9685
+ const defaultDeviceInfo = devices.find((d) => d.deviceId === deviceId);
9686
+ if (!defaultDeviceInfo)
9687
+ return deviceId;
9688
+ const groupId = defaultDeviceInfo.groupId;
9689
+ const candidates = devices.filter((d) => d.kind === kind && d.deviceId !== 'default' && d.groupId === groupId);
9690
+ return candidates.length === 1 ? candidates[0].deviceId : deviceId;
9691
+ }
9672
9692
 
9673
9693
  /**
9674
9694
  * Checks if the current platform is a mobile device.
@@ -10458,7 +10478,8 @@ class MicrophoneManagerState extends InputMediaDeviceManagerState {
10458
10478
  }
10459
10479
  getDeviceIdFromStream(stream) {
10460
10480
  const [track] = stream.getAudioTracks();
10461
- return track?.getSettings().deviceId;
10481
+ const unresolvedDeviceId = track?.getSettings().deviceId;
10482
+ return resolveDeviceId(unresolvedDeviceId, 'audioinput');
10462
10483
  }
10463
10484
  }
10464
10485
 
@@ -14252,7 +14273,7 @@ class StreamClient {
14252
14273
  this.getUserAgent = () => {
14253
14274
  if (!this.cachedUserAgent) {
14254
14275
  const { clientAppIdentifier = {} } = this.options;
14255
- const { sdkName = 'js', sdkVersion = "1.25.1", ...extras } = clientAppIdentifier;
14276
+ const { sdkName = 'js', sdkVersion = "1.25.2", ...extras } = clientAppIdentifier;
14256
14277
  this.cachedUserAgent = [
14257
14278
  `stream-video-${sdkName}-v${sdkVersion}`,
14258
14279
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
@@ -14895,6 +14916,7 @@ exports.pinned = pinned;
14895
14916
  exports.publishingAudio = publishingAudio;
14896
14917
  exports.publishingVideo = publishingVideo;
14897
14918
  exports.reactionType = reactionType;
14919
+ exports.resolveDeviceId = resolveDeviceId;
14898
14920
  exports.role = role;
14899
14921
  exports.screenSharing = screenSharing;
14900
14922
  exports.setDeviceInfo = setDeviceInfo;