@stream-io/video-client 0.0.2-alpha.8 → 0.0.3

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,50 +2,11 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- ## [0.0.2-alpha.8](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.7...client0.0.2-alpha.8) (2023-05-30)
5
+ ### [0.0.3](https://github.com/GetStream/stream-video-js/compare/client0.0.2...client0.0.3) (2023-06-05)
6
6
 
7
7
 
8
- ### Features
8
+ ### Bug Fixes
9
9
 
10
- * integrate the new call ring flow ([#562](https://github.com/GetStream/stream-video-js/issues/562)) ([c407961](https://github.com/GetStream/stream-video-js/commit/c4079614cb962e098215c0061690d59c35882cd8))
10
+ * preserve last used session-id when reconnecting ([#592](https://github.com/GetStream/stream-video-js/issues/592)) ([25cc9ce](https://github.com/GetStream/stream-video-js/commit/25cc9cef16bcbc505fd0dcc0971ddeab3f07ae50))
11
11
 
12
-
13
-
14
- ## [0.0.2-alpha.7](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.6...client0.0.2-alpha.7) (2023-05-30)
15
-
16
-
17
-
18
- ## [0.0.2-alpha.6](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.5...client0.0.2-alpha.6) (2023-05-30)
19
-
20
-
21
-
22
- ## [0.0.2-alpha.5](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.4...client0.0.2-alpha.5) (2023-05-30)
23
-
24
-
25
-
26
- ## [0.0.2-alpha.4](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.3...client0.0.2-alpha.4) (2023-05-30)
27
-
28
-
29
-
30
- ## [0.0.2-alpha.3](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.2...client0.0.2-alpha.3) (2023-05-30)
31
-
32
-
33
- ### Features
34
-
35
- * optional callSessionId in queryRecordings ([#563](https://github.com/GetStream/stream-video-js/issues/563)) ([e2dac22](https://github.com/GetStream/stream-video-js/commit/e2dac2298372d94db867195aa52336d51270c502))
36
-
37
-
38
-
39
- ## [0.0.2-alpha.2](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.1...client0.0.2-alpha.2) (2023-05-27)
40
-
41
-
42
-
43
- ## [0.0.2-alpha.1](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.0...client0.0.2-alpha.1) (2023-05-27)
44
-
45
-
46
-
47
- ## [0.0.2-alpha.0](https://github.com/GetStream/stream-video-js/compare/client0.0.1...client0.0.2-alpha.0) (2023-05-27)
48
-
49
-
50
-
51
- ## [0.0.1](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.194...client0.0.1) (2023-05-26)
12
+ ### [0.0.2](https://github.com/GetStream/stream-video-js/compare/client0.0.2-alpha.25...client0.0.2) (2023-06-02)
@@ -5465,7 +5465,7 @@ const defaultTargetResolution = {
5465
5465
  const findOptimalVideoLayers = (videoTrack, targetResolution = defaultTargetResolution) => {
5466
5466
  const optimalVideoLayers = [];
5467
5467
  const settings = videoTrack.getSettings();
5468
- const { width: w = 0, height: h = 0 } = settings;
5468
+ const { width: w = targetResolution.width, height: h = targetResolution.height, } = settings;
5469
5469
  const maxBitrate = getComputedMaxBitrate(targetResolution, w, h);
5470
5470
  let downscaleFactor = 1;
5471
5471
  ['f', 'h', 'q'].forEach((rid) => {
@@ -5733,14 +5733,13 @@ class Publisher {
5733
5733
  };
5734
5734
  this.updateVideoPublishQuality = (enabledRids) => __awaiter(this, void 0, void 0, function* () {
5735
5735
  var _a;
5736
- console.log('Updating publish quality, qualities requested by SFU:', enabledRids);
5736
+ console.log('Update publish quality, requested rids by SFU:', enabledRids);
5737
5737
  const videoSender = (_a = this.transceiverRegistry[TrackType.VIDEO]) === null || _a === void 0 ? void 0 : _a.sender;
5738
5738
  if (!videoSender)
5739
5739
  return;
5740
5740
  const params = videoSender.getParameters();
5741
5741
  let changed = false;
5742
5742
  params.encodings.forEach((enc) => {
5743
- console.log(enc.rid, enc.active);
5744
5743
  // flip 'active' flag only when necessary
5745
5744
  const shouldEnable = enabledRids.includes(enc.rid);
5746
5745
  if (shouldEnable !== enc.active) {
@@ -5753,6 +5752,10 @@ class Publisher {
5753
5752
  console.warn('No suitable video encoding quality found');
5754
5753
  }
5755
5754
  yield videoSender.setParameters(params);
5755
+ console.log(`Update publish quality, enabled rids: ${params.encodings
5756
+ .filter((e) => e.active)
5757
+ .map((e) => e.rid)
5758
+ .join(', ')}`);
5756
5759
  }
5757
5760
  });
5758
5761
  this.getCodecPreferences = (trackType, preferredCodec) => {
@@ -6128,8 +6131,9 @@ class StreamSfuClient {
6128
6131
  * @param url the URL of the SFU.
6129
6132
  * @param wsEndpoint the WebSocket endpoint of the SFU.
6130
6133
  * @param token the JWT token to use for authentication.
6134
+ * @param sessionId the `sessionId` of the currently connected participant.
6131
6135
  */
6132
- constructor(dispatcher, url, wsEndpoint, token) {
6136
+ constructor({ dispatcher, url, wsEndpoint, token, sessionId, }) {
6133
6137
  /**
6134
6138
  * A buffer for ICE Candidates that are received before
6135
6139
  * the PeerConnections are ready to handle them.
@@ -6214,7 +6218,7 @@ class StreamSfuClient {
6214
6218
  }
6215
6219
  }, this.unhealthyTimeoutInMs);
6216
6220
  };
6217
- this.sessionId = generateUUIDv4();
6221
+ this.sessionId = sessionId || generateUUIDv4();
6218
6222
  this.token = token;
6219
6223
  this.rpc = createSignalClient({
6220
6224
  baseUrl: url,
@@ -6615,6 +6619,12 @@ class CallState {
6615
6619
  * @internal
6616
6620
  */
6617
6621
  this.membersSubject = new BehaviorSubject([]);
6622
+ /**
6623
+ * The list of capabilities of the current user.
6624
+ *
6625
+ * @private
6626
+ */
6627
+ this.ownCapabilitiesSubject = new BehaviorSubject([]);
6618
6628
  /**
6619
6629
  * The calling state.
6620
6630
  *
@@ -6797,6 +6807,15 @@ class CallState {
6797
6807
  this.setMembers = (members) => {
6798
6808
  this.setCurrentValue(this.membersSubject, members);
6799
6809
  };
6810
+ /**
6811
+ * Sets the own capabilities.
6812
+ *
6813
+ * @internal
6814
+ * @param capabilities the capabilities to set.
6815
+ */
6816
+ this.setOwnCapabilities = (capabilities) => {
6817
+ return this.setCurrentValue(this.ownCapabilitiesSubject, capabilities);
6818
+ };
6800
6819
  /**
6801
6820
  * Will try to find the participant with the given sessionId in the current call.
6802
6821
  *
@@ -6886,6 +6905,7 @@ class CallState {
6886
6905
  this.callRecordingList$ = this.callRecordingListSubject.asObservable();
6887
6906
  this.metadata$ = this.metadataSubject.asObservable();
6888
6907
  this.members$ = this.membersSubject.asObservable();
6908
+ this.ownCapabilities$ = this.ownCapabilitiesSubject.asObservable();
6889
6909
  this.callingState$ = this.callingStateSubject.asObservable();
6890
6910
  }
6891
6911
  /**
@@ -6981,6 +7001,12 @@ class CallState {
6981
7001
  get members() {
6982
7002
  return this.getCurrentValue(this.members$);
6983
7003
  }
7004
+ /**
7005
+ * The capabilities of the current user for the current call.
7006
+ */
7007
+ get ownCapabilities() {
7008
+ return this.getCurrentValue(this.ownCapabilities$);
7009
+ }
6984
7010
  }
6985
7011
 
6986
7012
  class StreamVideoWriteableStateStore {
@@ -7245,7 +7271,10 @@ const watchCallPermissionRequest = (state) => {
7245
7271
  return function onCallPermissionRequest(event) {
7246
7272
  if (event.type !== 'call.permission_request')
7247
7273
  return;
7248
- state.setCallPermissionRequest(event);
7274
+ const { localParticipant } = state;
7275
+ if (event.user.id !== (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.userId)) {
7276
+ state.setCallPermissionRequest(event);
7277
+ }
7249
7278
  };
7250
7279
  };
7251
7280
  /**
@@ -7257,7 +7286,7 @@ const watchCallPermissionsUpdated = (state) => {
7257
7286
  return;
7258
7287
  const { localParticipant } = state;
7259
7288
  if (event.user.id === (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.userId)) {
7260
- state.setMetadata((metadata) => (Object.assign(Object.assign({}, metadata), { own_capabilities: event.own_capabilities })));
7289
+ state.setOwnCapabilities(event.own_capabilities);
7261
7290
  }
7262
7291
  };
7263
7292
  };
@@ -7268,7 +7297,6 @@ const watchCallPermissionsUpdated = (state) => {
7268
7297
  */
7269
7298
  const watchCallGrantsUpdated = (state) => {
7270
7299
  return function onCallGrantsUpdated(event) {
7271
- var _a;
7272
7300
  if (event.eventPayload.oneofKind !== 'callGrantsUpdated')
7273
7301
  return;
7274
7302
  const { currentGrants } = event.eventPayload.callGrantsUpdated;
@@ -7279,15 +7307,13 @@ const watchCallGrantsUpdated = (state) => {
7279
7307
  [OwnCapability.SEND_VIDEO]: canPublishVideo,
7280
7308
  [OwnCapability.SCREENSHARE]: canScreenshare,
7281
7309
  };
7282
- const nextCapabilities = (((_a = state.metadata) === null || _a === void 0 ? void 0 : _a.own_capabilities) || []).filter((capability) => update[capability] !== false);
7310
+ const nextCapabilities = state.ownCapabilities.filter((capability) => update[capability] !== false);
7283
7311
  Object.entries(update).forEach(([capability, value]) => {
7284
7312
  if (value && !nextCapabilities.includes(capability)) {
7285
7313
  nextCapabilities.push(capability);
7286
7314
  }
7287
7315
  });
7288
- state.setMetadata((metadata) => {
7289
- return Object.assign(Object.assign({}, metadata), { own_capabilities: nextCapabilities });
7290
- });
7316
+ state.setOwnCapabilities(nextCapabilities);
7291
7317
  }
7292
7318
  };
7293
7319
  };
@@ -7580,10 +7606,7 @@ const watchCallSessionStarted = (state) => {
7580
7606
  return function onCallSessionStarted(event) {
7581
7607
  if (event.type !== 'call.session_started')
7582
7608
  return;
7583
- const { call } = event;
7584
- state.setMetadata((metadata) => (Object.assign(Object.assign({}, call), {
7585
- // FIXME OL: temporary, until the backend sends the own_capabilities
7586
- own_capabilities: (metadata === null || metadata === void 0 ? void 0 : metadata.own_capabilities) || [] })));
7609
+ state.setMetadata(event.call);
7587
7610
  };
7588
7611
  };
7589
7612
  /**
@@ -7595,10 +7618,7 @@ const watchCallSessionEnded = (state) => {
7595
7618
  return function onCallSessionEnded(event) {
7596
7619
  if (event.type !== 'call.session_ended')
7597
7620
  return;
7598
- const { call } = event;
7599
- state.setMetadata((metadata) => (Object.assign(Object.assign({}, call), {
7600
- // FIXME OL: temporary, until the backend sends the own_capabilities
7601
- own_capabilities: (metadata === null || metadata === void 0 ? void 0 : metadata.own_capabilities) || [] })));
7621
+ state.setMetadata(event.call);
7602
7622
  };
7603
7623
  };
7604
7624
  /**
@@ -7760,13 +7780,14 @@ const registerRingingCallEventHandlers = (call) => {
7760
7780
  const join = (httpClient, type, id, data) => __awaiter(void 0, void 0, void 0, function* () {
7761
7781
  yield httpClient.connectionIdPromise;
7762
7782
  const joinCallResponse = yield doJoin(httpClient, type, id, data);
7763
- const { call, credentials, members } = joinCallResponse;
7783
+ const { call, credentials, members, own_capabilities } = joinCallResponse;
7764
7784
  return {
7765
7785
  connectionConfig: toRtcConfiguration(credentials.ice_servers),
7766
7786
  sfuServer: credentials.server,
7767
7787
  token: credentials.token,
7768
7788
  metadata: call,
7769
7789
  members,
7790
+ ownCapabilities: own_capabilities,
7770
7791
  };
7771
7792
  });
7772
7793
  const doJoin = (httpClient, type, id, data) => __awaiter(void 0, void 0, void 0, function* () {
@@ -7783,9 +7804,12 @@ const doJoin = (httpClient, type, id, data) => __awaiter(void 0, void 0, void 0,
7783
7804
  });
7784
7805
  const getLocationHint = () => __awaiter(void 0, void 0, void 0, function* () {
7785
7806
  const hintURL = `https://hint.stream-io-video.com/`;
7807
+ const abortController = new AbortController();
7808
+ const timeoutId = setTimeout(() => abortController.abort(), 1000);
7786
7809
  try {
7787
7810
  const response = yield fetch(hintURL, {
7788
7811
  method: 'HEAD',
7812
+ signal: abortController.signal,
7789
7813
  });
7790
7814
  const awsPop = response.headers.get('x-amz-cf-pop') || 'ERR';
7791
7815
  return awsPop.substring(0, 3); // AMS1-P2 -> AMS
@@ -7794,6 +7818,9 @@ const getLocationHint = () => __awaiter(void 0, void 0, void 0, function* () {
7794
7818
  console.error(`Failed to get location hint from ${hintURL}`, e);
7795
7819
  return 'ERR';
7796
7820
  }
7821
+ finally {
7822
+ clearTimeout(timeoutId);
7823
+ }
7797
7824
  });
7798
7825
  const toRtcConfiguration = (config) => {
7799
7826
  if (!config || config.length === 0)
@@ -8296,7 +8323,7 @@ class Call {
8296
8323
  * Use the [`StreamVideoClient.call`](./StreamVideoClient.md/#call)
8297
8324
  * method to construct a `Call` instance.
8298
8325
  */
8299
- constructor({ type, id, streamClient, metadata, members, sortParticipantsBy, clientStore, ringing = false, watching = false, }) {
8326
+ constructor({ type, id, streamClient, metadata, members, ownCapabilities, sortParticipantsBy, clientStore, ringing = false, watching = false, }) {
8300
8327
  /**
8301
8328
  * ViewportTracker instance
8302
8329
  */
@@ -8388,6 +8415,7 @@ class Call {
8388
8415
  }
8389
8416
  this.state.setMetadata(response.call);
8390
8417
  this.state.setMembers(response.members);
8418
+ this.state.setOwnCapabilities(response.own_capabilities);
8391
8419
  if (this.streamClient._hasConnectionID()) {
8392
8420
  this.watching = true;
8393
8421
  this.clientStore.registerCall(this);
@@ -8406,6 +8434,7 @@ class Call {
8406
8434
  }
8407
8435
  this.state.setMetadata(response.call);
8408
8436
  this.state.setMembers(response.members);
8437
+ this.state.setOwnCapabilities(response.own_capabilities);
8409
8438
  if (this.streamClient._hasConnectionID()) {
8410
8439
  this.watching = true;
8411
8440
  this.clientStore.registerCall(this);
@@ -8452,7 +8481,7 @@ class Call {
8452
8481
  * @returns a promise which resolves once the call join-flow has finished.
8453
8482
  */
8454
8483
  this.join = (data) => __awaiter(this, void 0, void 0, function* () {
8455
- var _e;
8484
+ var _e, _f;
8456
8485
  if ([CallingState.JOINED, CallingState.JOINING].includes(this.state.callingState)) {
8457
8486
  throw new Error(`Illegal State: Already joined.`);
8458
8487
  }
@@ -8472,6 +8501,7 @@ class Call {
8472
8501
  const call = yield join(this.streamClient, this.type, this.id, data);
8473
8502
  this.state.setMetadata(call.metadata);
8474
8503
  this.state.setMembers(call.members);
8504
+ this.state.setOwnCapabilities(call.ownCapabilities);
8475
8505
  connectionConfig = call.connectionConfig;
8476
8506
  sfuServer = call.sfuServer;
8477
8507
  sfuToken = call.token;
@@ -8497,21 +8527,28 @@ class Call {
8497
8527
  const sfuWsUrlParam = params.get('sfuWsUrl');
8498
8528
  sfuWsUrl = sfuWsUrlParam || sfuServer.ws_endpoint;
8499
8529
  }
8500
- const sfuClient = (this.sfuClient = new StreamSfuClient(this.dispatcher, sfuUrl, sfuWsUrl, sfuToken));
8530
+ const previousSessionId = (_e = this.sfuClient) === null || _e === void 0 ? void 0 : _e.sessionId;
8531
+ const sfuClient = (this.sfuClient = new StreamSfuClient({
8532
+ dispatcher: this.dispatcher,
8533
+ url: sfuUrl,
8534
+ wsEndpoint: sfuWsUrl,
8535
+ token: sfuToken,
8536
+ sessionId: previousSessionId,
8537
+ }));
8501
8538
  /**
8502
8539
  * A closure which hides away the re-connection logic.
8503
8540
  */
8504
8541
  const rejoin = () => __awaiter(this, void 0, void 0, function* () {
8505
- var _f, _g, _h;
8542
+ var _g, _h, _j;
8506
8543
  console.log(`Rejoining call ${this.cid} (${this.reconnectAttempts})...`);
8507
8544
  this.reconnectAttempts++;
8508
8545
  this.state.setCallingState(CallingState.RECONNECTING);
8509
8546
  // take a snapshot of the current "local participant" state
8510
8547
  // we'll need it for restoring the previous publishing state later
8511
8548
  const localParticipant = this.state.localParticipant;
8512
- (_f = this.subscriber) === null || _f === void 0 ? void 0 : _f.close();
8513
- (_g = this.publisher) === null || _g === void 0 ? void 0 : _g.stopPublishing({ stopTracks: false });
8514
- (_h = this.statsReporter) === null || _h === void 0 ? void 0 : _h.stop();
8549
+ (_g = this.subscriber) === null || _g === void 0 ? void 0 : _g.close();
8550
+ (_h = this.publisher) === null || _h === void 0 ? void 0 : _h.stopPublishing({ stopTracks: false });
8551
+ (_j = this.statsReporter) === null || _j === void 0 ? void 0 : _j.stop();
8515
8552
  sfuClient.close(); // clean up previous connection
8516
8553
  yield sleep(retryInterval(this.reconnectAttempts));
8517
8554
  yield this.join(data);
@@ -8581,7 +8618,7 @@ class Call {
8581
8618
  connectionConfig,
8582
8619
  onTrack: this.handleOnTrack,
8583
8620
  });
8584
- const audioSettings = (_e = this.data) === null || _e === void 0 ? void 0 : _e.settings.audio;
8621
+ const audioSettings = (_f = this.data) === null || _f === void 0 ? void 0 : _f.settings.audio;
8585
8622
  const isDtxEnabled = !!(audioSettings === null || audioSettings === void 0 ? void 0 : audioSettings.opus_dtx_enabled);
8586
8623
  const isRedEnabled = !!(audioSettings === null || audioSettings === void 0 ? void 0 : audioSettings.redundant_coding_enabled);
8587
8624
  this.publisher = new Publisher({
@@ -8739,9 +8776,9 @@ class Call {
8739
8776
  * @param trackType the track type to stop publishing.
8740
8777
  */
8741
8778
  this.stopPublish = (trackType) => __awaiter(this, void 0, void 0, function* () {
8742
- var _j;
8779
+ var _k;
8743
8780
  console.log(`stopPublish`, TrackType[trackType]);
8744
- yield ((_j = this.publisher) === null || _j === void 0 ? void 0 : _j.unpublishStream(trackType));
8781
+ yield ((_k = this.publisher) === null || _k === void 0 ? void 0 : _k.unpublishStream(trackType));
8745
8782
  });
8746
8783
  /**
8747
8784
  * Update track subscription configuration for one or more participants.
@@ -8882,8 +8919,8 @@ class Call {
8882
8919
  * @returns
8883
8920
  */
8884
8921
  this.updatePublishQuality = (enabledRids) => __awaiter(this, void 0, void 0, function* () {
8885
- var _k;
8886
- return (_k = this.publisher) === null || _k === void 0 ? void 0 : _k.updateVideoPublishQuality(enabledRids);
8922
+ var _l;
8923
+ return (_l = this.publisher) === null || _l === void 0 ? void 0 : _l.updateVideoPublishQuality(enabledRids);
8887
8924
  });
8888
8925
  this.handleOnTrack = (e) => {
8889
8926
  const [primaryStream] = e.streams;
@@ -9113,7 +9150,12 @@ class Call {
9113
9150
  * @param updates the updates to apply to the call.
9114
9151
  */
9115
9152
  this.update = (updates) => __awaiter(this, void 0, void 0, function* () {
9116
- return this.streamClient.patch(`${this.streamClientBasePath}`, updates);
9153
+ const response = yield this.streamClient.patch(`${this.streamClientBasePath}`, updates);
9154
+ const { call, members, own_capabilities } = response;
9155
+ this.state.setMetadata(call);
9156
+ this.state.setMembers(members);
9157
+ this.state.setOwnCapabilities(own_capabilities);
9158
+ return response;
9117
9159
  });
9118
9160
  /**
9119
9161
  * Ends the call. Once the call is ended, it cannot be re-joined.
@@ -9194,15 +9236,6 @@ class Call {
9194
9236
  this.state.setCallRecordingsList(response.recordings);
9195
9237
  return response;
9196
9238
  });
9197
- /**
9198
- * Returns a list of Edge Serves for current call.
9199
- *
9200
- * @deprecated merged with `call.join`.
9201
- * @param data the data.
9202
- */
9203
- this.getEdgeServer = (data) => {
9204
- return this.streamClient.post(`${this.streamClientBasePath}/get_edge_server`, data);
9205
- };
9206
9239
  /**
9207
9240
  * Sends an event to all call participants.
9208
9241
  *
@@ -9226,6 +9259,7 @@ class Call {
9226
9259
  }
9227
9260
  this.state.setMetadata(metadata);
9228
9261
  this.state.setMembers(members || []);
9262
+ this.state.setOwnCapabilities(ownCapabilities || []);
9229
9263
  this.state.setCallingState(ringing ? CallingState.RINGING : CallingState.IDLE);
9230
9264
  this.leaveCallHooks.push(registerEventHandlers(this, this.state, this.dispatcher));
9231
9265
  this.registerEffects();
@@ -9237,23 +9271,13 @@ class Call {
9237
9271
  createSubscription(this.state.metadata$, (metadata) => {
9238
9272
  if (!metadata)
9239
9273
  return;
9240
- this.permissionsContext.setPermissions(metadata.own_capabilities);
9241
9274
  this.permissionsContext.setCallSettings(metadata.settings);
9242
9275
  }),
9243
- // handles the case when the user is blocked by the call owner.
9244
- createSubscription(this.state.metadata$, (metadata) => __awaiter(this, void 0, void 0, function* () {
9245
- if (!metadata)
9246
- return;
9247
- const currentUserId = this.currentUserId;
9248
- if (currentUserId &&
9249
- metadata.blocked_user_ids.includes(currentUserId)) {
9250
- yield this.leave();
9251
- }
9252
- })),
9253
- // handle the case when the user permissions are revoked.
9254
- createSubscription(this.state.metadata$, (metadata) => {
9255
- if (!metadata)
9256
- return;
9276
+ // handle the case when the user permissions are modified.
9277
+ createSubscription(this.state.ownCapabilities$, (ownCapabilities) => {
9278
+ // update the permission context.
9279
+ this.permissionsContext.setPermissions(ownCapabilities);
9280
+ // check if the user still has publishing permissions and stop publishing if not.
9257
9281
  const permissionToTrackType = {
9258
9282
  [OwnCapability.SEND_AUDIO]: TrackType.AUDIO,
9259
9283
  [OwnCapability.SEND_VIDEO]: TrackType.VIDEO,
@@ -9268,6 +9292,16 @@ class Call {
9268
9292
  }
9269
9293
  });
9270
9294
  }),
9295
+ // handles the case when the user is blocked by the call owner.
9296
+ createSubscription(this.state.metadata$, (metadata) => __awaiter(this, void 0, void 0, function* () {
9297
+ if (!metadata)
9298
+ return;
9299
+ const currentUserId = this.currentUserId;
9300
+ if (currentUserId &&
9301
+ metadata.blocked_user_ids.includes(currentUserId)) {
9302
+ yield this.leave();
9303
+ }
9304
+ })),
9271
9305
  // watch for auto drop cancellation
9272
9306
  createSubscription(this.state.callingState$, (callingState) => {
9273
9307
  if (!this.ringing)
@@ -10957,7 +10991,7 @@ class StreamClient {
10957
10991
  }
10958
10992
  getUserAgent() {
10959
10993
  return (this.userAgent ||
10960
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.2-alpha.7"}`);
10994
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.2"}`);
10961
10995
  }
10962
10996
  setUserAgent(userAgent) {
10963
10997
  this.userAgent = userAgent;
@@ -11165,6 +11199,7 @@ class StreamVideoClient {
11165
11199
  type: c.call.type,
11166
11200
  metadata: c.call,
11167
11201
  members: c.members,
11202
+ ownCapabilities: c.own_capabilities,
11168
11203
  watching: data.watch,
11169
11204
  clientStore: this.writeableStateStore,
11170
11205
  });
@@ -11514,7 +11549,7 @@ const createSoundDetector = (audioStream, onSoundDetectedStateChanged, options =
11514
11549
  const percentage = averagedDataValue > audioLevelThreshold
11515
11550
  ? 100
11516
11551
  : Math.round((averagedDataValue / audioLevelThreshold) * 100);
11517
- onSoundDetectedStateChanged(isSoundDetected, percentage);
11552
+ onSoundDetectedStateChanged({ isSoundDetected, audioLevel: percentage });
11518
11553
  }, detectionFrequencyInMs);
11519
11554
  return function stop() {
11520
11555
  return __awaiter(this, void 0, void 0, function* () {