@stream-io/video-client 0.4.0 → 0.4.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/CHANGELOG.md +7 -0
- package/dist/index.browser.es.js +37 -25
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +37 -25
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +37 -25
- 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 +45 -32
- package/src/StreamVideoClient.ts +1 -0
- package/src/__tests__/StreamVideoClient.test.ts +0 -3
- package/src/devices/InputMediaDeviceManager.ts +1 -0
package/dist/index.es.js
CHANGED
|
@@ -10272,6 +10272,7 @@ class InputMediaDeviceManager {
|
|
|
10272
10272
|
try {
|
|
10273
10273
|
await this.enablePromise;
|
|
10274
10274
|
this.state.setStatus('enabled');
|
|
10275
|
+
this.enablePromise = undefined;
|
|
10275
10276
|
}
|
|
10276
10277
|
catch (error) {
|
|
10277
10278
|
this.enablePromise = undefined;
|
|
@@ -11117,6 +11118,7 @@ class Call {
|
|
|
11117
11118
|
this.watching = true;
|
|
11118
11119
|
this.clientStore.registerCall(this);
|
|
11119
11120
|
}
|
|
11121
|
+
this.applyDeviceConfig();
|
|
11120
11122
|
return response;
|
|
11121
11123
|
};
|
|
11122
11124
|
/**
|
|
@@ -11136,6 +11138,7 @@ class Call {
|
|
|
11136
11138
|
this.watching = true;
|
|
11137
11139
|
this.clientStore.registerCall(this);
|
|
11138
11140
|
}
|
|
11141
|
+
this.applyDeviceConfig();
|
|
11139
11142
|
return response;
|
|
11140
11143
|
};
|
|
11141
11144
|
/**
|
|
@@ -11468,8 +11471,8 @@ class Call {
|
|
|
11468
11471
|
this.reconnectAttempts = 0; // reset the reconnect attempts counter
|
|
11469
11472
|
this.state.setCallingState(CallingState.JOINED);
|
|
11470
11473
|
try {
|
|
11471
|
-
await this.initCamera();
|
|
11472
|
-
await this.initMic();
|
|
11474
|
+
await this.initCamera({ setStatus: true });
|
|
11475
|
+
await this.initMic({ setStatus: true });
|
|
11473
11476
|
}
|
|
11474
11477
|
catch (error) {
|
|
11475
11478
|
this.logger('warn', 'Camera and/or mic init failed during join call');
|
|
@@ -12045,6 +12048,10 @@ class Call {
|
|
|
12045
12048
|
this.sendCustomEvent = async (payload) => {
|
|
12046
12049
|
return this.streamClient.post(`${this.streamClientBasePath}/event`, { custom: payload });
|
|
12047
12050
|
};
|
|
12051
|
+
this.applyDeviceConfig = () => {
|
|
12052
|
+
this.initCamera({ setStatus: false });
|
|
12053
|
+
this.initMic({ setStatus: false });
|
|
12054
|
+
};
|
|
12048
12055
|
/**
|
|
12049
12056
|
* Will begin tracking the given element for visibility changes within the
|
|
12050
12057
|
* configured viewport element (`call.setViewport`).
|
|
@@ -12290,7 +12297,7 @@ class Call {
|
|
|
12290
12297
|
get isCreatedByMe() {
|
|
12291
12298
|
return this.state.createdBy?.id === this.currentUserId;
|
|
12292
12299
|
}
|
|
12293
|
-
async initCamera() {
|
|
12300
|
+
async initCamera(options) {
|
|
12294
12301
|
// Wait for any in progress camera operation
|
|
12295
12302
|
if (this.camera.enablePromise) {
|
|
12296
12303
|
await this.camera.enablePromise;
|
|
@@ -12316,19 +12323,21 @@ class Call {
|
|
|
12316
12323
|
if (targetResolution) {
|
|
12317
12324
|
await this.camera.selectTargetResolution(targetResolution);
|
|
12318
12325
|
}
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
this.camera.state.
|
|
12322
|
-
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
this.state.
|
|
12328
|
-
|
|
12326
|
+
if (options.setStatus) {
|
|
12327
|
+
// Publish already that was set before we joined
|
|
12328
|
+
if (this.camera.state.status === 'enabled' &&
|
|
12329
|
+
this.camera.state.mediaStream &&
|
|
12330
|
+
!this.publisher?.isPublishing(TrackType.VIDEO)) {
|
|
12331
|
+
await this.publishVideoStream(this.camera.state.mediaStream);
|
|
12332
|
+
}
|
|
12333
|
+
// Start camera if backend config speicifies, and there is no local setting
|
|
12334
|
+
if (this.camera.state.status === undefined &&
|
|
12335
|
+
this.state.settings?.video.camera_default_on) {
|
|
12336
|
+
await this.camera.enable();
|
|
12337
|
+
}
|
|
12329
12338
|
}
|
|
12330
12339
|
}
|
|
12331
|
-
async initMic() {
|
|
12340
|
+
async initMic(options) {
|
|
12332
12341
|
// Wait for any in progress mic operation
|
|
12333
12342
|
if (this.microphone.enablePromise) {
|
|
12334
12343
|
await this.microphone.enablePromise;
|
|
@@ -12340,16 +12349,18 @@ class Call {
|
|
|
12340
12349
|
!this.permissionsContext.hasPermission('send-audio')) {
|
|
12341
12350
|
return;
|
|
12342
12351
|
}
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
this.microphone.state.
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
this.state.
|
|
12352
|
-
|
|
12352
|
+
if (options.setStatus) {
|
|
12353
|
+
// Publish media stream that was set before we joined
|
|
12354
|
+
if (this.microphone.state.status === 'enabled' &&
|
|
12355
|
+
this.microphone.state.mediaStream &&
|
|
12356
|
+
!this.publisher?.isPublishing(TrackType.AUDIO)) {
|
|
12357
|
+
await this.publishAudioStream(this.microphone.state.mediaStream);
|
|
12358
|
+
}
|
|
12359
|
+
// Start mic if backend config specifies, and there is no local setting
|
|
12360
|
+
if (this.microphone.state.status === undefined &&
|
|
12361
|
+
this.state.settings?.audio.mic_default_on) {
|
|
12362
|
+
await this.microphone.enable();
|
|
12363
|
+
}
|
|
12353
12364
|
}
|
|
12354
12365
|
}
|
|
12355
12366
|
}
|
|
@@ -13935,7 +13946,7 @@ class StreamClient {
|
|
|
13935
13946
|
});
|
|
13936
13947
|
};
|
|
13937
13948
|
this.getUserAgent = () => {
|
|
13938
|
-
const version = "0.4.
|
|
13949
|
+
const version = "0.4.1" ;
|
|
13939
13950
|
return (this.userAgent ||
|
|
13940
13951
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
13941
13952
|
};
|
|
@@ -14183,6 +14194,7 @@ class StreamVideoClient {
|
|
|
14183
14194
|
clientStore: this.writeableStateStore,
|
|
14184
14195
|
});
|
|
14185
14196
|
call.state.updateFromCallResponse(c.call);
|
|
14197
|
+
call.applyDeviceConfig();
|
|
14186
14198
|
if (data.watch) {
|
|
14187
14199
|
this.writeableStateStore.registerCall(call);
|
|
14188
14200
|
}
|