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