@stream-io/video-client 1.4.6 → 1.4.7

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,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [1.4.7](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.4.6...@stream-io/video-client-1.4.7) (2024-07-30)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * ringing state issues when call was already ended ([#1451](https://github.com/GetStream/stream-video-js/issues/1451)) ([4a3556e](https://github.com/GetStream/stream-video-js/commit/4a3556e0f7b0bd58d0022cc635aa4391014063d7))
11
+
5
12
  ### [1.4.6](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.4.5...@stream-io/video-client-1.4.6) (2024-07-25)
6
13
 
7
14
 
@@ -6535,7 +6535,7 @@ function getIceCandidate(candidate) {
6535
6535
  }
6536
6536
  }
6537
6537
 
6538
- const version = "1.4.6" ;
6538
+ const version = "1.4.7" ;
6539
6539
  const [major, minor, patch] = version.split('.');
6540
6540
  let sdkInfo = {
6541
6541
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -12603,12 +12603,13 @@ class Call {
12603
12603
  this.get = async (params) => {
12604
12604
  await this.setup();
12605
12605
  const response = await this.streamClient.get(this.streamClientBasePath, params);
12606
- if (params?.ring && !this.ringing) {
12607
- this.ringingSubject.next(true);
12608
- }
12609
12606
  this.state.updateFromCallResponse(response.call);
12610
12607
  this.state.setMembers(response.members);
12611
12608
  this.state.setOwnCapabilities(response.own_capabilities);
12609
+ if (params?.ring || this.ringing) {
12610
+ // the call response can indicate where the call is still ringing or not
12611
+ this.ringingSubject.next(true);
12612
+ }
12612
12613
  if (this.streamClient._hasConnectionID()) {
12613
12614
  this.watching = true;
12614
12615
  this.clientStore.registerCall(this);
@@ -12624,12 +12625,13 @@ class Call {
12624
12625
  this.getOrCreate = async (data) => {
12625
12626
  await this.setup();
12626
12627
  const response = await this.streamClient.post(this.streamClientBasePath, data);
12627
- if (data?.ring && !this.ringing) {
12628
- this.ringingSubject.next(true);
12629
- }
12630
12628
  this.state.updateFromCallResponse(response.call);
12631
12629
  this.state.setMembers(response.members);
12632
12630
  this.state.setOwnCapabilities(response.own_capabilities);
12631
+ if (data?.ring || this.ringing) {
12632
+ // the call response can indicate where the call is still ringing or not
12633
+ this.ringingSubject.next(true);
12634
+ }
12633
12635
  if (this.streamClient._hasConnectionID()) {
12634
12636
  this.watching = true;
12635
12637
  this.clientStore.registerCall(this);
@@ -13929,11 +13931,47 @@ class Call {
13929
13931
  createSubscription(this.ringingSubject, (isRinging) => {
13930
13932
  if (!isRinging)
13931
13933
  return;
13932
- this.scheduleAutoDrop();
13933
- if (this.state.callingState === CallingState.IDLE) {
13934
- this.state.setCallingState(CallingState.RINGING);
13934
+ const callSession = this.state.session;
13935
+ const receiver_id = this.clientStore.connectedUser?.id;
13936
+ const endedAt = this.state.endedAt;
13937
+ const created_by_id = this.state.createdBy?.id;
13938
+ const rejected_by = callSession?.rejected_by;
13939
+ const accepted_by = callSession?.accepted_by;
13940
+ let leaveCallIdle = false;
13941
+ if (endedAt) {
13942
+ // call was ended before it was accepted or rejected so we should leave it to idle
13943
+ leaveCallIdle = true;
13944
+ }
13945
+ else if (created_by_id && rejected_by) {
13946
+ if (rejected_by[created_by_id]) {
13947
+ // call was cancelled by the caller
13948
+ leaveCallIdle = true;
13949
+ }
13950
+ }
13951
+ else if (receiver_id && rejected_by) {
13952
+ if (rejected_by[receiver_id]) {
13953
+ // call was rejected by the receiver in some other device
13954
+ leaveCallIdle = true;
13955
+ }
13956
+ }
13957
+ else if (receiver_id && accepted_by) {
13958
+ if (accepted_by[receiver_id]) {
13959
+ // call was accepted by the receiver in some other device
13960
+ leaveCallIdle = true;
13961
+ }
13962
+ }
13963
+ if (leaveCallIdle) {
13964
+ if (this.state.callingState !== CallingState.IDLE) {
13965
+ this.state.setCallingState(CallingState.IDLE);
13966
+ }
13967
+ }
13968
+ else {
13969
+ this.scheduleAutoDrop();
13970
+ if (this.state.callingState === CallingState.IDLE) {
13971
+ this.state.setCallingState(CallingState.RINGING);
13972
+ }
13973
+ this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
13935
13974
  }
13936
- this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
13937
13975
  }));
13938
13976
  }
13939
13977
  /**
@@ -15536,7 +15574,7 @@ class StreamClient {
15536
15574
  });
15537
15575
  };
15538
15576
  this.getUserAgent = () => {
15539
- const version = "1.4.6" ;
15577
+ const version = "1.4.7" ;
15540
15578
  return (this.userAgent ||
15541
15579
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
15542
15580
  };