@stream-io/video-client 0.0.2-alpha.9 → 0.0.4

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/dist/index.cjs.js CHANGED
@@ -5243,8 +5243,8 @@ const removeCodec = (sdp, mediaType, codecToRemove) => {
5243
5243
  const fmtp = section === null || section === void 0 ? void 0 : section.fmtp.find((f) => f.payload === codecId);
5244
5244
  return sdp
5245
5245
  .replace(mediaSection.original, `${mediaSection.mediaWithPorts} ${newCodecOrder}`)
5246
- .replace(new RegExp(`${rtpMap.original}[\r\n|\r|\n]`), '') // remove the corresponding rtpmap line
5247
- .replace((fmtp === null || fmtp === void 0 ? void 0 : fmtp.original) ? new RegExp(`${fmtp === null || fmtp === void 0 ? void 0 : fmtp.original}[\r\n|\r|\n]`) : '', ''); // remove the corresponding fmtp line
5246
+ .replace(new RegExp(`${rtpMap.original}[\r\n]+`), '') // remove the corresponding rtpmap line
5247
+ .replace((fmtp === null || fmtp === void 0 ? void 0 : fmtp.original) ? new RegExp(`${fmtp === null || fmtp === void 0 ? void 0 : fmtp.original}[\r\n]+`) : '', ''); // remove the corresponding fmtp line
5248
5248
  };
5249
5249
  /**
5250
5250
  * Gets the fmtp line corresponding to opus
@@ -5254,8 +5254,7 @@ const getOpusFmtp = (sdp) => {
5254
5254
  const rtpMap = section === null || section === void 0 ? void 0 : section.rtpMap.find((r) => r.codec.toLowerCase() === 'opus');
5255
5255
  const codecId = rtpMap === null || rtpMap === void 0 ? void 0 : rtpMap.payload;
5256
5256
  if (codecId) {
5257
- const fmtp = section === null || section === void 0 ? void 0 : section.fmtp.find((f) => f.payload === codecId);
5258
- return fmtp;
5257
+ return section === null || section === void 0 ? void 0 : section.fmtp.find((f) => f.payload === codecId);
5259
5258
  }
5260
5259
  };
5261
5260
  /**
@@ -5469,7 +5468,7 @@ const defaultTargetResolution = {
5469
5468
  const findOptimalVideoLayers = (videoTrack, targetResolution = defaultTargetResolution) => {
5470
5469
  const optimalVideoLayers = [];
5471
5470
  const settings = videoTrack.getSettings();
5472
- const { width: w = 0, height: h = 0 } = settings;
5471
+ const { width: w = targetResolution.width, height: h = targetResolution.height, } = settings;
5473
5472
  const maxBitrate = getComputedMaxBitrate(targetResolution, w, h);
5474
5473
  let downscaleFactor = 1;
5475
5474
  ['f', 'h', 'q'].forEach((rid) => {
@@ -5737,14 +5736,13 @@ class Publisher {
5737
5736
  };
5738
5737
  this.updateVideoPublishQuality = (enabledRids) => __awaiter(this, void 0, void 0, function* () {
5739
5738
  var _a;
5740
- console.log('Updating publish quality, qualities requested by SFU:', enabledRids);
5739
+ console.log('Update publish quality, requested rids by SFU:', enabledRids);
5741
5740
  const videoSender = (_a = this.transceiverRegistry[TrackType.VIDEO]) === null || _a === void 0 ? void 0 : _a.sender;
5742
5741
  if (!videoSender)
5743
5742
  return;
5744
5743
  const params = videoSender.getParameters();
5745
5744
  let changed = false;
5746
5745
  params.encodings.forEach((enc) => {
5747
- console.log(enc.rid, enc.active);
5748
5746
  // flip 'active' flag only when necessary
5749
5747
  const shouldEnable = enabledRids.includes(enc.rid);
5750
5748
  if (shouldEnable !== enc.active) {
@@ -5757,6 +5755,10 @@ class Publisher {
5757
5755
  console.warn('No suitable video encoding quality found');
5758
5756
  }
5759
5757
  yield videoSender.setParameters(params);
5758
+ console.log(`Update publish quality, enabled rids: ${params.encodings
5759
+ .filter((e) => e.active)
5760
+ .map((e) => e.rid)
5761
+ .join(', ')}`);
5760
5762
  }
5761
5763
  });
5762
5764
  this.getCodecPreferences = (trackType, preferredCodec) => {
@@ -5785,7 +5787,7 @@ class Publisher {
5785
5787
  const offer = yield this.publisher.createOffer();
5786
5788
  let sdp = offer.sdp;
5787
5789
  if (sdp) {
5788
- toggleDtx(sdp, this.isDtxEnabled);
5790
+ sdp = toggleDtx(sdp, this.isDtxEnabled);
5789
5791
  if (isReactNative()) {
5790
5792
  if (this.preferredVideoCodec) {
5791
5793
  sdp = setPreferredCodec(sdp, 'video', this.preferredVideoCodec);
@@ -6132,8 +6134,9 @@ class StreamSfuClient {
6132
6134
  * @param url the URL of the SFU.
6133
6135
  * @param wsEndpoint the WebSocket endpoint of the SFU.
6134
6136
  * @param token the JWT token to use for authentication.
6137
+ * @param sessionId the `sessionId` of the currently connected participant.
6135
6138
  */
