@stream-io/video-client 0.3.24 → 0.3.26

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.26](https://github.com/GetStream/stream-video-js/compare/client0.3.25...client0.3.26) (2023-09-27)
6
+
7
+
8
+ ### Features
9
+
10
+ * **Call Preview:** Support for call thumbnails ([#1099](https://github.com/GetStream/stream-video-js/issues/1099)) ([9274f76](https://github.com/GetStream/stream-video-js/commit/9274f760ed264ee0ee6ac97c6fe679288e067fd8))
11
+
12
+ ### [0.3.25](https://github.com/GetStream/stream-video-js/compare/client0.3.24...client0.3.25) (2023-09-27)
13
+
14
+
15
+ ### Features
16
+
17
+ * **react-sdk:** LivestreamLayout ([#1103](https://github.com/GetStream/stream-video-js/issues/1103)) ([6636699](https://github.com/GetStream/stream-video-js/commit/6636699701dfd5eb5886c50781dd5f16a8470da5))
18
+
5
19
  ### [0.3.24](https://github.com/GetStream/stream-video-js/compare/client0.3.23...client0.3.24) (2023-09-26)
6
20
 
7
21
 
@@ -34,6 +34,26 @@ const CreateDeviceRequestPushProviderEnum = {
34
34
  HUAWEI: 'huawei',
35
35
  XIAOMI: 'xiaomi',
36
36
  };
37
+ /**
38
+ * @export
39
+ */
40
+ const LayoutSettingsNameEnum = {
41
+ SPOTLIGHT: 'spotlight',
42
+ GRID: 'grid',
43
+ SINGLE_PARTICIPANT: 'single-participant',
44
+ MOBILE: 'mobile',
45
+ CUSTOM: 'custom',
46
+ };
47
+ /**
48
+ * @export
49
+ */
50
+ const LayoutSettingsRequestNameEnum = {
51
+ SPOTLIGHT: 'spotlight',
52
+ GRID: 'grid',
53
+ SINGLE_PARTICIPANT: 'single-participant',
54
+ MOBILE: 'mobile',
55
+ CUSTOM: 'custom',
56
+ };
37
57
  /**
38
58
  * All possibility of string to use
39
59
  * @export
@@ -64,25 +84,6 @@ const OwnCapability = {
64
84
  UPDATE_CALL_PERMISSIONS: 'update-call-permissions',
65
85
  UPDATE_CALL_SETTINGS: 'update-call-settings',
66
86
  };
67
- /**
68
- * @export
69
- */
70
- const RecordSettingsModeEnum = {
71
- AVAILABLE: 'available',
72
- DISABLED: 'disabled',
73
- AUTO_ON: 'auto-on',
74
- };
75
- /**
76
- * @export
77
- */
78
- const RecordSettingsQualityEnum = {
79
- AUDIO_ONLY: 'audio-only',
80
- _360P: '360p',
81
- _480P: '480p',
82
- _720P: '720p',
83
- _1080P: '1080p',
84
- _1440P: '1440p',
85
- };
86
87
  /**
87
88
  * @export
88
89
  */
@@ -95,7 +96,6 @@ const RecordSettingsRequestModeEnum = {
95
96
  * @export
96
97
  */
97
98
  const RecordSettingsRequestQualityEnum = {
98
- AUDIO_ONLY: 'audio-only',
99
99
  _360P: '360p',
100
100
  _480P: '480p',
101
101
  _720P: '720p',
@@ -7889,6 +7889,18 @@ const ifInvisibleBy = conditional((a, b) => {
7889
7889
  return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === VisibilityState.INVISIBLE ||
7890
7890
  ((_b = b.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === VisibilityState.INVISIBLE;
7891
7891
  });
7892
+ /**
7893
+ * A comparator that applies the decorated comparator when a participant is
7894
+ * either invisible or its visibility state isn't known.
7895
+ * For visible participants, it ensures stable sorting.
7896
+ */
7897
+ const ifInvisibleOrUnknownBy = conditional((a, b) => {
7898
+ var _a, _b, _c, _d;
7899
+ return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === VisibilityState.INVISIBLE ||
7900
+ ((_b = a.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === VisibilityState.UNKNOWN ||
7901
+ ((_c = b.viewportVisibilityState) === null || _c === void 0 ? void 0 : _c.videoTrack) === VisibilityState.INVISIBLE ||
7902
+ ((_d = b.viewportVisibilityState) === null || _d === void 0 ? void 0 : _d.videoTrack) === VisibilityState.UNKNOWN;
7903
+ });
7892
7904
  /**
7893
7905
  * The default sorting preset.
7894
7906
  */
@@ -7897,6 +7909,11 @@ const defaultSortPreset = combineComparators(pinned, screenSharing, ifInvisibleB
7897
7909
  * The sorting preset for speaker layout.
7898
7910
  */
7899
7911
  const speakerLayoutSortPreset = combineComparators(pinned, screenSharing, dominantSpeaker, ifInvisibleBy(speaking), ifInvisibleBy(reactionType('raised-hand')), ifInvisibleBy(publishingVideo), ifInvisibleBy(publishingAudio));
7912
+ /**
7913
+ * The sorting preset for layouts that don't render all participants but
7914
+ * instead, render them in pages.
7915
+ */
7916
+ const paginatedLayoutSortPreset = combineComparators(pinned, screenSharing, dominantSpeaker, ifInvisibleOrUnknownBy(speaking), ifInvisibleOrUnknownBy(reactionType('raised-hand')), ifInvisibleOrUnknownBy(publishingVideo), ifInvisibleOrUnknownBy(publishingAudio));
7900
7917
  /**
7901
7918
  * The sorting preset for livestreams and audio rooms.
7902
7919
  */
@@ -7974,6 +7991,7 @@ class CallState {
7974
7991
  this.settingsSubject = new BehaviorSubject(undefined);
7975
7992
  this.transcribingSubject = new BehaviorSubject(false);
7976
7993
  this.endedBySubject = new BehaviorSubject(undefined);
7994
+ this.thumbnailsSubject = new BehaviorSubject(undefined);
7977
7995
  this.membersSubject = new BehaviorSubject([]);
7978
7996
  this.ownCapabilitiesSubject = new BehaviorSubject([]);
7979
7997
  this.callingStateSubject = new BehaviorSubject(CallingState.UNKNOWN);
@@ -8234,6 +8252,7 @@ class CallState {
8234
8252
  this.setCurrentValue(this.sessionSubject, call.session);
8235
8253
  this.setCurrentValue(this.settingsSubject, call.settings);
8236
8254
  this.setCurrentValue(this.transcribingSubject, call.transcribing);
8255
+ this.setCurrentValue(this.thumbnailsSubject, call.thumbnails);
8237
8256
  };
8238
8257
  this.updateFromMemberRemoved = (event) => {
8239
8258
  this.setCurrentValue(this.membersSubject, (members) => members.filter((m) => event.members.indexOf(m.user_id) === -1));
@@ -8244,10 +8263,10 @@ class CallState {
8244
8263
  ...event.members,
8245
8264
  ]);
8246
8265
  };
8247
- this.updateFromBroadcastStopped = () => {
8266
+ this.updateFromHLSBroadcastStopped = () => {
8248
8267
  this.setCurrentValue(this.egressSubject, (egress) => (Object.assign(Object.assign({}, egress), { broadcasting: false })));
8249
8268
  };
8250
- this.updateFromBroadcastStarted = (event) => {
8269
+ this.updateFromHLSBroadcastStarted = (event) => {
8251
8270
  this.setCurrentValue(this.egressSubject, (egress) => (Object.assign(Object.assign({}, egress), { broadcasting: true, hls: Object.assign(Object.assign({}, egress.hls), { playlist_url: event.hls_playlist_url }) })));
8252
8271
  };
8253
8272
  this.updateFromSessionParticipantLeft = (event) => {
@@ -8345,6 +8364,7 @@ class CallState {
8345
8364
  this.settings$ = this.settingsSubject.asObservable();
8346
8365
  this.transcribing$ = this.transcribingSubject.asObservable();
8347
8366
  this.endedBy$ = this.endedBySubject.asObservable();
8367
+ this.thumbnails$ = this.thumbnailsSubject.asObservable();
8348
8368
  this.eventHandlers = {
8349
8369
  // these events are not updating the call state:
8350
8370
  'call.permission_request': undefined,
@@ -8358,7 +8378,10 @@ class CallState {
8358
8378
  // events that update call state:
8359
8379
  'call.accepted': (e) => this.updateFromCallResponse(e.call),
8360
8380
  'call.created': (e) => this.updateFromCallResponse(e.call),
8361
- 'call.notification': (e) => this.updateFromCallResponse(e.call),
8381
+ 'call.notification': (e) => {
8382
+ this.updateFromCallResponse(e.call);
8383
+ this.setMembers(e.members);
8384
+ },
8362
8385
  'call.rejected': (e) => this.updateFromCallResponse(e.call),
8363
8386
  'call.ring': (e) => this.updateFromCallResponse(e.call),
8364
8387
  'call.live_started': (e) => this.updateFromCallResponse(e.call),
@@ -8371,8 +8394,8 @@ class CallState {
8371
8394
  },
8372
8395
  'call.recording_started': () => this.setCurrentValue(this.recordingSubject, true),
8373
8396
  'call.recording_stopped': () => this.setCurrentValue(this.recordingSubject, false),
8374
- 'call.broadcasting_started': this.updateFromBroadcastStarted,
8375
- 'call.broadcasting_stopped': this.updateFromBroadcastStopped,
8397
+ 'call.hls_broadcasting_started': this.updateFromHLSBroadcastStarted,
8398
+ 'call.hls_broadcasting_stopped': this.updateFromHLSBroadcastStopped,
8376
8399
  'call.session_participant_joined': this.updateFromSessionParticipantJoined,
8377
8400
  'call.session_participant_left': this.updateFromSessionParticipantLeft,
8378
8401
  'call.blocked_user': this.blockUser,
@@ -8556,6 +8579,12 @@ class CallState {
8556
8579
  get endedBy() {
8557
8580
  return this.getCurrentValue(this.endedBy$);
8558
8581
  }
8582
+ /**
8583
+ * Will provide the thumbnails of this call, if enabled in the call settings.
8584
+ */
8585
+ get thumbnails() {
8586
+ return this.getCurrentValue(this.thumbnails$);
8587
+ }
8559
8588
  }
8560
8589
 
8561
8590
  /**
@@ -11829,6 +11858,32 @@ class Call {
11829
11858
  unbind();
11830
11859
  };
11831
11860
  };
11861
+ /**
11862
+ * Binds a DOM <img> element to this call's thumbnail (if enabled in settings).
11863
+ *
11864
+ * @param imageElement the image element to bind to.
11865
+ * @param opts options for the binding.
11866
+ */
11867
+ this.bindCallThumbnailElement = (imageElement, opts = {}) => {
11868
+ const handleError = () => {
11869
+ imageElement.src =
11870
+ opts.fallbackImageSource ||
11871
+ 'https://getstream.io/random_svg/?name=x&id=x';
11872
+ };
11873
+ const unsubscribe = createSubscription(this.state.thumbnails$, (thumbnails) => {
11874
+ if (!thumbnails)
11875
+ return;
11876
+ imageElement.addEventListener('error', handleError);
11877
+ const thumbnailUrl = new URL(thumbnails.image_url);
11878
+ thumbnailUrl.searchParams.set('w', String(imageElement.clientWidth));
11879
+ thumbnailUrl.searchParams.set('h', String(imageElement.clientHeight));
11880
+ imageElement.src = thumbnailUrl.toString();
11881
+ });
11882
+ return () => {
11883
+ unsubscribe();
11884
+ imageElement.removeEventListener('error', handleError);
11885
+ };
11886
+ };
11832
11887
  this.type = type;
11833
11888
  this.id = id;
11834
11889
  this.cid = `${type}:${id}`;
@@ -13163,7 +13218,7 @@ class WSConnectionFallback {
13163
13218
  }
13164
13219
  }
13165
13220
 
13166
- const version = '0.3.24';
13221
+ const version = '0.3.26';
13167
13222
 
13168
13223
  const logger = getLogger(['location']);
13169
13224
  const HINT_URL = `https://hint.stream-io-video.com/`;
@@ -14143,5 +14198,5 @@ class StreamVideoServerClient extends StreamVideoClient {
14143
14198
  }
14144
14199
  }
14145
14200
 
14146
- 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 };
14201
+ export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsNameEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, OwnCapability, 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, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
14147
14202
  //# sourceMappingURL=index.browser.es.js.map