@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 +7 -0
- package/dist/index.browser.es.js +50 -12
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +50 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +50 -12
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/Call.ts +46 -12
package/package.json
CHANGED
package/src/Call.ts
CHANGED
|
@@ -435,11 +435,43 @@ export class Call {
|
|
|
435
435
|
// "ringing" mode effects and event handlers
|
|
436
436
|
createSubscription(this.ringingSubject, (isRinging) => {
|
|
437
437
|
if (!isRinging) return;
|
|
438
|
-
this.
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
const callSession = this.state.session;
|
|
439
|
+
const receiver_id = this.clientStore.connectedUser?.id;
|
|
440
|
+
const endedAt = this.state.endedAt;
|
|
441
|
+
const created_by_id = this.state.createdBy?.id;
|
|
442
|
+
const rejected_by = callSession?.rejected_by;
|
|
443
|
+
const accepted_by = callSession?.accepted_by;
|
|
444
|
+
let leaveCallIdle = false;
|
|
445
|
+
if (endedAt) {
|
|
446
|
+
// call was ended before it was accepted or rejected so we should leave it to idle
|
|
447
|
+
leaveCallIdle = true;
|
|
448
|
+
} else if (created_by_id && rejected_by) {
|
|
449
|
+
if (rejected_by[created_by_id]) {
|
|
450
|
+
// call was cancelled by the caller
|
|
451
|
+
leaveCallIdle = true;
|
|
452
|
+
}
|
|
453
|
+
} else if (receiver_id && rejected_by) {
|
|
454
|
+
if (rejected_by[receiver_id]) {
|
|
455
|
+
// call was rejected by the receiver in some other device
|
|
456
|
+
leaveCallIdle = true;
|
|
457
|
+
}
|
|
458
|
+
} else if (receiver_id && accepted_by) {
|
|
459
|
+
if (accepted_by[receiver_id]) {
|
|
460
|
+
// call was accepted by the receiver in some other device
|
|
461
|
+
leaveCallIdle = true;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
if (leaveCallIdle) {
|
|
465
|
+
if (this.state.callingState !== CallingState.IDLE) {
|
|
466
|
+
this.state.setCallingState(CallingState.IDLE);
|
|
467
|
+
}
|
|
468
|
+
} else {
|
|
469
|
+
this.scheduleAutoDrop();
|
|
470
|
+
if (this.state.callingState === CallingState.IDLE) {
|
|
471
|
+
this.state.setCallingState(CallingState.RINGING);
|
|
472
|
+
}
|
|
473
|
+
this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
|
|
441
474
|
}
|
|
442
|
-
this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
|
|
443
475
|
}),
|
|
444
476
|
);
|
|
445
477
|
}
|
|
@@ -611,14 +643,15 @@ export class Call {
|
|
|
611
643
|
params,
|
|
612
644
|
);
|
|
613
645
|
|
|
614
|
-
if (params?.ring && !this.ringing) {
|
|
615
|
-
this.ringingSubject.next(true);
|
|
616
|
-
}
|
|
617
|
-
|
|
618
646
|
this.state.updateFromCallResponse(response.call);
|
|
619
647
|
this.state.setMembers(response.members);
|
|
620
648
|
this.state.setOwnCapabilities(response.own_capabilities);
|
|
621
649
|
|
|
650
|
+
if (params?.ring || this.ringing) {
|
|
651
|
+
// the call response can indicate where the call is still ringing or not
|
|
652
|
+
this.ringingSubject.next(true);
|
|
653
|
+
}
|
|
654
|
+
|
|
622
655
|
if (this.streamClient._hasConnectionID()) {
|
|
623
656
|
this.watching = true;
|
|
624
657
|
this.clientStore.registerCall(this);
|
|
@@ -641,14 +674,15 @@ export class Call {
|
|
|
641
674
|
GetOrCreateCallRequest
|
|
642
675
|
>(this.streamClientBasePath, data);
|
|
643
676
|
|
|
644
|
-
if (data?.ring && !this.ringing) {
|
|
645
|
-
this.ringingSubject.next(true);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
677
|
this.state.updateFromCallResponse(response.call);
|
|
649
678
|
this.state.setMembers(response.members);
|
|
650
679
|
this.state.setOwnCapabilities(response.own_capabilities);
|
|
651
680
|
|
|
681
|
+
if (data?.ring || this.ringing) {
|
|
682
|
+
// the call response can indicate where the call is still ringing or not
|
|
683
|
+
this.ringingSubject.next(true);
|
|
684
|
+
}
|
|
685
|
+
|
|
652
686
|
if (this.streamClient._hasConnectionID()) {
|
|
653
687
|
this.watching = true;
|
|
654
688
|
this.clientStore.registerCall(this);
|