6136
- constructor(dispatcher, url, wsEndpoint, token) {
6139
+ constructor({ dispatcher, url, wsEndpoint, token, sessionId, }) {
6137
6140
  /**
6138
6141
  * A buffer for ICE Candidates that are received before
6139
6142
  * the PeerConnections are ready to handle them.
@@ -6218,7 +6221,7 @@ class StreamSfuClient {
6218
6221
  }
6219
6222
  }, this.unhealthyTimeoutInMs);
6220
6223
  };
6221
- this.sessionId = generateUUIDv4();
6224
+ this.sessionId = sessionId || generateUUIDv4();
6222
6225
  this.token = token;
6223
6226
  this.rpc = createSignalClient({
6224
6227
  baseUrl: url,
@@ -6619,6 +6622,12 @@ class CallState {
6619
6622
  * @internal
6620
6623
  */
6621
6624
  this.membersSubject = new rxjs.BehaviorSubject([]);
6625
+ /**
6626
+ * The list of capabilities of the current user.
6627
+ *
6628
+ * @private
6629
+ */
6630
+ this.ownCapabilitiesSubject = new rxjs.BehaviorSubject([]);
6622
6631
  /**
6623
6632
  * The calling state.
6624
6633
  *
@@ -6801,6 +6810,15 @@ class CallState {
6801
6810
  this.setMembers = (members) => {
6802
6811
  this.setCurrentValue(this.membersSubject, members);
6803
6812
  };
6813
+ /**
6814
+ * Sets the own capabilities.
6815
+ *
6816
+ * @internal
6817
+ * @param capabilities the capabilities to set.
6818
+ */
6819
+ this.setOwnCapabilities = (capabilities) => {
6820
+ return this.setCurrentValue(this.ownCapabilitiesSubject, capabilities);
6821
+ };
6804
6822
  /**
6805
6823
  * Will try to find the participant with the given sessionId in the current call.
6806
6824
  *
@@ -6890,6 +6908,7 @@ class CallState {
6890
6908
  this.callRecordingList$ = this.callRecordingListSubject.asObservable();
6891
6909
  this.metadata$ = this.metadataSubject.asObservable();
6892
6910
  this.members$ = this.membersSubject.asObservable();
6911
+ this.ownCapabilities$ = this.ownCapabilitiesSubject.asObservable();
6893
6912
  this.callingState$ = this.callingStateSubject.asObservable();
6894
6913
  }
6895
6914
  /**
@@ -6985,6 +7004,12 @@ class CallState {
6985
7004
  get members() {
6986
7005
  return this.getCurrentValue(this.members$);
6987
7006
  }
7007
+ /**
7008
+ * The capabilities of the current user for the current call.
7009
+ */
7010
+ get ownCapabilities() {
7011
+ return this.getCurrentValue(this.ownCapabilities$);
7012
+ }
6988
7013
  }
6989
7014
 
6990
7015
  class StreamVideoWriteableStateStore {
@@ -7249,7 +7274,10 @@ const watchCallPermissionRequest = (state) => {
7249
7274
  return function onCallPermissionRequest(event) {
7250
7275
  if (event.type !== 'call.permission_request')
7251
7276
  return;
7252
- state.setCallPermissionRequest(event);
7277
+ const { localParticipant } = state;
7278
+ if (event.user.id !== (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.userId)) {
7279
+ state.setCallPermissionRequest(event);
7280
+ }
7253
7281
  };
7254
7282
  };
7255
7283
  /**
@@ -7261,7 +7289,7 @@ const watchCallPermissionsUpdated = (state) => {
7261
7289
  return;
7262
7290
  const { localParticipant } = state;
7263
7291
  if (event.user.id === (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.userId)) {
7264
- state.setMetadata((metadata) => (Object.assign(Object.assign({}, metadata), { own_capabilities: event.own_capabilities })));
7292
+ state.setOwnCapabilities(event.own_capabilities);
7265
7293
  }
7266
7294
  };
7267
7295
  };
@@ -7272,7 +7300,6 @@ const watchCallPermissionsUpdated = (state) => {
7272
7300
  */
7273
7301
  const watchCallGrantsUpdated = (state) => {
7274
7302
  return function onCallGrantsUpdated(event) {
7275
- var _a;
7276
7303
  if (event.eventPayload.oneofKind !== 'callGrantsUpdated')
7277
7304
  return;
7278
7305
  const { currentGrants } = event.eventPayload.callGrantsUpdated;
@@ -7283,15 +7310,13 @@ const watchCallGrantsUpdated = (state) => {
7283
7310
  [OwnCapability.SEND_VIDEO]: canPublishVideo,
7284
7311
  [OwnCapability.SCREENSHARE]: canScreenshare,
7285
7312
  };
7286
- const nextCapabilities = (((_a = state.metadata) === null || _a === void 0 ? void 0 : _a.own_capabilities) || []).filter((capability) => update[capability] !== false);
7313
+ const nextCapabilities = state.ownCapabilities.filter((capability) => update[capability] !== false);
7287
7314
  Object.entries(update).forEach(([capability, value]) => {
7288
7315
  if (value && !nextCapabilities.includes(capability)) {
7289
7316
  nextCapabilities.push(capability);
7290
7317
  }
7291
7318
  });
7292
- state.setMetadata((metadata) => {
7293
- return Object.assign(Object.assign({}, metadata), { own_capabilities: nextCapabilities });
7294
- });
7319
+ state.setOwnCapabilities(nextCapabilities);
7295
7320
  }
7296
7321
  };
7297
7322
  };
@@ -7584,10 +7609,7 @@ const watchCallSessionStarted = (state) => {
7584
7609
  return function onCallSessionStarted(event) {
7585
7610
  if (event.type !== 'call.session_started')
7586
7611
  return;
7587
- const { call } = event;
7588
- state.setMetadata((metadata) => (Object.assign(Object.assign({}, call), {
7589
- // FIXME OL: temporary, until the backend sends the own_capabilities
7590
- own_capabilities: (metadata === null || metadata === void 0 ? void 0 : metadata.own_capabilities) || [] })));
7612
+ state.setMetadata(event.call);
7591
7613
  };
7592
7614
  };
7593
7615
  /**
@@ -7599,10 +7621,7 @@ const watchCallSessionEnded = (state) => {
7599
7621
  return function onCallSessionEnded(event) {
7600
7622
  if (event.type !== 'call.session_ended')
7601
7623
  return;
7602
- const { call } = event;
7603
- state.setMetadata((metadata) => (Object.assign(Object.assign({}, call), {
7604
- // FIXME OL: temporary, until the backend sends the own_capabilities
7605
- own_capabilities: (metadata === null || metadata === void 0 ? void 0 : metadata.own_capabilities) || [] })));
7624
+ state.setMetadata(event.call);
7606
7625
  };
7607
7626
  };
7608
7627
  /**
@@ -7764,13 +7783,14 @@ const registerRingingCallEventHandlers = (call) => {
7764
7783
  const join = (httpClient, type, id, data) => __awaiter(void 0, void 0, void 0, function* () {
7765
7784
  yield httpClient.connectionIdPromise;
7766
7785
  const joinCallResponse = yield doJoin(httpClient, type, id, data);
7767
- const { call, credentials, members } = joinCallResponse;
7786
+ const { call, credentials, members, own_capabilities } = joinCallResponse;
7768
7787
  return {
7769
7788
  connectionConfig: toRtcConfiguration(credentials.ice_servers),
7770
7789
  sfuServer: credentials.server,
7771
7790
  token: credentials.token,
7772
7791
  metadata: call,
7773
7792
  members,
7793
+ ownCapabilities: own_capabilities,
7774
7794
  };
7775
7795
  });
7776
7796
  const doJoin = (httpClient, type, id, data) => __awaiter(void 0, void 0, void 0, function* () {
@@ -7787,9 +7807,12 @@ const doJoin = (httpClient, type, id, data) => __awaiter(void 0, void 0, void 0,
7787
7807
  });
7788
7808
  const getLocationHint = () => __awaiter(void 0, void 0, void 0, function* () {
7789
7809
  const hintURL = `https://hint.stream-io-video.com/`;
7810
+ const abortController = new AbortController();
7811
+ const timeoutId = setTimeout(() => abortController.abort(), 1000);
7790
7812
  try {
7791
7813
  const response = yield fetch(hintURL, {
7792
7814
  method: 'HEAD',
7815
+ signal: abortController.signal,
7793
7816
  });
7794
7817
  const awsPop = response.headers.get('x-amz-cf-pop') || 'ERR';
7795
7818
  return awsPop.substring(0, 3); // AMS1-P2 -> AMS
@@ -7798,6 +7821,9 @@ const getLocationHint = () => __awaiter(void 0, void 0, void 0, function* () {
7798
7821
  console.error(`Failed to get location hint from ${hintURL}`, e);
7799
7822
  return 'ERR';
7800
7823
  }
7824
+ finally {
7825
+ clearTimeout(timeoutId);
7826
+ }
7801
7827
  });
7802
7828
  const toRtcConfiguration = (config) => {
7803
7829
  if (!config || config.length === 0)
@@ -8300,7 +8326,7 @@ class Call {
8300
8326
  * Use the [`StreamVideoClient.call`](./StreamVideoClient.md/#call)
8301
8327
  * method to construct a `Call` instance.
8302
8328
  */
8303
- constructor({ type, id, streamClient, metadata, members, sortParticipantsBy, clientStore, ringing = false, watching = false, }) {
8329
+ constructor({ type, id, streamClient, metadata, members, ownCapabilities, sortParticipantsBy, clientStore, ringing = false, watching = false, }) {
8304
8330
  /**
8305
8331
  * ViewportTracker instance
8306
8332
  */
@@ -8392,6 +8418,7 @@ class Call {
8392
8418
  }
8393
8419
  this.state.setMetadata(response.call);
8394
8420
  this.state.setMembers(response.members);
8421
+ this.state.setOwnCapabilities(response.own_capabilities);
8395
8422
  if (this.streamClient._hasConnectionID()) {
8396
8423
  this.watching = true;
8397
8424
  this.clientStore.registerCall(this);
@@ -8410,6 +8437,7 @@ class Call {
8410
8437
  }
8411
8438
  this.state.setMetadata(response.call);
8412
8439
  this.state.setMembers(response.members);
8440
+ this.state.setOwnCapabilities(response.own_capabilities);
8413
8441
  if (this.streamClient._hasConnectionID()) {
8414
8442
  this.watching = true;
8415
8443
  this.clientStore.registerCall(this);
@@ -8456,7 +8484,7 @@ class Call {
8456
8484
  * @returns a promise which resolves once the call join-flow has finished.
8457
8485
  */
8458
8486
  this.join = (data) => __awaiter(this, void 0, void 0, function* () {
8459
- var _e;
8487
+ var _e, _f;
8460
8488
  if ([exports.CallingState.JOINED, exports.CallingState.JOINING].includes(this.state.callingState)) {
8461
8489
  throw new Error(`Illegal State: Already joined.`);
8462
8490
  }
@@ -8476,6 +8504,7 @@ class Call {
8476
8504
  const call = yield join(this.streamClient, this.type, this.id, data);
8477
8505
  this.state.setMetadata(call.metadata);
8478
8506
  this.state.setMembers(call.members);
8507
+ this.state.setOwnCapabilities(call.ownCapabilities);
8479
8508
  connectionConfig = call.connectionConfig;
8480
8509
  sfuServer = call.sfuServer;
8481
8510
  sfuToken = call.token;
@@ -8501,21 +8530,28 @@ class Call {
8501
8530
  const sfuWsUrlParam = params.get('sfuWsUrl');
8502
8531
  sfuWsUrl = sfuWsUrlParam || sfuServer.ws_endpoint;
8503
8532
  }
8504
- const sfuClient = (this.sfuClient = new StreamSfuClient(this.dispatcher, sfuUrl, sfuWsUrl, sfuToken));
8533
+ const previousSessionId = (_e = this.sfuClient) === null || _e === void 0 ? void 0 : _e.sessionId;
8534
+ const sfuClient = (this.sfuClient = new StreamSfuClient({
8535
+ dispatcher: this.dispatcher,
8536
+ url: sfuUrl,
8537
+ wsEndpoint: sfuWsUrl,
8538
+ token: sfuToken,
8539
+ sessionId: previousSessionId,
8540
+ }));
8505
8541
  /**
8506
8542
  * A closure which hides away the re-connection logic.
8507
8543
  */
8508
8544
  const rejoin = () => __awaiter(this, void 0, void 0, function* () {
8509
- var _f, _g, _h;
8545
+ var _g, _h, _j;
8510
8546
  console.log(`Rejoining call ${this.cid} (${this.reconnectAttempts})...`);
8511
8547
  this.reconnectAttempts++;
8512
8548
  this.state.setCallingState(exports.CallingState.RECONNECTING);
8513
8549
  // take a snapshot of the current "local participant" state
8514
8550
  // we'll need it for restoring the previous publishing state later
8515
8551
  const localParticipant = this.state.localParticipant;
8516
- (_f = this.subscriber) === null || _f === void 0 ? void 0 : _f.close();
8517
- (_g = this.publisher) === null || _g === void 0 ? void 0 : _g.stopPublishing({ stopTracks: false });
8518
- (_h = this.statsReporter) === null || _h === void 0 ? void 0 : _h.stop();
8552
+ (_g = this.subscriber) === null || _g === void 0 ? void 0 : _g.close();
8553
+ (_h = this.publisher) === null || _h === void 0 ? void 0 : _h.stopPublishing({ stopTracks: false });
8554
+ (_j = this.statsReporter) === null || _j === void 0 ? void 0 : _j.stop();
8519
8555
  sfuClient.close(); // clean up previous connection
8520
8556
  yield sleep(retryInterval(this.reconnectAttempts));
8521
8557
  yield this.join(data);
@@ -8585,7 +8621,7 @@ class Call {
8585
8621
  connectionConfig,
8586
8622
  onTrack: this.handleOnTrack,
8587
8623
  });
8588
- const audioSettings = (_e = this.data) === null || _e === void 0 ? void 0 : _e.settings.audio;
8624
+ const audioSettings = (_f = this.data) === null || _f === void 0 ? void 0 : _f.settings.audio;
8589
8625
  const isDtxEnabled = !!(audioSettings === null || audioSettings === void 0 ? void 0 : audioSettings.opus_dtx_enabled);
8590
8626
  const isRedEnabled = !!(audioSettings === null || audioSettings === void 0 ? void 0 : audioSettings.redundant_coding_enabled);
8591
8627
  this.publisher = new Publisher({
@@ -8743,9 +8779,9 @@ class Call {
8743
8779
  * @param trackType the track type to stop publishing.
8744
8780
  */
8745
8781
  this.stopPublish = (trackType) => __awaiter(this, void 0, void 0, function* () {
8746
- var _j;
8782
+ var _k;
8747
8783
  console.log(`stopPublish`, TrackType[trackType]);
8748
- yield ((_j = this.publisher) === null || _j === void 0 ? void 0 : _j.unpublishStream(trackType));
8784
+ yield ((_k = this.publisher) === null || _k === void 0 ? void 0 : _k.unpublishStream(trackType));
8749
8785
  });
8750
8786
  /**
8751
8787
  * Update track subscription configuration for one or more participants.
@@ -8886,8 +8922,8 @@ class Call {
8886
8922
  * @returns
8887
8923
  */
8888
8924
  this.updatePublishQuality = (enabledRids) => __awaiter(this, void 0, void 0, function* () {
8889
- var _k;
8890
- return (_k = this.publisher) === null || _k === void 0 ? void 0 : _k.updateVideoPublishQuality(enabledRids);
8925
+ var _l;
8926
+ return (_l = this.publisher) === null || _l === void 0 ? void 0 : _l.updateVideoPublishQuality(enabledRids);
8891
8927
  });
8892
8928
  this.handleOnTrack = (e) => {
8893
8929
  const [primaryStream] = e.streams;
@@ -9117,7 +9153,12 @@ class Call {
9117
9153
  * @param updates the updates to apply to the call.
9118
9154
  */
9119
9155
  this.update = (updates) => __awaiter(this, void 0, void 0, function* () {
9120
- return this.streamClient.patch(`${this.streamClientBasePath}`, updates);
9156
+ const response = yield this.streamClient.patch(`${this.streamClientBasePath}`, updates);
9157
+ const { call, members, own_capabilities } = response;
9158
+ this.state.setMetadata(call);
9159
+ this.state.setMembers(members);
9160
+ this.state.setOwnCapabilities(own_capabilities);
9161
+ return response;
9121
9162
  });
9122
9163
  /**
9123
9164
  * Ends the call. Once the call is ended, it cannot be re-joined.
@@ -9198,15 +9239,6 @@ class Call {
9198
9239
  this.state.setCallRecordingsList(response.recordings);
9199
9240
  return response;
9200
9241
  });
9201
- /**
9202
- * Returns a list of Edge Serves for current call.
9203
- *
9204
- * @deprecated merged with `call.join`.
9205
- * @param data the data.
9206
- */
9207
- this.getEdgeServer = (data) => {
9208
- return this.streamClient.post(`${this.streamClientBasePath}/get_edge_server`, data);
9209
- };
9210
9242
  /**
9211
9243
  * Sends an event to all call participants.
9212
9244
  *
@@ -9230,6 +9262,7 @@ class Call {
9230
9262
  }
9231
9263
  this.state.setMetadata(metadata);
9232
9264
  this.state.setMembers(members || []);
9265
+ this.state.setOwnCapabilities(ownCapabilities || []);
9233
9266
  this.state.setCallingState(ringing ? exports.CallingState.RINGING : exports.CallingState.IDLE);
9234
9267
  this.leaveCallHooks.push(registerEventHandlers(this, this.state, this.dispatcher));
9235
9268
  this.registerEffects();
@@ -9241,23 +9274,13 @@ class Call {
9241
9274
  createSubscription(this.state.metadata$, (metadata) => {
9242
9275
  if (!metadata)
9243
9276
  return;
9244
- this.permissionsContext.setPermissions(metadata.own_capabilities);
9245
9277
  this.permissionsContext.setCallSettings(metadata.settings);
9246
9278
  }),
9247
- // handles the case when the user is blocked by the call owner.
9248
- createSubscription(this.state.metadata$, (metadata) => __awaiter(this, void 0, void 0, function* () {
9249
- if (!metadata)
9250
- return;
9251
- const currentUserId = this.currentUserId;
9252
- if (currentUserId &&
9253
- metadata.blocked_user_ids.includes(currentUserId)) {
9254
- yield this.leave();
9255
- }
9256
- })),
9257
- // handle the case when the user permissions are revoked.
9258
- createSubscription(this.state.metadata$, (metadata) => {
9259
- if (!metadata)
9260
- return;
9279
+ // handle the case when the user permissions are modified.
9280
+ createSubscription(this.state.ownCapabilities$, (ownCapabilities) => {
9281
+ // update the permission context.
9282
+ this.permissionsContext.setPermissions(ownCapabilities);
9283
+ // check if the user still has publishing permissions and stop publishing if not.
9261
9284
  const permissionToTrackType = {
9262
9285
  [OwnCapability.SEND_AUDIO]: TrackType.AUDIO,
9263
9286
  [OwnCapability.SEND_VIDEO]: TrackType.VIDEO,
@@ -9272,6 +9295,16 @@ class Call {
9272
9295
  }
9273
9296
  });
9274
9297
  }),
9298
+ // handles the case when the user is blocked by the call owner.
9299
+ createSubscription(this.state.metadata$, (metadata) => __awaiter(this, void 0, void 0, function* () {
9300
+ if (!metadata)
9301
+ return;
9302
+ const currentUserId = this.currentUserId;
9303
+ if (currentUserId &&
9304
+ metadata.blocked_user_ids.includes(currentUserId)) {
9305
+ yield this.leave();
9306
+ }
9307
+ })),
9275
9308
  // watch for auto drop cancellation
9276
9309
  createSubscription(this.state.callingState$, (callingState) => {
9277
9310
  if (!this.ringing)
@@ -10962,7 +10995,7 @@ class StreamClient {
10962
10995
  }
10963
10996
  getUserAgent() {
10964
10997
  return (this.userAgent ||
10965
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.2-alpha.8"}`);
10998
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.3"}`);
10966
10999
  }
10967
11000
  setUserAgent(userAgent) {
10968
11001
  this.userAgent = userAgent;
@@ -11170,6 +11203,7 @@ class StreamVideoClient {
11170
11203
  type: c.call.type,
11171
11204
  metadata: c.call,
11172
11205
  members: c.members,
11206
+ ownCapabilities: c.own_capabilities,
11173
11207
  watching: data.watch,
11174
11208
  clientStore: this.writeableStateStore,
11175
11209
  });
@@ -11519,7 +11553,7 @@ const createSoundDetector = (audioStream, onSoundDetectedStateChanged, options =
11519
11553
  const percentage = averagedDataValue > audioLevelThreshold
11520
11554
  ? 100
11521
11555
  : Math.round((averagedDataValue / audioLevelThreshold) * 100);
11522
- onSoundDetectedStateChanged(isSoundDetected, percentage);
11556
+ onSoundDetectedStateChanged({ isSoundDetected, audioLevel: percentage });
11523
11557
  }, detectionFrequencyInMs);
11524
11558
  return function stop() {
11525
11559
  return __awaiter(this, void 0, void 0, function* () {