@stream-io/video-client 0.3.4 → 0.3.6
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 +64 -55
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +64 -55
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +64 -55
- package/dist/index.es.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/Call.ts +10 -6
- package/src/__tests__/StreamVideoClient.test.ts +4 -2
- package/src/devices/InputMediaDeviceManager.ts +1 -1
- package/src/devices/__tests__/InputMediaDeviceManager.test.ts +17 -0
- package/src/store/CallState.ts +1 -1
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.3.
|
|
1
|
+
export declare const version = "0.3.6";
|
package/package.json
CHANGED
package/src/Call.ts
CHANGED
|
@@ -926,8 +926,12 @@ export class Call {
|
|
|
926
926
|
|
|
927
927
|
// React uses a different device management for now
|
|
928
928
|
if (getSdkInfo()?.type !== SdkType.REACT) {
|
|
929
|
-
|
|
930
|
-
|
|
929
|
+
try {
|
|
930
|
+
await this.initCamera();
|
|
931
|
+
await this.initMic();
|
|
932
|
+
} catch (error) {
|
|
933
|
+
this.logger('warn', 'Camera and/or mic init failed during join call');
|
|
934
|
+
}
|
|
931
935
|
}
|
|
932
936
|
|
|
933
937
|
// 3. once we have the "joinResponse", and possibly reconciled the local state
|
|
@@ -1713,7 +1717,7 @@ export class Call {
|
|
|
1713
1717
|
);
|
|
1714
1718
|
};
|
|
1715
1719
|
|
|
1716
|
-
private initCamera() {
|
|
1720
|
+
private async initCamera() {
|
|
1717
1721
|
if (
|
|
1718
1722
|
this.state.localParticipant?.videoStream ||
|
|
1719
1723
|
!this.permissionsContext.hasPermission('send-video')
|
|
@@ -1747,11 +1751,11 @@ export class Call {
|
|
|
1747
1751
|
this.camera.state.status === undefined &&
|
|
1748
1752
|
this.state.settings?.video.camera_default_on
|
|
1749
1753
|
) {
|
|
1750
|
-
|
|
1754
|
+
await this.camera.enable();
|
|
1751
1755
|
}
|
|
1752
1756
|
}
|
|
1753
1757
|
|
|
1754
|
-
private initMic() {
|
|
1758
|
+
private async initMic() {
|
|
1755
1759
|
if (
|
|
1756
1760
|
this.state.localParticipant?.audioStream ||
|
|
1757
1761
|
!this.permissionsContext.hasPermission('send-audio')
|
|
@@ -1776,7 +1780,7 @@ export class Call {
|
|
|
1776
1780
|
this.microphone.state.status === undefined &&
|
|
1777
1781
|
this.state.settings?.audio.mic_default_on
|
|
1778
1782
|
) {
|
|
1779
|
-
|
|
1783
|
+
await this.microphone.enable();
|
|
1780
1784
|
}
|
|
1781
1785
|
}
|
|
1782
1786
|
}
|
|
@@ -90,12 +90,14 @@ describe('StreamVideoClient', () => {
|
|
|
90
90
|
|
|
91
91
|
it('API calls should be hold until auth is done - guest user', async () => {
|
|
92
92
|
const user: User = {
|
|
93
|
-
id:
|
|
93
|
+
id: `jane-${generateUUIDv4()}`,
|
|
94
94
|
type: 'guest',
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
client.connectUser(user);
|
|
98
|
-
const response = await client.queryCalls({
|
|
98
|
+
const response = await client.queryCalls({
|
|
99
|
+
filter_conditions: { members: { $in: [user.id] } },
|
|
100
|
+
});
|
|
99
101
|
|
|
100
102
|
expect(response.calls).toBeDefined();
|
|
101
103
|
});
|
|
@@ -38,10 +38,10 @@ export abstract class InputMediaDeviceManager<
|
|
|
38
38
|
* @returns
|
|
39
39
|
*/
|
|
40
40
|
async disable() {
|
|
41
|
+
this.state.prevStatus = this.state.status;
|
|
41
42
|
if (this.state.status === 'disabled') {
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
|
-
this.state.prevStatus = this.state.status;
|
|
45
45
|
await this.muteStream(this.state.disableMode === 'stop-tracks');
|
|
46
46
|
this.state.setStatus('disabled');
|
|
47
47
|
}
|
|
@@ -195,6 +195,23 @@ describe('InputMediaDeviceManager.test', () => {
|
|
|
195
195
|
expect(manager.enable).not.toHaveBeenCalled();
|
|
196
196
|
});
|
|
197
197
|
|
|
198
|
+
it(`shouldn't resume if it were disabled while in pause`, async () => {
|
|
199
|
+
vi.spyOn(manager, 'enable');
|
|
200
|
+
|
|
201
|
+
await manager.enable();
|
|
202
|
+
|
|
203
|
+
expect(manager.enable).toHaveBeenCalledOnce();
|
|
204
|
+
|
|
205
|
+
// first call is pause
|
|
206
|
+
await manager.disable();
|
|
207
|
+
// second call is for example mute from call admin
|
|
208
|
+
await manager.disable();
|
|
209
|
+
|
|
210
|
+
await manager.resume();
|
|
211
|
+
|
|
212
|
+
expect(manager.enable).toHaveBeenCalledOnce();
|
|
213
|
+
});
|
|
214
|
+
|
|
198
215
|
afterEach(() => {
|
|
199
216
|
vi.clearAllMocks();
|
|
200
217
|
vi.resetModules();
|
package/src/store/CallState.ts
CHANGED
|
@@ -98,7 +98,7 @@ export enum CallingState {
|
|
|
98
98
|
* @react You don't have to use this class directly, as we are exposing the state through Hooks.
|
|
99
99
|
*/
|
|
100
100
|
export class CallState {
|
|
101
|
-
private backstageSubject = new BehaviorSubject<boolean>(
|
|
101
|
+
private backstageSubject = new BehaviorSubject<boolean>(true);
|
|
102
102
|
private blockedUserIdsSubject = new BehaviorSubject<string[]>([]);
|
|
103
103
|
private createdAtSubject = new BehaviorSubject<Date>(new Date());
|
|
104
104
|
private endedAtSubject = new BehaviorSubject<Date | undefined>(undefined);
|