@stream-io/video-client 1.11.0 → 1.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
package/src/Call.ts CHANGED
@@ -516,20 +516,15 @@ export class Call {
516
516
  await waitUntilCallJoined();
517
517
  }
518
518
 
519
- if (reject && this.ringing) {
520
- // I'm the one who started the call, so I should cancel it.
521
- const hasOtherParticipants = this.state.remoteParticipants.length > 0;
522
- if (
523
- this.isCreatedByMe &&
524
- !hasOtherParticipants &&
525
- callingState === CallingState.RINGING
526
- ) {
527
- // Signals other users that I have cancelled my call to them
528
- // before they accepted it.
529
- await this.reject();
530
- } else if (callingState === CallingState.RINGING) {
531
- // Signals other users that I have rejected the incoming call.
532
- await this.reject();
519
+ if (callingState === CallingState.RINGING) {
520
+ if (reject) {
521
+ await this.reject(reason);
522
+ } else {
523
+ const hasOtherParticipants = this.state.remoteParticipants.length > 0;
524
+ if (this.isCreatedByMe && !hasOtherParticipants) {
525
+ // I'm the one who started the call, so I should cancel it when there are no other participants.
526
+ await this.reject('cancel');
527
+ }
533
528
  }
534
529
  }
535
530
 
@@ -1960,13 +1955,16 @@ export class Call {
1960
1955
  // ignore if the call is not ringing
1961
1956
  if (this.state.callingState !== CallingState.RINGING) return;
1962
1957
 
1963
- const timeoutInMs = settings.ring.auto_cancel_timeout_ms;
1958
+ const timeoutInMs = this.isCreatedByMe
1959
+ ? settings.ring.auto_cancel_timeout_ms
1960
+ : settings.ring.incoming_call_timeout_ms;
1961
+
1964
1962
  // 0 means no auto-drop
1965
1963
  if (timeoutInMs <= 0) return;
1966
1964
 
1967
1965
  clearTimeout(this.dropTimeout);
1968
1966
  this.dropTimeout = setTimeout(() => {
1969
- this.leave({ reason: 'ring: timeout' }).catch((err) => {
1967
+ this.leave({ reject: true, reason: 'timeout' }).catch((err) => {
1970
1968
  this.logger('error', 'Failed to drop call', err);
1971
1969
  });
1972
1970
  }, timeoutInMs);