@stream-io/video-client 1.8.3 → 1.8.4

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.8.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.8.3...@stream-io/video-client-1.8.4) (2024-10-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * ignore camera direction for desktop devices ([#1521](https://github.com/GetStream/stream-video-js/issues/1521)) ([562b5cc](https://github.com/GetStream/stream-video-js/commit/562b5cca77264330d08dff5305eccc489970076a))
11
+
5
12
  ## [1.8.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.8.2...@stream-io/video-client-1.8.3) (2024-10-10)
6
13
 
7
14
 
@@ -3020,7 +3020,7 @@ const retryable = async (rpc, signal) => {
3020
3020
  return result;
3021
3021
  };
3022
3022
 
3023
- const version = "1.8.3";
3023
+ const version = "1.8.4";
3024
3024
  const [major, minor, patch] = version.split('.');
3025
3025
  let sdkInfo = {
3026
3026
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -8515,6 +8515,14 @@ class CameraManagerState extends InputMediaDeviceManagerState {
8515
8515
  }
8516
8516
  }
8517
8517
 
8518
+ /**
8519
+ * Checks if the current platform is a mobile device.
8520
+ *
8521
+ * See:
8522
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
8523
+ */
8524
+ const isMobile = () => /Mobi/i.test(navigator.userAgent);
8525
+
8518
8526
  class CameraManager extends InputMediaDeviceManager {
8519
8527
  /**
8520
8528
  * Constructs a new CameraManager.
@@ -8534,10 +8542,15 @@ class CameraManager extends InputMediaDeviceManager {
8534
8542
  * @param direction the direction of the camera to select.
8535
8543
  */
8536
8544
  async selectDirection(direction) {
8537
- this.state.setDirection(direction);
8538
- // Providing both device id and direction doesn't work, so we deselect the device
8539
- this.state.setDevice(undefined);
8540
- await this.applySettingsToStream();
8545
+ if (isMobile()) {
8546
+ this.state.setDirection(direction);
8547
+ // Providing both device id and direction doesn't work, so we deselect the device
8548
+ this.state.setDevice(undefined);
8549
+ await this.applySettingsToStream();
8550
+ }
8551
+ else {
8552
+ this.logger('warn', 'Camera direction ignored for desktop devices');
8553
+ }
8541
8554
  }
8542
8555
  /**
8543
8556
  * Flips the camera direction: if it's front it will change to back, if it's back, it will change to front.
@@ -8618,7 +8631,7 @@ class CameraManager extends InputMediaDeviceManager {
8618
8631
  constraints.height = this.targetResolution.height;
8619
8632
  // We can't set both device id and facing mode
8620
8633
  // Device id has higher priority
8621
- if (!constraints.deviceId && this.state.direction) {
8634
+ if (!constraints.deviceId && this.state.direction && isMobile()) {
8622
8635
  constraints.facingMode =
8623
8636
  this.state.direction === 'front' ? 'user' : 'environment';
8624
8637
  }
@@ -12469,7 +12482,7 @@ class StreamClient {
12469
12482
  });
12470
12483
  };
12471
12484
  this.getUserAgent = () => {
12472
- const version = "1.8.3";
12485
+ const version = "1.8.4";
12473
12486
  return (this.userAgent ||
12474
12487
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12475
12488
  };