@stream-io/video-client 1.5.0 → 1.5.2

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
+ ### [1.5.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.5.1...@stream-io/video-client-1.5.2) (2024-08-23)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * handle session_participant_count_updated event ([#1467](https://github.com/GetStream/stream-video-js/issues/1467)) ([55af565](https://github.com/GetStream/stream-video-js/commit/55af565ea259a7fcb4298f4df63d05e4b346ed5a))
11
+
12
+ ### [1.5.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.5.0...@stream-io/video-client-1.5.1) (2024-08-23)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * do not use ended_at from call state to check ringing validity ([#1466](https://github.com/GetStream/stream-video-js/issues/1466)) ([4af7f00](https://github.com/GetStream/stream-video-js/commit/4af7f0060db24923fb5dab43d1f2a709ef9acd29))
18
+
5
19
  ## [1.5.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.4.8...@stream-io/video-client-1.5.0) (2024-08-21)
6
20
 
7
21
 
@@ -6535,7 +6535,7 @@ function getIceCandidate(candidate) {
6535
6535
  }
6536
6536
  }
6537
6537
 
6538
- const version = "1.5.0" ;
6538
+ const version = "1.5.2" ;
6539
6539
  const [major, minor, patch] = version.split('.');
6540
6540
  let sdkInfo = {
6541
6541
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -7533,7 +7533,8 @@ class CallState {
7533
7533
  this.setCurrentValue(this.egressSubject, call.egress);
7534
7534
  this.setCurrentValue(this.ingressSubject, call.ingress);
7535
7535
  this.setCurrentValue(this.recordingSubject, call.recording);
7536
- this.setCurrentValue(this.sessionSubject, call.session);
7536
+ const s = this.setCurrentValue(this.sessionSubject, call.session);
7537
+ this.updateParticipantCountFromSession(s);
7537
7538
  this.setCurrentValue(this.settingsSubject, call.settings);
7538
7539
  this.setCurrentValue(this.transcribingSubject, call.transcribing);
7539
7540
  this.setCurrentValue(this.thumbnailsSubject, call.thumbnails);
@@ -7571,12 +7572,32 @@ class CallState {
7571
7572
  },
7572
7573
  }));
7573
7574
  };
7575
+ this.updateParticipantCountFromSession = (session) => {
7576
+ // when in JOINED state, we should use the participant count coming through
7577
+ // the SFU healthcheck event, as it's more accurate.
7578
+ if (!session || this.callingState === CallingState.JOINED)
7579
+ return;
7580
+ const byRoleCount = Object.values(session.participants_count_by_role).reduce((total, countByRole) => total + countByRole, 0);
7581
+ const participantCount = Math.max(byRoleCount, session.participants.length);
7582
+ this.setParticipantCount(participantCount);
7583
+ this.setAnonymousParticipantCount(session.anonymous_participant_count || 0);
7584
+ };
7585
+ this.updateFromSessionParticipantCountUpdate = (event) => {
7586
+ const s = this.setCurrentValue(this.sessionSubject, (session) => {
7587
+ if (!session)
7588
+ return session;
7589
+ return {
7590
+ ...session,
7591
+ anonymous_participant_count: event.anonymous_participant_count,
7592
+ participants_count_by_role: event.participants_count_by_role,
7593
+ };
7594
+ });
7595
+ this.updateParticipantCountFromSession(s);
7596
+ };
7574
7597
  this.updateFromSessionParticipantLeft = (event) => {
7575
- this.setCurrentValue(this.sessionSubject, (session) => {
7576
- if (!session) {
7577
- this.logger('warn', `Received call.session_participant_left event but no session is available.`, event);
7598
+ const s = this.setCurrentValue(this.sessionSubject, (session) => {
7599
+ if (!session)
7578
7600
  return session;
7579
- }
7580
7601
  const { participants, participants_count_by_role } = session;
7581
7602
  const { user, user_session_id } = event.participant;
7582
7603
  return {
@@ -7588,13 +7609,12 @@ class CallState {
7588
7609
  },
7589
7610
  };
7590
7611
  });
7612
+ this.updateParticipantCountFromSession(s);
7591
7613
  };
7592
7614
  this.updateFromSessionParticipantJoined = (event) => {
7593
- this.setCurrentValue(this.sessionSubject, (session) => {
7594
- if (!session) {
7595
- this.logger('warn', `Received call.session_participant_joined event but no session is available.`, event);
7615
+ const s = this.setCurrentValue(this.sessionSubject, (session) => {
7616
+ if (!session)
7596
7617
  return session;
7597
- }
7598
7618
  const { participants, participants_count_by_role } = session;
7599
7619
  const { user, user_session_id } = event.participant;
7600
7620
  // It could happen that the backend delivers the same participant more than once.
@@ -7625,6 +7645,7 @@ class CallState {
7625
7645
  },
7626
7646
  };
7627
7647
  });
7648
+ this.updateParticipantCountFromSession(s);
7628
7649
  };
7629
7650
  this.updateMembers = (event) => {
7630
7651
  this.updateFromCallResponse(event.call);
@@ -7774,6 +7795,7 @@ class CallState {
7774
7795
  'call.ring': (e) => this.updateFromCallResponse(e.call),
7775
7796
  'call.missed': (e) => this.updateFromCallResponse(e.call),
7776
7797
  'call.session_ended': (e) => this.updateFromCallResponse(e.call),
7798
+ 'call.session_participant_count_updated': this.updateFromSessionParticipantCountUpdate,
7777
7799
  'call.session_participant_joined': this.updateFromSessionParticipantJoined,
7778
7800
  'call.session_participant_left': this.updateFromSessionParticipantLeft,
7779
7801
  'call.session_started': (e) => this.updateFromCallResponse(e.call),
@@ -13931,12 +13953,12 @@ class Call {
13931
13953
  return;
13932
13954
  const callSession = this.state.session;
13933
13955
  const receiver_id = this.clientStore.connectedUser?.id;
13934
- const endedAt = this.state.endedAt;
13956
+ const ended_at = callSession?.ended_at;
13935
13957
  const created_by_id = this.state.createdBy?.id;
13936
13958
  const rejected_by = callSession?.rejected_by;
13937
13959
  const accepted_by = callSession?.accepted_by;
13938
13960
  let leaveCallIdle = false;
13939
- if (endedAt) {
13961
+ if (ended_at) {
13940
13962
  // call was ended before it was accepted or rejected so we should leave it to idle
13941
13963
  leaveCallIdle = true;
13942
13964
  }
@@ -13964,10 +13986,10 @@ class Call {
13964
13986
  }
13965
13987
  }
13966
13988
  else {
13967
- this.scheduleAutoDrop();
13968
13989
  if (this.state.callingState === CallingState.IDLE) {
13969
13990
  this.state.setCallingState(CallingState.RINGING);
13970
13991
  }
13992
+ this.scheduleAutoDrop();
13971
13993
  this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
13972
13994
  }
13973
13995
  }));
@@ -15572,7 +15594,7 @@ class StreamClient {
15572
15594
  });
15573
15595
  };
15574
15596
  this.getUserAgent = () => {
15575
- const version = "1.5.0" ;
15597
+ const version = "1.5.2" ;
15576
15598
  return (this.userAgent ||
15577
15599
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
15578
15600
  };