@stream-io/video-client 1.0.9 → 1.1.0
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 +72 -53
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +72 -53
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +72 -53
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +6 -1
- package/package.json +2 -2
- package/src/Call.ts +21 -11
- package/src/StreamVideoClient.ts +5 -4
- package/src/coordinator/connection/utils.ts +2 -2
- package/src/devices/CameraManagerState.ts +2 -2
- package/src/devices/InputMediaDeviceManager.ts +39 -32
- package/src/devices/MicrophoneManager.ts +14 -10
- package/src/devices/devices.ts +1 -1
- package/src/rtc/Publisher.ts +13 -13
- package/src/stats/utils.ts +2 -2
package/dist/index.es.js
CHANGED
|
@@ -10809,7 +10809,7 @@ const getStream = async (constraints) => {
|
|
|
10809
10809
|
return await navigator.mediaDevices.getUserMedia(constraints);
|
|
10810
10810
|
}
|
|
10811
10811
|
catch (e) {
|
|
10812
|
-
getLogger(['devices'])('error', `Failed
|
|
10812
|
+
getLogger(['devices'])('error', `Failed to getUserMedia`, {
|
|
10813
10813
|
error: e,
|
|
10814
10814
|
constraints: constraints,
|
|
10815
10815
|
});
|
|
@@ -11227,39 +11227,41 @@ class InputMediaDeviceManager {
|
|
|
11227
11227
|
deviceIds$.pipe(pairwise()),
|
|
11228
11228
|
this.state.selectedDevice$,
|
|
11229
11229
|
]), async ([[prevDevices, currentDevices], deviceId]) => {
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
if (this.statusChangePromise) {
|
|
11230
|
+
try {
|
|
11231
|
+
if (!deviceId)
|
|
11232
|
+
return;
|
|
11234
11233
|
await this.statusChangePromise;
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
isDeviceDisconnected = true;
|
|
11242
|
-
}
|
|
11243
|
-
else if (currentDevice &&
|
|
11244
|
-
prevDevice &&
|
|
11245
|
-
currentDevice.deviceId === prevDevice.deviceId &&
|
|
11246
|
-
currentDevice.groupId !== prevDevice.groupId) {
|
|
11247
|
-
isDeviceReplaced = true;
|
|
11248
|
-
}
|
|
11249
|
-
if (isDeviceDisconnected) {
|
|
11250
|
-
await this.disable();
|
|
11251
|
-
this.select(undefined);
|
|
11252
|
-
}
|
|
11253
|
-
if (isDeviceReplaced) {
|
|
11254
|
-
if (this.isTrackStoppedDueToTrackEnd &&
|
|
11255
|
-
this.state.status === 'disabled') {
|
|
11256
|
-
await this.enable();
|
|
11257
|
-
this.isTrackStoppedDueToTrackEnd = false;
|
|
11234
|
+
let isDeviceDisconnected = false;
|
|
11235
|
+
let isDeviceReplaced = false;
|
|
11236
|
+
const currentDevice = this.findDeviceInList(currentDevices, deviceId);
|
|
11237
|
+
const prevDevice = this.findDeviceInList(prevDevices, deviceId);
|
|
11238
|
+
if (!currentDevice && prevDevice) {
|
|
11239
|
+
isDeviceDisconnected = true;
|
|
11258
11240
|
}
|
|
11259
|
-
else
|
|
11260
|
-
|
|
11241
|
+
else if (currentDevice &&
|
|
11242
|
+
prevDevice &&
|
|
11243
|
+
currentDevice.deviceId === prevDevice.deviceId &&
|
|
11244
|
+
currentDevice.groupId !== prevDevice.groupId) {
|
|
11245
|
+
isDeviceReplaced = true;
|
|
11246
|
+
}
|
|
11247
|
+
if (isDeviceDisconnected) {
|
|
11248
|
+
await this.disable();
|
|
11249
|
+
await this.select(undefined);
|
|
11250
|
+
}
|
|
11251
|
+
if (isDeviceReplaced) {
|
|
11252
|
+
if (this.isTrackStoppedDueToTrackEnd &&
|
|
11253
|
+
this.state.status === 'disabled') {
|
|
11254
|
+
await this.enable();
|
|
11255
|
+
this.isTrackStoppedDueToTrackEnd = false;
|
|
11256
|
+
}
|
|
11257
|
+
else {
|
|
11258
|
+
await this.applySettingsToStream();
|
|
11259
|
+
}
|
|
11261
11260
|
}
|
|
11262
11261
|
}
|
|
11262
|
+
catch (err) {
|
|
11263
|
+
this.logger('warn', 'Unexpected error while handling disconnected or replaced device', err);
|
|
11264
|
+
}
|
|
11263
11265
|
}));
|
|
11264
11266
|
}
|
|
11265
11267
|
findDeviceInList(devices, deviceId) {
|
|
@@ -11763,23 +11765,28 @@ class MicrophoneManager extends InputMediaDeviceManager {
|
|
|
11763
11765
|
this.state.selectedDevice$,
|
|
11764
11766
|
this.state.status$,
|
|
11765
11767
|
]), async ([callingState, ownCapabilities, deviceId, status]) => {
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
if (
|
|
11775
|
-
|
|
11768
|
+
try {
|
|
11769
|
+
if (callingState === CallingState.LEFT) {
|
|
11770
|
+
await this.stopSpeakingWhileMutedDetection();
|
|
11771
|
+
}
|
|
11772
|
+
if (callingState !== CallingState.JOINED)
|
|
11773
|
+
return;
|
|
11774
|
+
if (!this.speakingWhileMutedNotificationEnabled)
|
|
11775
|
+
return;
|
|
11776
|
+
if (ownCapabilities.includes(OwnCapability.SEND_AUDIO)) {
|
|
11777
|
+
if (status === 'disabled') {
|
|
11778
|
+
await this.startSpeakingWhileMutedDetection(deviceId);
|
|
11779
|
+
}
|
|
11780
|
+
else {
|
|
11781
|
+
await this.stopSpeakingWhileMutedDetection();
|
|
11782
|
+
}
|
|
11776
11783
|
}
|
|
11777
11784
|
else {
|
|
11778
11785
|
await this.stopSpeakingWhileMutedDetection();
|
|
11779
11786
|
}
|
|
11780
11787
|
}
|
|
11781
|
-
|
|
11782
|
-
|
|
11788
|
+
catch (err) {
|
|
11789
|
+
this.logger('warn', 'Could not enable speaking while muted', err);
|
|
11783
11790
|
}
|
|
11784
11791
|
}));
|
|
11785
11792
|
this.subscriptions.push(createSubscription(this.call.state.callingState$, (callingState) => {
|
|
@@ -12380,7 +12387,7 @@ class Call {
|
|
|
12380
12387
|
this.watching = true;
|
|
12381
12388
|
this.clientStore.registerCall(this);
|
|
12382
12389
|
}
|
|
12383
|
-
this.applyDeviceConfig();
|
|
12390
|
+
await this.applyDeviceConfig();
|
|
12384
12391
|
return response;
|
|
12385
12392
|
};
|
|
12386
12393
|
/**
|
|
@@ -12400,7 +12407,7 @@ class Call {
|
|
|
12400
12407
|
this.watching = true;
|
|
12401
12408
|
this.clientStore.registerCall(this);
|
|
12402
12409
|
}
|
|
12403
|
-
this.applyDeviceConfig();
|
|
12410
|
+
await this.applyDeviceConfig();
|
|
12404
12411
|
return response;
|
|
12405
12412
|
};
|
|
12406
12413
|
/**
|
|
@@ -13462,9 +13469,18 @@ class Call {
|
|
|
13462
13469
|
this.sendCustomEvent = async (payload) => {
|
|
13463
13470
|
return this.streamClient.post(`${this.streamClientBasePath}/event`, { custom: payload });
|
|
13464
13471
|
};
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13472
|
+
/**
|
|
13473
|
+
* Applies the device configuration from the backend.
|
|
13474
|
+
*
|
|
13475
|
+
* @internal
|
|
13476
|
+
*/
|
|
13477
|
+
this.applyDeviceConfig = async () => {
|
|
13478
|
+
await this.initCamera({ setStatus: false }).catch((err) => {
|
|
13479
|
+
this.logger('warn', 'Camera init failed', err);
|
|
13480
|
+
});
|
|
13481
|
+
await this.initMic({ setStatus: false }).catch((err) => {
|
|
13482
|
+
this.logger('warn', 'Mic init failed', err);
|
|
13483
|
+
});
|
|
13468
13484
|
};
|
|
13469
13485
|
/**
|
|
13470
13486
|
* Will begin tracking the given element for visibility changes within the
|
|
@@ -13643,7 +13659,9 @@ class Call {
|
|
|
13643
13659
|
const currentUserId = this.currentUserId;
|
|
13644
13660
|
if (currentUserId && blockedUserIds.includes(currentUserId)) {
|
|
13645
13661
|
this.logger('info', 'Leaving call because of being blocked');
|
|
13646
|
-
await this.leave({ reason: 'user blocked' })
|
|
13662
|
+
await this.leave({ reason: 'user blocked' }).catch((err) => {
|
|
13663
|
+
this.logger('error', 'Error leaving call after being blocked', err);
|
|
13664
|
+
});
|
|
13647
13665
|
}
|
|
13648
13666
|
}));
|
|
13649
13667
|
this.leaveCallHooks.add(
|
|
@@ -15268,7 +15286,7 @@ class StreamClient {
|
|
|
15268
15286
|
});
|
|
15269
15287
|
};
|
|
15270
15288
|
this.getUserAgent = () => {
|
|
15271
|
-
const version = "1.0
|
|
15289
|
+
const version = "1.1.0" ;
|
|
15272
15290
|
return (this.userAgent ||
|
|
15273
15291
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
15274
15292
|
};
|
|
@@ -15478,7 +15496,8 @@ class StreamVideoClient {
|
|
|
15478
15496
|
*/
|
|
15479
15497
|
this.queryCalls = async (data = {}) => {
|
|
15480
15498
|
const response = await this.streamClient.post('/calls', data);
|
|
15481
|
-
const calls =
|
|
15499
|
+
const calls = [];
|
|
15500
|
+
for (const c of response.calls) {
|
|
15482
15501
|
const call = new Call({
|
|
15483
15502
|
streamClient: this.streamClient,
|
|
15484
15503
|
id: c.call.id,
|
|
@@ -15489,12 +15508,12 @@ class StreamVideoClient {
|
|
|
15489
15508
|
clientStore: this.writeableStateStore,
|
|
15490
15509
|
});
|
|
15491
15510
|
call.state.updateFromCallResponse(c.call);
|
|
15492
|
-
call.applyDeviceConfig();
|
|
15511
|
+
await call.applyDeviceConfig();
|
|
15493
15512
|
if (data.watch) {
|
|
15494
15513
|
this.writeableStateStore.registerCall(call);
|
|
15495
15514
|
}
|
|
15496
|
-
|
|
15497
|
-
}
|
|
15515
|
+
calls.push(call);
|
|
15516
|
+
}
|
|
15498
15517
|
return {
|
|
15499
15518
|
...response,
|
|
15500
15519
|
calls: calls,
|