@stream-io/video-client 0.0.1-alpha.132 → 0.0.1-alpha.134

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,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.1-alpha.134](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.133...client0.0.1-alpha.134) (2023-05-11)
6
+
7
+
8
+ ### Features
9
+
10
+ * server-side participant counting ([#481](https://github.com/GetStream/stream-video-js/issues/481)) ([3410c25](https://github.com/GetStream/stream-video-js/commit/3410c25ec1449f4d39b44080ad64238b38446612))
11
+
12
+
13
+
14
+ ## [0.0.1-alpha.133](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.132...client0.0.1-alpha.133) (2023-05-11)
15
+
16
+
17
+
5
18
  ## [0.0.1-alpha.132](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.131...client0.0.1-alpha.132) (2023-05-11)
6
19
 
7
20
 
@@ -6294,6 +6294,13 @@ class CallState {
6294
6294
  * @internal
6295
6295
  */
6296
6296
  this.callingStateSubject = new BehaviorSubject(CallingState.UNKNOWN);
6297
+ /**
6298
+ * The server-side counted number of participants connected to the current call.
6299
+ * This number includes the anonymous participants as well.
6300
+ *
6301
+ * @internal
6302
+ */
6303
+ this.participantCountSubject = new BehaviorSubject(0);
6297
6304
  /**
6298
6305
  * All participants of the current call (including the logged-in user).
6299
6306
  *
@@ -6358,6 +6365,15 @@ class CallState {
6358
6365
  * @return the updated value.
6359
6366
  */
6360
6367
  this.setCurrentValue = setCurrentValue;
6368
+ /**
6369
+ * Sets the number of participants in the current call.
6370
+ *
6371
+ * @internal
6372
+ * @param count the number of participants.
6373
+ */
6374
+ this.setParticipantCount = (count) => {
6375
+ return this.setCurrentValue(this.participantCountSubject, count);
6376
+ };
6361
6377
  /**
6362
6378
  * Sets the list of participants in the current call.
6363
6379
  *
@@ -6480,6 +6496,7 @@ class CallState {
6480
6496
  this.hasOngoingScreenShare$ = this.participants$.pipe(map$1((participants) => {
6481
6497
  return participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE));
6482
6498
  }), distinctUntilChanged());
6499
+ this.participantCount$ = this.participantCountSubject.asObservable();
6483
6500
  this.callStatsReport$ = this.callStatsReportSubject.asObservable();
6484
6501
  this.callPermissionRequest$ =
6485
6502
  this.callPermissionRequestSubject.asObservable();
@@ -6488,6 +6505,13 @@ class CallState {
6488
6505
  this.members$ = this.membersSubject.asObservable();
6489
6506
  this.callingState$ = this.callingStateSubject.asObservable();
6490
6507
  }
6508
+ /**
6509
+ * The server-side counted number of participants connected to the current call.
6510
+ * This number includes the anonymous participants as well.
6511
+ */
6512
+ get participantCount() {
6513
+ return this.getCurrentValue(this.participantCount$);
6514
+ }
6491
6515
  /**
6492
6516
  * The list of participants in the current call.
6493
6517
  */
@@ -6868,6 +6892,18 @@ const watchConnectionQualityChanged = (dispatcher, state) => {
6868
6892
  }, {}));
6869
6893
  });
6870
6894
  };
6895
+ /**
6896
+ * Updates the approximate number of participants in the call by peeking at the
6897
+ * health check events that our SFU sends.
6898
+ */
6899
+ const watchParticipantCountChanged = (dispatcher, state) => {
6900
+ return dispatcher.on('healthCheckResponse', (e) => {
6901
+ if (e.eventPayload.oneofKind !== 'healthCheckResponse')
6902
+ return;
6903
+ const healthCheckResponse = e.eventPayload.healthCheckResponse;
6904
+ state.setParticipantCount(healthCheckResponse.participantCount);
6905
+ });
6906
+ };
6871
6907
 
6872
6908
  /**
6873
6909
  * An event responder which handles the `participantJoined` event.
@@ -7063,6 +7099,7 @@ const registerEventHandlers = (call, state, dispatcher) => {
7063
7099
  const eventHandlers = [
7064
7100
  watchChangePublishQuality(dispatcher, call),
7065
7101
  watchConnectionQualityChanged(dispatcher, state),
7102
+ watchParticipantCountChanged(dispatcher, state),
7066
7103
  watchParticipantJoined(dispatcher, state),
7067
7104
  watchParticipantLeft(dispatcher, state),
7068
7105
  watchTrackPublished(dispatcher, state),
@@ -10329,7 +10366,7 @@ class StreamClient {
10329
10366
  }
10330
10367
  getUserAgent() {
10331
10368
  return (this.userAgent ||
10332
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.131"}`);
10369
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.133"}`);
10333
10370
  }
10334
10371
  setUserAgent(userAgent) {
10335
10372
  this.userAgent = userAgent;