@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/CHANGELOG.md +14 -0
- package/dist/index.browser.es.js +51 -13
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +51 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +51 -13
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/Call.ts +46 -12
- package/src/store/CallState.ts +2 -1
- package/src/store/__tests__/CallState.test.ts +10 -0
package/dist/index.cjs.js
CHANGED
|
@@ -6556,7 +6556,7 @@ function getIceCandidate(candidate) {
|
|
|
6556
6556
|
}
|
|
6557
6557
|
}
|
|
6558
6558
|
|
|
6559
|
-
const version = "1.4.
|
|
6559
|
+
const version = "1.4.8" ;
|
|
6560
6560
|
const [major, minor, patch] = version.split('.');
|
|
6561
6561
|
let sdkInfo = {
|
|
6562
6562
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -7751,7 +7751,6 @@ class CallState {
|
|
|
7751
7751
|
'call.closed_caption': undefined,
|
|
7752
7752
|
'call.deleted': undefined,
|
|
7753
7753
|
'call.permission_request': undefined,
|
|
7754
|
-
'call.recording_failed': undefined,
|
|
7755
7754
|
'call.recording_ready': undefined,
|
|
7756
7755
|
'call.transcription_ready': undefined,
|
|
7757
7756
|
'call.user_muted': undefined,
|
|
@@ -7791,6 +7790,7 @@ class CallState {
|
|
|
7791
7790
|
'call.reaction_new': this.updateParticipantReaction,
|
|
7792
7791
|
'call.recording_started': () => this.setCurrentValue(this.recordingSubject, true),
|
|
7793
7792
|
'call.recording_stopped': () => this.setCurrentValue(this.recordingSubject, false),
|
|
7793
|
+
'call.recording_failed': () => this.setCurrentValue(this.recordingSubject, false),
|
|
7794
7794
|
'call.rejected': (e) => this.updateFromCallResponse(e.call),
|
|
7795
7795
|
'call.ring': (e) => this.updateFromCallResponse(e.call),
|
|
7796
7796
|
'call.missed': (e) => this.updateFromCallResponse(e.call),
|
|
@@ -12624,12 +12624,13 @@ class Call {
|
|
|
12624
12624
|
this.get = async (params) => {
|
|
12625
12625
|
await this.setup();
|
|
12626
12626
|
const response = await this.streamClient.get(this.streamClientBasePath, params);
|
|
12627
|
-
if (params?.ring && !this.ringing) {
|
|
12628
|
-
this.ringingSubject.next(true);
|
|
12629
|
-
}
|
|
12630
12627
|
this.state.updateFromCallResponse(response.call);
|
|
12631
12628
|
this.state.setMembers(response.members);
|
|
12632
12629
|
this.state.setOwnCapabilities(response.own_capabilities);
|
|
12630
|
+
if (params?.ring || this.ringing) {
|
|
12631
|
+
// the call response can indicate where the call is still ringing or not
|
|
12632
|
+
this.ringingSubject.next(true);
|
|
12633
|
+
}
|
|
12633
12634
|
if (this.streamClient._hasConnectionID()) {
|
|
12634
12635
|
this.watching = true;
|
|
12635
12636
|
this.clientStore.registerCall(this);
|
|
@@ -12645,12 +12646,13 @@ class Call {
|
|
|
12645
12646
|
this.getOrCreate = async (data) => {
|
|
12646
12647
|
await this.setup();
|
|
12647
12648
|
const response = await this.streamClient.post(this.streamClientBasePath, data);
|
|
12648
|
-
if (data?.ring && !this.ringing) {
|
|
12649
|
-
this.ringingSubject.next(true);
|
|
12650
|
-
}
|
|
12651
12649
|
this.state.updateFromCallResponse(response.call);
|
|
12652
12650
|
this.state.setMembers(response.members);
|
|
12653
12651
|
this.state.setOwnCapabilities(response.own_capabilities);
|
|
12652
|
+
if (data?.ring || this.ringing) {
|
|
12653
|
+
// the call response can indicate where the call is still ringing or not
|
|
12654
|
+
this.ringingSubject.next(true);
|
|
12655
|
+
}
|
|
12654
12656
|
if (this.streamClient._hasConnectionID()) {
|
|
12655
12657
|
this.watching = true;
|
|
12656
12658
|
this.clientStore.registerCall(this);
|
|
@@ -13950,11 +13952,47 @@ class Call {
|
|
|
13950
13952
|
createSubscription(this.ringingSubject, (isRinging) => {
|
|
13951
13953
|
if (!isRinging)
|
|
13952
13954
|
return;
|
|
13953
|
-
this.
|
|
13954
|
-
|
|
13955
|
-
|
|
13955
|
+
const callSession = this.state.session;
|
|
13956
|
+
const receiver_id = this.clientStore.connectedUser?.id;
|
|
13957
|
+
const endedAt = this.state.endedAt;
|
|
13958
|
+
const created_by_id = this.state.createdBy?.id;
|
|
13959
|
+
const rejected_by = callSession?.rejected_by;
|
|
13960
|
+
const accepted_by = callSession?.accepted_by;
|
|
13961
|
+
let leaveCallIdle = false;
|
|
13962
|
+
if (endedAt) {
|
|
13963
|
+
// call was ended before it was accepted or rejected so we should leave it to idle
|
|
13964
|
+
leaveCallIdle = true;
|
|
13965
|
+
}
|
|
13966
|
+
else if (created_by_id && rejected_by) {
|
|
13967
|
+
if (rejected_by[created_by_id]) {
|
|
13968
|
+
// call was cancelled by the caller
|
|
13969
|
+
leaveCallIdle = true;
|
|
13970
|
+
}
|
|
13971
|
+
}
|
|
13972
|
+
else if (receiver_id && rejected_by) {
|
|
13973
|
+
if (rejected_by[receiver_id]) {
|
|
13974
|
+
// call was rejected by the receiver in some other device
|
|
13975
|
+
leaveCallIdle = true;
|
|
13976
|
+
}
|
|
13977
|
+
}
|
|
13978
|
+
else if (receiver_id && accepted_by) {
|
|
13979
|
+
if (accepted_by[receiver_id]) {
|
|
13980
|
+
// call was accepted by the receiver in some other device
|
|
13981
|
+
leaveCallIdle = true;
|
|
13982
|
+
}
|
|
13983
|
+
}
|
|
13984
|
+
if (leaveCallIdle) {
|
|
13985
|
+
if (this.state.callingState !== exports.CallingState.IDLE) {
|
|
13986
|
+
this.state.setCallingState(exports.CallingState.IDLE);
|
|
13987
|
+
}
|
|
13988
|
+
}
|
|
13989
|
+
else {
|
|
13990
|
+
this.scheduleAutoDrop();
|
|
13991
|
+
if (this.state.callingState === exports.CallingState.IDLE) {
|
|
13992
|
+
this.state.setCallingState(exports.CallingState.RINGING);
|
|
13993
|
+
}
|
|
13994
|
+
this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
|
|
13956
13995
|
}
|
|
13957
|
-
this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
|
|
13958
13996
|
}));
|
|
13959
13997
|
}
|
|
13960
13998
|
/**
|
|
@@ -15555,7 +15593,7 @@ class StreamClient {
|
|
|
15555
15593
|
});
|
|
15556
15594
|
};
|
|
15557
15595
|
this.getUserAgent = () => {
|
|
15558
|
-
const version = "1.4.
|
|
15596
|
+
const version = "1.4.8" ;
|
|
15559
15597
|
return (this.userAgent ||
|
|
15560
15598
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
15561
15599
|
};
|