@stream-io/video-client 1.42.2 → 1.42.3
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 +6 -0
- package/dist/index.browser.es.js +11 -6
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +11 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +11 -6
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +1 -0
- package/package.json +1 -1
- package/src/Call.ts +14 -9
- package/src/__tests__/Call.test.ts +22 -15
package/dist/src/Call.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ export declare class Call {
|
|
|
100
100
|
private deviceSettingsAppliedOnce;
|
|
101
101
|
private credentials?;
|
|
102
102
|
private initialized;
|
|
103
|
+
private readonly acceptRejectConcurrencyTag;
|
|
103
104
|
private readonly joinLeaveConcurrencyTag;
|
|
104
105
|
/**
|
|
105
106
|
* A list hooks/functions to invoke when the call is left.
|
package/package.json
CHANGED
package/src/Call.ts
CHANGED
|
@@ -276,6 +276,7 @@ export class Call {
|
|
|
276
276
|
private credentials?: Credentials;
|
|
277
277
|
|
|
278
278
|
private initialized = false;
|
|
279
|
+
private readonly acceptRejectConcurrencyTag = Symbol('acceptRejectTag');
|
|
279
280
|
private readonly joinLeaveConcurrencyTag = Symbol('joinLeaveConcurrencyTag');
|
|
280
281
|
|
|
281
282
|
/**
|
|
@@ -858,10 +859,12 @@ export class Call {
|
|
|
858
859
|
* Unless you are implementing a custom "ringing" flow, you should not use this method.
|
|
859
860
|
*/
|
|
860
861
|
accept = async () => {
|
|
861
|
-
this.
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
862
|
+
return withoutConcurrency(this.acceptRejectConcurrencyTag, () => {
|
|
863
|
+
this.tracer.trace('call.accept', '');
|
|
864
|
+
return this.streamClient.post<AcceptCallResponse>(
|
|
865
|
+
`${this.streamClientBasePath}/accept`,
|
|
866
|
+
);
|
|
867
|
+
});
|
|
865
868
|
};
|
|
866
869
|
|
|
867
870
|
/**
|
|
@@ -876,11 +879,13 @@ export class Call {
|
|
|
876
879
|
reject = async (
|
|
877
880
|
reason: RejectReason = 'decline',
|
|
878
881
|
): Promise<RejectCallResponse> => {
|
|
879
|
-
this.
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
882
|
+
return withoutConcurrency(this.acceptRejectConcurrencyTag, () => {
|
|
883
|
+
this.tracer.trace('call.reject', reason);
|
|
884
|
+
return this.streamClient.post<RejectCallResponse, RejectCallRequest>(
|
|
885
|
+
`${this.streamClientBasePath}/reject`,
|
|
886
|
+
{ reason },
|
|
887
|
+
);
|
|
888
|
+
});
|
|
884
889
|
};
|
|
885
890
|
|
|
886
891
|
/**
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
MockInstance,
|
|
8
8
|
vi,
|
|
9
9
|
} from 'vitest';
|
|
10
|
+
import { fromPartial } from '@total-typescript/shoehorn';
|
|
10
11
|
import { StreamVideoClient } from '../StreamVideoClient';
|
|
11
12
|
import 'dotenv/config';
|
|
12
13
|
import { StreamClient } from '@stream-io/node-sdk';
|
|
@@ -63,18 +64,22 @@ it('stops reacting to events when not watching', async () => {
|
|
|
63
64
|
const call = client.call('default', generateUUIDv4());
|
|
64
65
|
await call.getOrCreate();
|
|
65
66
|
expect(call.state.transcribing).toBeFalsy();
|
|
66
|
-
call.streamClient.dispatchEvent(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
call.streamClient.dispatchEvent(
|
|
68
|
+
fromPartial({
|
|
69
|
+
type: 'call.transcription_started',
|
|
70
|
+
call_cid: call.cid,
|
|
71
|
+
created_at: new Date().toISOString(),
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
71
74
|
expect(call.state.transcribing).toBeTruthy();
|
|
72
75
|
await call.leave();
|
|
73
|
-
call.streamClient.dispatchEvent(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
call.streamClient.dispatchEvent(
|
|
77
|
+
fromPartial({
|
|
78
|
+
type: 'call.transcription_stopped',
|
|
79
|
+
call_cid: call.cid,
|
|
80
|
+
created_at: new Date().toISOString(),
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
78
83
|
expect(call.state.transcribing).toBeTruthy();
|
|
79
84
|
});
|
|
80
85
|
|
|
@@ -94,11 +99,13 @@ it('keeps user handlers for SFU and coordinator events', async () => {
|
|
|
94
99
|
},
|
|
95
100
|
},
|
|
96
101
|
});
|
|
97
|
-
call.streamClient.dispatchEvent(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
call.streamClient.dispatchEvent(
|
|
103
|
+
fromPartial({
|
|
104
|
+
type: 'call.transcription_started',
|
|
105
|
+
call_cid: call.cid,
|
|
106
|
+
created_at: new Date().toISOString(),
|
|
107
|
+
}),
|
|
108
|
+
);
|
|
102
109
|
expect(sfuEventHandler).toBeCalled();
|
|
103
110
|
expect(coordinatorEventHandler).toBeCalled();
|
|
104
111
|
});
|