@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.es.js CHANGED
@@ -9369,6 +9369,40 @@ class ViewportTracker {
9369
9369
  }
9370
9370
  }
9371
9371
 
9372
+ /**
9373
+ * Checks whether the current browser is Safari.
9374
+ */
9375
+ const isSafari = () => {
9376
+ if (typeof navigator === 'undefined')
9377
+ return false;
9378
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent || '');
9379
+ };
9380
+ /**
9381
+ * Checks whether the current browser is Firefox.
9382
+ */
9383
+ const isFirefox = () => {
9384
+ var _a;
9385
+ if (typeof navigator === 'undefined')
9386
+ return false;
9387
+ return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Firefox');
9388
+ };
9389
+ /**
9390
+ * Checks whether the current browser is Google Chrome.
9391
+ */
9392
+ const isChrome = () => {
9393
+ var _a;
9394
+ if (typeof navigator === 'undefined')
9395
+ return false;
9396
+ return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Chrome');
9397
+ };
9398
+
9399
+ var browsers = /*#__PURE__*/Object.freeze({
9400
+ __proto__: null,
9401
+ isChrome: isChrome,
9402
+ isFirefox: isFirefox,
9403
+ isSafari: isSafari
9404
+ });
9405
+
9372
9406
  const DEFAULT_VIEWPORT_VISIBILITY_STATE = {
9373
9407
  videoTrack: VisibilityState.UNKNOWN,
9374
9408
  screenShareTrack: VisibilityState.UNKNOWN,
@@ -9539,27 +9573,31 @@ class DynascaleManager {
9539
9573
  requestTrackWithDimensions(DebounceType.FAST, undefined);
9540
9574
  }
9541
9575
  });
9576
+ videoElement.autoplay = true;
9577
+ videoElement.playsInline = true;
9578
+ // explicitly marking the element as muted will allow autoplay to work
9579
+ // without prior user interaction:
9580
+ // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9581
+ videoElement.muted = true;
9542
9582
  const streamSubscription = participant$
9543
9583
  .pipe(distinctUntilKeyChanged(trackType === 'videoTrack' ? 'videoStream' : 'screenShareStream'))
9544
9584
  .subscribe((p) => {
9545
9585
  const source = trackType === 'videoTrack' ? p.videoStream : p.screenShareStream;
9546
9586
  if (videoElement.srcObject === source)
9547
9587
  return;
9548
- setTimeout(() => {
9549
- videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9550
- if (videoElement.srcObject) {
9588
+ videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9589
+ if (isSafari() || isFirefox()) {
9590
+ setTimeout(() => {
9591
+ videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9551
9592
  videoElement.play().catch((e) => {
9552
9593
  this.logger('warn', `Failed to play stream`, e);
9553
9594
  });
9554
- }
9555
- }, 0);
9595
+ // we add extra delay until we attempt to force-play
9596
+ // the participant's media stream in Firefox and Safari,
9597
+ // as they seem to have some timing issues
9598
+ }, 25);
9599
+ }
9556
9600
  });
9557
- videoElement.playsInline = true;
9558
- videoElement.autoplay = true;
9559
- // explicitly marking the element as muted will allow autoplay to work
9560
- // without prior user interaction:
9561
- // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9562
- videoElement.muted = true;
9563
9601
  return () => {
9564
9602
  requestTrackWithDimensions(DebounceType.FAST, undefined);
9565
9603
  viewportVisibilityStateSubscription === null || viewportVisibilityStateSubscription === void 0 ? void 0 : viewportVisibilityStateSubscription.unsubscribe();
@@ -9606,7 +9644,7 @@ class DynascaleManager {
9606
9644
  const deviceId = ((_a = getSdkInfo()) === null || _a === void 0 ? void 0 : _a.type) === SdkType.REACT
9607
9645
  ? p === null || p === void 0 ? void 0 : p.audioOutputDeviceId
9608
9646
  : selectedDevice;
9609
- if ('setSinkId' in audioElement) {
9647
+ if ('setSinkId' in audioElement && typeof deviceId === 'string') {
9610
9648
  // @ts-expect-error setSinkId is not yet in the lib
9611
9649
  audioElement.setSinkId(deviceId);
9612
9650
  }
@@ -13128,7 +13166,7 @@ class WSConnectionFallback {
13128
13166
  }
13129
13167
  }
13130
13168
 
13131
- const version = '0.3.21';
13169
+ const version = '0.3.23';
13132
13170
 
13133
13171
  const logger = getLogger(['location']);
13134
13172
  const HINT_URL = `https://hint.stream-io-video.com/`;
@@ -14108,39 +14146,5 @@ class StreamVideoServerClient extends StreamVideoClient {
14108
14146
  }
14109
14147
  }
14110
14148
 
14111
- /**
14112
- * Checks whether the current browser is Safari.
14113
- */
14114
- const isSafari = () => {
14115
- if (typeof navigator === 'undefined')
14116
- return false;
14117
- return /^((?!chrome|android).)*safari/i.test(navigator.userAgent || '');
14118
- };
14119
- /**
14120
- * Checks whether the current browser is Firefox.
14121
- */
14122
- const isFirefox = () => {
14123
- var _a;
14124
- if (typeof navigator === 'undefined')
14125
- return false;
14126
- return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Firefox');
14127
- };
14128
- /**
14129
- * Checks whether the current browser is Google Chrome.
14130
- */
14131
- const isChrome = () => {
14132
- var _a;
14133
- if (typeof navigator === 'undefined')
14134
- return false;
14135
- return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Chrome');
14136
- };
14137
-
14138
- var browsers = /*#__PURE__*/Object.freeze({
14139
- __proto__: null,
14140
- isChrome: isChrome,
14141
- isFirefox: isFirefox,
14142
- isSafari: isSafari
14143
- });
14144
-
14145
14149
  export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
14146
14150
  //# sourceMappingURL=index.es.js.map