@stream-io/video-client 1.11.13 → 1.11.15

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.11.15](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.14...@stream-io/video-client-1.11.15) (2024-12-09)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * avoid call.get in all call.ring events ([#1615](https://github.com/GetStream/stream-video-js/issues/1615)) ([c757370](https://github.com/GetStream/stream-video-js/commit/c7573701a20b4a29cd2b6fd08a55d4eff503f77f))
11
+
12
+ ## [1.11.14](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.13...@stream-io/video-client-1.11.14) (2024-12-04)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * prevent device list observable from erroring ([#1608](https://github.com/GetStream/stream-video-js/issues/1608)) ([06af3e7](https://github.com/GetStream/stream-video-js/commit/06af3e7e03b63551c781512c797ac10c0486d0c7))
18
+
5
19
  ## [1.11.13](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.12...@stream-io/video-client-1.11.13) (2024-12-03)
6
20
 
7
21
 
@@ -3297,7 +3297,7 @@ const retryable = async (rpc, signal) => {
3297
3297
  return result;
3298
3298
  };
3299
3299
 
3300
- const version = "1.11.13";
3300
+ const version = "1.11.15";
3301
3301
  const [major, minor, patch] = version.split('.');
3302
3302
  let sdkInfo = {
3303
3303
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -8312,7 +8312,7 @@ class BrowserPermission {
8312
8312
  return this.state;
8313
8313
  }
8314
8314
  async prompt({ forcePrompt = false, throwOnNotAllowed = false, } = {}) {
8315
- await withoutConcurrency(`permission-prompt-${this.permission.queryName}`, async () => {
8315
+ return await withoutConcurrency(`permission-prompt-${this.permission.queryName}`, async () => {
8316
8316
  if ((await this.getState()) !== 'prompt' ||
8317
8317
  (this.wasPrompted && !forcePrompt)) {
8318
8318
  const isGranted = this.state === 'granted';
@@ -8387,8 +8387,7 @@ const getDevices = (permission, kind) => {
8387
8387
  // for privacy reasons, most browsers don't give you device labels
8388
8388
  // unless you have a corresponding camera or microphone permission
8389
8389
  const shouldPromptForBrowserPermission = devices.some((device) => device.kind === kind && device.label === '');
8390
- if (shouldPromptForBrowserPermission) {
8391
- await permission.prompt({ throwOnNotAllowed: true });
8390
+ if (shouldPromptForBrowserPermission && (await permission.prompt())) {
8392
8391
  devices = await navigator.mediaDevices.enumerateDevices();
8393
8392
  }
8394
8393
  return devices.filter((device) => device.kind === kind &&
@@ -10143,6 +10142,28 @@ class Call {
10143
10142
  await Promise.all(stopOnLeavePromises);
10144
10143
  });
10145
10144
  };
10145
+ /**
10146
+ * Update from the call response from the "call.ring" event
10147
+ * @internal
10148
+ */
10149
+ this.updateFromRingingEvent = async (event) => {
10150
+ await this.setup();
10151
+ // call.ring event excludes the call creator in the members list
10152
+ // as the creator does not get the ring event
10153
+ // so update the member list accordingly
10154
+ const creator = this.state.members.find((m) => m.user.id === event.call.created_by.id);
10155
+ if (!creator) {
10156
+ this.state.setMembers(event.members);
10157
+ }
10158
+ else {
10159
+ this.state.setMembers([creator, ...event.members]);
10160
+ }
10161
+ // update the call state with the latest event data
10162
+ this.state.updateFromCallResponse(event.call);
10163
+ this.ringingSubject.next(true);
10164
+ this.watching = true;
10165
+ await this.applyDeviceConfig(false);
10166
+ };
10146
10167
  /**
10147
10168
  * Loads the information about the call.
10148
10169
  *
@@ -12775,7 +12796,7 @@ class StreamClient {
12775
12796
  return await this.wsConnection.connect(this.defaultWSTimeout);
12776
12797
  };
12777
12798
  this.getUserAgent = () => {
12778
- const version = "1.11.13";
12799
+ const version = "1.11.15";
12779
12800
  return (this.userAgent ||
12780
12801
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12781
12802
  };
@@ -12968,24 +12989,25 @@ class StreamVideoClient {
12968
12989
  this.logger('debug', 'Received `call.ring` sent by the current user so ignoring the event');
12969
12990
  return;
12970
12991
  }
12971
- // The call might already be tracked by the client,
12972
12992
  // if `call.created` was received before `call.ring`.
12973
- // In that case, we cleanup the already tracked call.
12974
- const prevCall = this.writeableStateStore.findCall(call.type, call.id);
12975
- await prevCall?.leave({ reason: 'cleaning-up in call.ring' });
12976
- // we create a new call
12977
- const theCall = new Call({
12978
- streamClient: this.streamClient,
12979
- type: call.type,
12980
- id: call.id,
12981
- members,
12982
- clientStore: this.writeableStateStore,
12983
- ringing: true,
12984
- });
12985
- theCall.state.updateFromCallResponse(call);
12986
- // we fetch the latest metadata for the call from the server
12987
- await theCall.get();
12988
- this.writeableStateStore.registerCall(theCall);
12993
+ // the client already has the call instance and we just need to update the state
12994
+ const theCall = this.writeableStateStore.findCall(call.type, call.id);
12995
+ if (theCall) {
12996
+ await theCall.updateFromRingingEvent(event);
12997
+ }
12998
+ else {
12999
+ // if client doesn't have the call instance, create the instance and fetch the latest state
13000
+ // Note: related - we also have onRingingCall method to handle this case from push notifications
13001
+ const newCallInstance = new Call({
13002
+ streamClient: this.streamClient,
13003
+ type: call.type,
13004
+ id: call.id,
13005
+ members,
13006
+ clientStore: this.writeableStateStore,
13007
+ ringing: true,
13008
+ });
13009
+ await newCallInstance.get();
13010
+ }
12989
13011
  }));
12990
13012
  return connectUserResponse;
12991
13013
  };