@stream-io/video-client 1.4.6 → 1.4.8

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/dist/index.es.js CHANGED
@@ -6536,7 +6536,7 @@ function getIceCandidate(candidate) {
6536
6536
  }
6537
6537
  }
6538
6538
 
6539
- const version = "1.4.6" ;
6539
+ const version = "1.4.8" ;
6540
6540
  const [major, minor, patch] = version.split('.');
6541
6541
  let sdkInfo = {
6542
6542
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -7731,7 +7731,6 @@ class CallState {
7731
7731
  'call.closed_caption': undefined,
7732
7732
  'call.deleted': undefined,
7733
7733
  'call.permission_request': undefined,
7734
- 'call.recording_failed': undefined,
7735
7734
  'call.recording_ready': undefined,
7736
7735
  'call.transcription_ready': undefined,
7737
7736
  'call.user_muted': undefined,
@@ -7771,6 +7770,7 @@ class CallState {
7771
7770
  'call.reaction_new': this.updateParticipantReaction,
7772
7771
  'call.recording_started': () => this.setCurrentValue(this.recordingSubject, true),
7773
7772
  'call.recording_stopped': () => this.setCurrentValue(this.recordingSubject, false),
7773
+ 'call.recording_failed': () => this.setCurrentValue(this.recordingSubject, false),
7774
7774
  'call.rejected': (e) => this.updateFromCallResponse(e.call),
7775
7775
  'call.ring': (e) => this.updateFromCallResponse(e.call),
7776
7776
  'call.missed': (e) => this.updateFromCallResponse(e.call),
@@ -12604,12 +12604,13 @@ class Call {
12604
12604
  this.get = async (params) => {
12605
12605
  await this.setup();
12606
12606
  const response = await this.streamClient.get(this.streamClientBasePath, params);
12607
- if (params?.ring && !this.ringing) {
12608
- this.ringingSubject.next(true);
12609
- }
12610
12607
  this.state.updateFromCallResponse(response.call);
12611
12608
  this.state.setMembers(response.members);
12612
12609
  this.state.setOwnCapabilities(response.own_capabilities);
12610
+ if (params?.ring || this.ringing) {
12611
+ // the call response can indicate where the call is still ringing or not
12612
+ this.ringingSubject.next(true);
12613
+ }
12613
12614
  if (this.streamClient._hasConnectionID()) {
12614
12615
  this.watching = true;
12615
12616
  this.clientStore.registerCall(this);
@@ -12625,12 +12626,13 @@ class Call {
12625
12626
  this.getOrCreate = async (data) => {
12626
12627
  await this.setup();
12627
12628
  const response = await this.streamClient.post(this.streamClientBasePath, data);
12628
- if (data?.ring && !this.ringing) {
12629
- this.ringingSubject.next(true);
12630
- }
12631
12629
  this.state.updateFromCallResponse(response.call);
12632
12630
  this.state.setMembers(response.members);
12633
12631
  this.state.setOwnCapabilities(response.own_capabilities);
12632
+ if (data?.ring || this.ringing) {
12633
+ // the call response can indicate where the call is still ringing or not
12634
+ this.ringingSubject.next(true);
12635
+ }
12634
12636
  if (this.streamClient._hasConnectionID()) {
12635
12637
  this.watching = true;
12636
12638
  this.clientStore.registerCall(this);
@@ -13930,11 +13932,47 @@ class Call {
13930
13932
  createSubscription(this.ringingSubject, (isRinging) => {
13931
13933
  if (!isRinging)
13932
13934
  return;
13933
- this.scheduleAutoDrop();
13934
- if (this.state.callingState === CallingState.IDLE) {
13935
- this.state.setCallingState(CallingState.RINGING);
13935
+ const callSession = this.state.session;
13936
+ const receiver_id = this.clientStore.connectedUser?.id;
13937
+ const endedAt = this.state.endedAt;
13938
+ const created_by_id = this.state.createdBy?.id;
13939
+ const rejected_by = callSession?.rejected_by;
13940
+ const accepted_by = callSession?.accepted_by;
13941
+ let leaveCallIdle = false;
13942
+ if (endedAt) {
13943
+ // call was ended before it was accepted or rejected so we should leave it to idle
13944
+ leaveCallIdle = true;
13945
+ }
13946
+ else if (created_by_id && rejected_by) {
13947
+ if (rejected_by[created_by_id]) {
13948
+ // call was cancelled by the caller
13949
+ leaveCallIdle = true;
13950
+ }
13951
+ }
13952
+ else if (receiver_id && rejected_by) {
13953
+ if (rejected_by[receiver_id]) {
13954
+ // call was rejected by the receiver in some other device
13955
+ leaveCallIdle = true;
13956
+ }
13957
+ }
13958
+ else if (receiver_id && accepted_by) {
13959
+ if (accepted_by[receiver_id]) {
13960
+ // call was accepted by the receiver in some other device
13961
+ leaveCallIdle = true;
13962
+ }
13963
+ }
13964
+ if (leaveCallIdle) {
13965
+ if (this.state.callingState !== CallingState.IDLE) {
13966
+ this.state.setCallingState(CallingState.IDLE);
13967
+ }
13968
+ }
13969
+ else {
13970
+ this.scheduleAutoDrop();
13971
+ if (this.state.callingState === CallingState.IDLE) {
13972
+ this.state.setCallingState(CallingState.RINGING);
13973
+ }
13974
+ this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
13936
13975
  }
13937
- this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
13938
13976
  }));
13939
13977
  }
13940
13978
  /**
@@ -15535,7 +15573,7 @@ class StreamClient {
15535
15573
  });
15536
15574
  };
15537
15575
  this.getUserAgent = () => {
15538
- const version = "1.4.6" ;
15576
+ const version = "1.4.8" ;
15539
15577
  return (this.userAgent ||
15540
15578
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
15541
15579
  };