@stream-io/video-client 0.3.21 → 0.3.23

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
@@ -9389,6 +9389,40 @@ class ViewportTracker {
9389
9389
  }
9390
9390
  }
9391
9391
 
9392
+ /**
9393
+ * Checks whether the current browser is Safari.
9394
+ */
9395
+ const isSafari = () => {
9396
+ if (typeof navigator === 'undefined')
9397
+ return false;
9398
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent || '');
9399
+ };
9400
+ /**
9401
+ * Checks whether the current browser is Firefox.
9402
+ */
9403
+ const isFirefox = () => {
9404
+ var _a;
9405
+ if (typeof navigator === 'undefined')
9406
+ return false;
9407
+ return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Firefox');
9408
+ };
9409
+ /**
9410
+ * Checks whether the current browser is Google Chrome.
9411
+ */
9412
+ const isChrome = () => {
9413
+ var _a;
9414
+ if (typeof navigator === 'undefined')
9415
+ return false;
9416
+ return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Chrome');
9417
+ };
9418
+
9419
+ var browsers = /*#__PURE__*/Object.freeze({
9420
+ __proto__: null,
9421
+ isChrome: isChrome,
9422
+ isFirefox: isFirefox,
9423
+ isSafari: isSafari
9424
+ });
9425
+
9392
9426
  const DEFAULT_VIEWPORT_VISIBILITY_STATE = {
9393
9427
  videoTrack: exports.VisibilityState.UNKNOWN,
9394
9428
  screenShareTrack: exports.VisibilityState.UNKNOWN,
@@ -9559,27 +9593,31 @@ class DynascaleManager {
9559
9593
  requestTrackWithDimensions(exports.DebounceType.FAST, undefined);
9560
9594
  }
9561
9595
  });
9596
+ videoElement.autoplay = true;
9597
+ videoElement.playsInline = true;
9598
+ // explicitly marking the element as muted will allow autoplay to work
9599
+ // without prior user interaction:
9600
+ // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9601
+ videoElement.muted = true;
9562
9602
  const streamSubscription = participant$
9563
9603
  .pipe(rxjs.distinctUntilKeyChanged(trackType === 'videoTrack' ? 'videoStream' : 'screenShareStream'))
9564
9604
  .subscribe((p) => {
9565
9605
  const source = trackType === 'videoTrack' ? p.videoStream : p.screenShareStream;
9566
9606
  if (videoElement.srcObject === source)
9567
9607
  return;
9568
- setTimeout(() => {
9569
- videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9570
- if (videoElement.srcObject) {
9608
+ videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9609
+ if (isSafari() || isFirefox()) {
9610
+ setTimeout(() => {
9611
+ videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9571
9612
  videoElement.play().catch((e) => {
9572
9613
  this.logger('warn', `Failed to play stream`, e);
9573
9614
  });
9574
- }
9575
- }, 0);
9615
+ // we add extra delay until we attempt to force-play
9616
+ // the participant's media stream in Firefox and Safari,
9617
+ // as they seem to have some timing issues
9618
+ }, 25);
9619
+ }
9576
9620
  });
9577
- videoElement.playsInline = true;
9578
- videoElement.autoplay = true;
9579
- // explicitly marking the element as muted will allow autoplay to work
9580
- // without prior user interaction:
9581
- // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9582
- videoElement.muted = true;
9583
9621
  return () => {
9584
9622
  requestTrackWithDimensions(exports.DebounceType.FAST, undefined);
9585
9623
  viewportVisibilityStateSubscription === null || viewportVisibilityStateSubscription === void 0 ? void 0 : viewportVisibilityStateSubscription.unsubscribe();
@@ -9626,7 +9664,7 @@ class DynascaleManager {
9626
9664
  const deviceId = ((_a = getSdkInfo()) === null || _a === void 0 ? void 0 : _a.type) === SdkType.REACT
9627
9665
  ? p === null || p === void 0 ? void 0 : p.audioOutputDeviceId
9628
9666
  : selectedDevice;
9629
- if ('setSinkId' in audioElement) {
9667
+ if ('setSinkId' in audioElement && typeof deviceId === 'string') {
9630
9668
  // @ts-expect-error setSinkId is not yet in the lib
9631
9669
  audioElement.setSinkId(deviceId);
9632
9670
  }
@@ -13148,7 +13186,7 @@ class WSConnectionFallback {
13148
13186
  }
13149
13187
  }
13150
13188
 
13151
- const version = '0.3.21';
13189
+ const version = '0.3.23';
13152
13190
 
13153
13191
  const logger = getLogger(['location']);
13154
13192
  const HINT_URL = `https://hint.stream-io-video.com/`;
@@ -14128,40 +14166,6 @@ class StreamVideoServerClient extends StreamVideoClient {
14128
14166
  }
14129
14167
  }
14130
14168
 
14131
- /**
14132
- * Checks whether the current browser is Safari.
14133
- */
14134
- const isSafari = () => {
14135
- if (typeof navigator === 'undefined')
14136
- return false;
14137
- return /^((?!chrome|android).)*safari/i.test(navigator.userAgent || '');
14138
- };
14139
- /**
14140
- * Checks whether the current browser is Firefox.
14141
- */
14142
- const isFirefox = () => {
14143
- var _a;
14144
- if (typeof navigator === 'undefined')
14145
- return false;
14146
- return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Firefox');
14147
- };
14148
- /**
14149
- * Checks whether the current browser is Google Chrome.
14150
- */
14151
- const isChrome = () => {
14152
- var _a;
14153
- if (typeof navigator === 'undefined')
14154
- return false;
14155
- return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Chrome');
14156
- };
14157
-
14158
- var browsers = /*#__PURE__*/Object.freeze({
14159
- __proto__: null,
14160
- isChrome: isChrome,
14161
- isFirefox: isFirefox,
14162
- isSafari: isSafari
14163
- });
14164
-
14165
14169
  Object.defineProperty(exports, 'AxiosError', {
14166
14170
  enumerable: true,
14167
14171
  get: function () { return axios.AxiosError; }