@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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.3.23](https://github.com/GetStream/stream-video-js/compare/client0.3.22...client0.3.23) (2023-09-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add type check of deviceId before setting sinkId ([#1108](https://github.com/GetStream/stream-video-js/issues/1108)) ([705515e](https://github.com/GetStream/stream-video-js/commit/705515e5f63a35286fdb45725b9e299afe09c9bb))
11
+
12
+ ### [0.3.22](https://github.com/GetStream/stream-video-js/compare/client0.3.21...client0.3.22) (2023-09-25)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Add extra delay before attempting to play video in Safari and Firefox ([#1106](https://github.com/GetStream/stream-video-js/issues/1106)) ([5b4a589](https://github.com/GetStream/stream-video-js/commit/5b4a58918240a7b63807726609d6d54b92cfe1d2))
18
+
5
19
  ### [0.3.21](https://github.com/GetStream/stream-video-js/compare/client0.3.20...client0.3.21) (2023-09-20)
6
20
 
7
21
 
@@ -9366,6 +9366,40 @@ class ViewportTracker {
9366
9366
  }
9367
9367
  }
9368
9368
 
9369
+ /**
9370
+ * Checks whether the current browser is Safari.
9371
+ */
9372
+ const isSafari = () => {
9373
+ if (typeof navigator === 'undefined')
9374
+ return false;
9375
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent || '');
9376
+ };
9377
+ /**
9378
+ * Checks whether the current browser is Firefox.
9379
+ */
9380
+ const isFirefox = () => {
9381
+ var _a;
9382
+ if (typeof navigator === 'undefined')
9383
+ return false;
9384
+ return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Firefox');
9385
+ };
9386
+ /**
9387
+ * Checks whether the current browser is Google Chrome.
9388
+ */
9389
+ const isChrome = () => {
9390
+ var _a;
9391
+ if (typeof navigator === 'undefined')
9392
+ return false;
9393
+ return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Chrome');
9394
+ };
9395
+
9396
+ var browsers = /*#__PURE__*/Object.freeze({
9397
+ __proto__: null,
9398
+ isChrome: isChrome,
9399
+ isFirefox: isFirefox,
9400
+ isSafari: isSafari
9401
+ });
9402
+
9369
9403
  const DEFAULT_VIEWPORT_VISIBILITY_STATE = {
9370
9404
  videoTrack: VisibilityState.UNKNOWN,
9371
9405
  screenShareTrack: VisibilityState.UNKNOWN,
@@ -9536,27 +9570,31 @@ class DynascaleManager {
9536
9570
  requestTrackWithDimensions(DebounceType.FAST, undefined);
9537
9571
  }
9538
9572
  });
9573
+ videoElement.autoplay = true;
9574
+ videoElement.playsInline = true;
9575
+ // explicitly marking the element as muted will allow autoplay to work
9576
+ // without prior user interaction:
9577
+ // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9578
+ videoElement.muted = true;
9539
9579
  const streamSubscription = participant$
9540
9580
  .pipe(distinctUntilKeyChanged(trackType === 'videoTrack' ? 'videoStream' : 'screenShareStream'))
9541
9581
  .subscribe((p) => {
9542
9582
  const source = trackType === 'videoTrack' ? p.videoStream : p.screenShareStream;
9543
9583
  if (videoElement.srcObject === source)
9544
9584
  return;
9545
- setTimeout(() => {
9546
- videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9547
- if (videoElement.srcObject) {
9585
+ videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9586
+ if (isSafari() || isFirefox()) {
9587
+ setTimeout(() => {
9588
+ videoElement.srcObject = source !== null && source !== void 0 ? source : null;
9548
9589
  videoElement.play().catch((e) => {
9549
9590
  this.logger('warn', `Failed to play stream`, e);
9550
9591
  });
9551
- }
9552
- }, 0);
9592
+ // we add extra delay until we attempt to force-play
9593
+ // the participant's media stream in Firefox and Safari,
9594
+ // as they seem to have some timing issues
9595
+ }, 25);
9596
+ }
9553
9597
  });
9554
- videoElement.playsInline = true;
9555
- videoElement.autoplay = true;
9556
- // explicitly marking the element as muted will allow autoplay to work
9557
- // without prior user interaction:
9558
- // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9559
- videoElement.muted = true;
9560
9598
  return () => {
9561
9599
  requestTrackWithDimensions(DebounceType.FAST, undefined);
9562
9600
  viewportVisibilityStateSubscription === null || viewportVisibilityStateSubscription === void 0 ? void 0 : viewportVisibilityStateSubscription.unsubscribe();
@@ -9603,7 +9641,7 @@ class DynascaleManager {
9603
9641
  const deviceId = ((_a = getSdkInfo()) === null || _a === void 0 ? void 0 : _a.type) === SdkType.REACT
9604
9642
  ? p === null || p === void 0 ? void 0 : p.audioOutputDeviceId
9605
9643
  : selectedDevice;
9606
- if ('setSinkId' in audioElement) {
9644
+ if ('setSinkId' in audioElement && typeof deviceId === 'string') {
9607
9645
  // @ts-expect-error setSinkId is not yet in the lib
9608
9646
  audioElement.setSinkId(deviceId);
9609
9647
  }
@@ -13124,7 +13162,7 @@ class WSConnectionFallback {
13124
13162
  }
13125
13163
  }
13126
13164
 
13127
- const version = '0.3.21';
13165
+ const version = '0.3.23';
13128
13166
 
13129
13167
  const logger = getLogger(['location']);
13130
13168
  const HINT_URL = `https://hint.stream-io-video.com/`;
@@ -14104,39 +14142,5 @@ class StreamVideoServerClient extends StreamVideoClient {
14104
14142
  }
14105
14143
  }
14106
14144
 
14107
- /**
14108
- * Checks whether the current browser is Safari.
14109
- */
14110
- const isSafari = () => {
14111
- if (typeof navigator === 'undefined')
14112
- return false;
14113
- return /^((?!chrome|android).)*safari/i.test(navigator.userAgent || '');
14114
- };
14115
- /**
14116
- * Checks whether the current browser is Firefox.
14117
- */
14118
- const isFirefox = () => {
14119
- var _a;
14120
- if (typeof navigator === 'undefined')
14121
- return false;
14122
- return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Firefox');
14123
- };
14124
- /**
14125
- * Checks whether the current browser is Google Chrome.
14126
- */
14127
- const isChrome = () => {
14128
- var _a;
14129
- if (typeof navigator === 'undefined')
14130
- return false;
14131
- return (_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('Chrome');
14132
- };
14133
-
14134
- var browsers = /*#__PURE__*/Object.freeze({
14135
- __proto__: null,
14136
- isChrome: isChrome,
14137
- isFirefox: isFirefox,
14138
- isSafari: isSafari
14139
- });
14140
-
14141
14145
  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 };
14142
14146
  //# sourceMappingURL=index.browser.es.js.map