@stream-io/video-client 0.0.30 → 0.0.32

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.0.32](https://github.com/GetStream/stream-video-js/compare/client0.0.31...client0.0.32) (2023-07-04)
6
+
7
+
8
+ ### Features
9
+
10
+ * stop tracking permission requests in Call state ([#744](https://github.com/GetStream/stream-video-js/issues/744)) ([b330df3](https://github.com/GetStream/stream-video-js/commit/b330df39d9dce34d9e5a1a7ec58acb0a905ee07b))
11
+
12
+ ### [0.0.31](https://github.com/GetStream/stream-video-js/compare/client0.0.30...client0.0.31) (2023-07-03)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * safeguard against potential race conditions during join-flow ([#741](https://github.com/GetStream/stream-video-js/issues/741)) ([54f1ef6](https://github.com/GetStream/stream-video-js/commit/54f1ef636d3c46b29c538a8c2c7bc5031fde43c9))
18
+
5
19
  ### [0.0.30](https://github.com/GetStream/stream-video-js/compare/client0.0.29...client0.0.30) (2023-07-03)
6
20
 
7
21
 
@@ -7554,13 +7554,6 @@ class CallState {
7554
7554
  * Emits a list of details about recordings performed for the current call.
7555
7555
  */
7556
7556
  this.callRecordingListSubject = new BehaviorSubject([]);
7557
- /**
7558
- * Emits the latest call permission request sent by any participant of the
7559
- * current call.
7560
- *
7561
- * @internal
7562
- */
7563
- this.callPermissionRequestSubject = new BehaviorSubject(undefined);
7564
7557
  /**
7565
7558
  * A list of comparators that are used to sort the participants.
7566
7559
  *
@@ -7652,15 +7645,6 @@ class CallState {
7652
7645
  this.setCallRecordingsList = (recordings) => {
7653
7646
  return this.setCurrentValue(this.callRecordingListSubject, recordings);
7654
7647
  };
7655
- /**
7656
- * Sets the last call permission request.
7657
- *
7658
- * @internal
7659
- * @param request the last call permission request.
7660
- */
7661
- this.setCallPermissionRequest = (request) => {
7662
- return this.setCurrentValue(this.callPermissionRequestSubject, request);
7663
- };
7664
7648
  /**
7665
7649
  * Sets the call stats report.
7666
7650
  *
@@ -7792,8 +7776,6 @@ class CallState {
7792
7776
  this.anonymousParticipantCount$ =
7793
7777
  this.anonymousParticipantCountSubject.asObservable();
7794
7778
  this.callStatsReport$ = this.callStatsReportSubject.asObservable();
7795
- this.callPermissionRequest$ =
7796
- this.callPermissionRequestSubject.asObservable();
7797
7779
  this.callRecordingList$ = this.callRecordingListSubject.asObservable();
7798
7780
  this.metadata$ = this.metadataSubject.asObservable();
7799
7781
  this.members$ = this.membersSubject.asObservable();
@@ -7869,12 +7851,6 @@ class CallState {
7869
7851
  get callRecordingsList() {
7870
7852
  return this.getCurrentValue(this.callRecordingList$);
7871
7853
  }
7872
- /**
7873
- * The last call permission request.
7874
- */
7875
- get callPermissionRequest() {
7876
- return this.getCurrentValue(this.callPermissionRequest$);
7877
- }
7878
7854
  /**
7879
7855
  * The call stats report.
7880
7856
  */
@@ -7990,20 +7966,6 @@ const watchCallUpdated = (state) => {
7990
7966
  };
7991
7967
  };
7992
7968
 
7993
- /**
7994
- * Event handler that watches for `call.permission_request` events
7995
- * Updates the state store using the `callPermissionRequest$` stream
7996
- */
7997
- const watchCallPermissionRequest = (state) => {
7998
- return function onCallPermissionRequest(event) {
7999
- if (event.type !== 'call.permission_request')
8000
- return;
8001
- const { localParticipant } = state;
8002
- if (event.user.id !== (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.userId)) {
8003
- state.setCallPermissionRequest(event);
8004
- }
8005
- };
8006
- };
8007
7969
  /**
8008
7970
  * Event handler that watches for `call.permissions_updated` events
8009
7971
  */
@@ -8162,38 +8124,45 @@ const watchCallMemberUpdated = (state) => {
8162
8124
  /**
8163
8125
  * An event responder which handles the `participantJoined` event.
8164
8126
  */
8165
- const watchParticipantJoined = (dispatcher, state) => {
8166
- return dispatcher.on('participantJoined', (e) => {
8127
+ const watchParticipantJoined = (state) => {
8128
+ return function onParticipantJoined(e) {
8167
8129
  if (e.eventPayload.oneofKind !== 'participantJoined')
8168
8130
  return;
8169
8131
  const { participant } = e.eventPayload.participantJoined;
8170
8132
  if (!participant)
8171
8133
  return;
8172
- state.setParticipants((participants) => [
8173
- ...participants,
8174
- Object.assign(Object.assign({}, participant), { viewportVisibilityState: VisibilityState.UNKNOWN }),
8175
- ]);
8176
- });
8134
+ // `state.updateOrAddParticipant` acts as a safeguard against
8135
+ // potential duplicate events from the SFU.
8136
+ //
8137
+ // Although the SFU should not send duplicate events, we have seen
8138
+ // some race conditions in the past during the `join-flow` where
8139
+ // the SFU would send participant info as part of the `join`
8140
+ // response and then follow up with a `participantJoined` event for
8141
+ // already announced participants.
8142
+ state.updateOrAddParticipant(participant.sessionId, Object.assign(participant, {
8143
+ viewportVisibilityState: VisibilityState.UNKNOWN,
8144
+ }));
8145
+ };
8177
8146
  };
8178
8147
  /**
8179
8148
  * An event responder which handles the `participantLeft` event.
8180
8149
  */
8181
- const watchParticipantLeft = (dispatcher, state) => {
8182
- return dispatcher.on('participantLeft', (e) => {
8150
+ const watchParticipantLeft = (state) => {
8151
+ return function onParticipantLeft(e) {
8183
8152
  if (e.eventPayload.oneofKind !== 'participantLeft')
8184
8153
  return;
8185
8154
  const { participant } = e.eventPayload.participantLeft;
8186
8155
  if (!participant)
8187
8156
  return;
8188
8157
  state.setParticipants((participants) => participants.filter((p) => p.sessionId !== participant.sessionId));
8189
- });
8158
+ };
8190
8159
  };
8191
8160
  /**
8192
8161
  * An event responder which handles the `trackPublished` event.
8193
8162
  * The SFU will send this event when a participant publishes a track.
8194
8163
  */
8195
- const watchTrackPublished = (dispatcher, state) => {
8196
- return dispatcher.on('trackPublished', (e) => {
8164
+ const watchTrackPublished = (state) => {
8165
+ return function onTrackPublished(e) {
8197
8166
  if (e.eventPayload.oneofKind !== 'trackPublished')
8198
8167
  return;
8199
8168
  const { trackPublished: { type, sessionId, participant }, } = e.eventPayload;
@@ -8202,34 +8171,34 @@ const watchTrackPublished = (dispatcher, state) => {
8202
8171
  // events, and instead, it would only provide the participant's information
8203
8172
  // once they start publishing a track.
8204
8173
  if (participant) {
8205
- state.updateOrAddParticipant(participant.sessionId, participant);
8174
+ state.updateOrAddParticipant(sessionId, participant);
8206
8175
  }
8207
8176
  else {
8208
8177
  state.updateParticipant(sessionId, (p) => ({
8209
8178
  publishedTracks: [...p.publishedTracks, type].filter(unique),
8210
8179
  }));
8211
8180
  }
8212
- });
8181
+ };
8213
8182
  };
8214
8183
  /**
8215
8184
  * An event responder which handles the `trackUnpublished` event.
8216
8185
  * The SFU will send this event when a participant unpublishes a track.
8217
8186
  */
8218
- const watchTrackUnpublished = (dispatcher, state) => {
8219
- return dispatcher.on('trackUnpublished', (e) => {
8187
+ const watchTrackUnpublished = (state) => {
8188
+ return function onTrackUnpublished(e) {
8220
8189
  if (e.eventPayload.oneofKind !== 'trackUnpublished')
8221
8190
  return;
8222
8191
  const { trackUnpublished: { type, sessionId, participant }, } = e.eventPayload;
8223
8192
  // An optimization for large calls. See `watchTrackPublished`.
8224
8193
  if (participant) {
8225
- state.updateOrAddParticipant(participant.sessionId, participant);
8194
+ state.updateOrAddParticipant(sessionId, participant);
8226
8195
  }
8227
8196
  else {
8228
8197
  state.updateParticipant(sessionId, (p) => ({
8229
8198
  publishedTracks: p.publishedTracks.filter((t) => t !== type),
8230
8199
  }));
8231
8200
  }
8232
- });
8201
+ };
8233
8202
  };
8234
8203
  const unique = (v, i, arr) => arr.indexOf(v) === i;
8235
8204
 
@@ -8459,7 +8428,6 @@ const registerEventHandlers = (call, state, dispatcher) => {
8459
8428
  'call.member_removed': watchCallMemberRemoved(state),
8460
8429
  'call.member_updated': watchCallMemberUpdated(state),
8461
8430
  'call.member_updated_permission': watchCallMemberUpdatedPermission(state),
8462
- 'call.permission_request': watchCallPermissionRequest(state),
8463
8431
  'call.permissions_updated': watchCallPermissionsUpdated(state),
8464
8432
  'call.reaction_new': watchNewReactions(state),
8465
8433
  'call.recording_started': watchCallRecordingStarted(state),
@@ -8477,10 +8445,10 @@ const registerEventHandlers = (call, state, dispatcher) => {
8477
8445
  watchChangePublishQuality(dispatcher, call),
8478
8446
  watchConnectionQualityChanged(dispatcher, state),
8479
8447
  watchParticipantCountChanged(dispatcher, state),
8480
- watchParticipantJoined(dispatcher, state),
8481
- watchParticipantLeft(dispatcher, state),
8482
- watchTrackPublished(dispatcher, state),
8483
- watchTrackUnpublished(dispatcher, state),
8448
+ call.on('participantJoined', watchParticipantJoined(state)),
8449
+ call.on('participantLeft', watchParticipantLeft(state)),
8450
+ call.on('trackPublished', watchTrackPublished(state)),
8451
+ call.on('trackUnpublished', watchTrackUnpublished(state)),
8484
8452
  watchAudioLevelChanged(dispatcher, state),
8485
8453
  watchDominantSpeakerChanged(dispatcher, state),
8486
8454
  call.on('callGrantsUpdated', watchCallGrantsUpdated(state)),
@@ -11871,7 +11839,7 @@ class StreamClient {
11871
11839
  }
11872
11840
  getUserAgent() {
11873
11841
  return (this.userAgent ||
11874
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.29"}`);
11842
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.31"}`);
11875
11843
  }
11876
11844
  setUserAgent(userAgent) {
11877
11845
  this.userAgent = userAgent;