@stream-io/video-client 0.7.11 → 0.7.13

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
+ ### [0.7.13](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.12...@stream-io/video-client-0.7.13) (2024-05-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * change log level of send stats SFU API to type debug ([#1338](https://github.com/GetStream/stream-video-js/issues/1338)) ([76e43ad](https://github.com/GetStream/stream-video-js/commit/76e43adbff1d54e1b0b5548dabf550cd9044d9dc))
11
+
12
+ ### [0.7.12](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.11...@stream-io/video-client-0.7.12) (2024-05-03)
13
+
14
+
15
+ ### Features
16
+
17
+ * support target_resolution backend setting for screensharing ([#1336](https://github.com/GetStream/stream-video-js/issues/1336)) ([1e9f796](https://github.com/GetStream/stream-video-js/commit/1e9f7963009ac7fc27ee24abc00eb68749cc19d8))
18
+
5
19
  ### [0.7.11](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.10...@stream-io/video-client-0.7.11) (2024-05-03)
6
20
 
7
21
 
@@ -6420,7 +6420,7 @@ const withSimulcastConstraints = (settings, optimalVideoLayers) => {
6420
6420
  rid: ridMapping[index], // reassign rid
6421
6421
  }));
6422
6422
  };
6423
- const findOptimalScreenSharingLayers = (videoTrack, preferences) => {
6423
+ const findOptimalScreenSharingLayers = (videoTrack, preferences, defaultMaxBitrate = 3000000) => {
6424
6424
  const settings = videoTrack.getSettings();
6425
6425
  return [
6426
6426
  {
@@ -6429,7 +6429,7 @@ const findOptimalScreenSharingLayers = (videoTrack, preferences) => {
6429
6429
  width: settings.width || 0,
6430
6430
  height: settings.height || 0,
6431
6431
  scaleResolutionDownBy: 1,
6432
- maxBitrate: preferences?.maxBitrate ?? 3000000,
6432
+ maxBitrate: preferences?.maxBitrate ?? defaultMaxBitrate,
6433
6433
  maxFramerate: preferences?.maxFramerate ?? 30,
6434
6434
  },
6435
6435
  ];
@@ -7937,10 +7937,11 @@ class Publisher {
7937
7937
  if (!transceiver) {
7938
7938
  const { settings } = this.state;
7939
7939
  const targetResolution = settings?.video.target_resolution;
7940
+ const screenShareBitrate = settings?.screensharing.target_resolution?.bitrate;
7940
7941
  const videoEncodings = trackType === TrackType.VIDEO
7941
7942
  ? findOptimalVideoLayers(track, targetResolution)
7942
7943
  : trackType === TrackType.SCREEN_SHARE
7943
- ? findOptimalScreenSharingLayers(track, opts.screenShareSettings)
7944
+ ? findOptimalScreenSharingLayers(track, opts.screenShareSettings, screenShareBitrate)
7944
7945
  : undefined;
7945
7946
  let preferredCodec = opts.preferredCodec;
7946
7947
  if (!preferredCodec && trackType === TrackType.VIDEO) {
@@ -8884,7 +8885,7 @@ class StreamSfuClient {
8884
8885
  return retryable(() => this.rpc.updateSubscriptions({
8885
8886
  sessionId: this.sessionId,
8886
8887
  tracks: subscriptions,
8887
- }), this.logger);
8888
+ }), this.logger, 'debug');
8888
8889
  };
8889
8890
  this.setPublisher = async (data) => {
8890
8891
  return retryable(() => this.rpc.setPublisher({
@@ -8930,7 +8931,7 @@ class StreamSfuClient {
8930
8931
  return retryable(() => this.rpc.sendStats({
8931
8932
  ...stats,
8932
8933
  sessionId: this.sessionId,
8933
- }), this.logger);
8934
+ }), this.logger, 'debug');
8934
8935
  };
8935
8936
  this.startNoiseCancellation = async () => {
8936
8937
  return retryable(() => this.rpc.startNoiseCancellation({
@@ -9067,7 +9068,7 @@ const MAX_RETRIES = 5;
9067
9068
  * @param <I> the type of the request object.
9068
9069
  * @param <O> the type of the response object.
9069
9070
  */
9070
- const retryable = async (rpc, logger) => {
9071
+ const retryable = async (rpc, logger, level = 'error') => {
9071
9072
  let retryAttempt = 0;
9072
9073
  let rpcCallResult;
9073
9074
  do {
@@ -9076,10 +9077,9 @@ const retryable = async (rpc, logger) => {
9076
9077
  await sleep(retryInterval(retryAttempt));
9077
9078
  }
9078
9079
  rpcCallResult = await rpc();
9079
- logger('trace', `SFU RPC response received for ${rpcCallResult.method.name}`, rpcCallResult);
9080
9080
  // if the RPC call failed, log the error and retry
9081
9081
  if (rpcCallResult.response.error) {
9082
- logger('error', `SFU RPC Error (${rpcCallResult.method.name}):`, rpcCallResult.response.error);
9082
+ logger(level, `SFU RPC Error (${rpcCallResult.method.name}):`, rpcCallResult.response.error);
9083
9083
  }
9084
9084
  retryAttempt++;
9085
9085
  } while (rpcCallResult.response.error?.shouldRetry &&
@@ -11622,6 +11622,17 @@ class ScreenShareState extends InputMediaDeviceManagerState {
11622
11622
  class ScreenShareManager extends InputMediaDeviceManager {
11623
11623
  constructor(call) {
11624
11624
  super(call, new ScreenShareState(), TrackType.SCREEN_SHARE);
11625
+ this.subscriptions.push(createSubscription(call.state.settings$, (settings) => {
11626
+ const maybeTargetResolution = settings?.screensharing.target_resolution;
11627
+ if (maybeTargetResolution) {
11628
+ this.setDefaultConstraints({
11629
+ video: {
11630
+ width: maybeTargetResolution.width,
11631
+ height: maybeTargetResolution.height,
11632
+ },
11633
+ });
11634
+ }
11635
+ }));
11625
11636
  }
11626
11637
  /**
11627
11638
  * Will enable screen share audio options on supported platforms.
@@ -14882,7 +14893,7 @@ class StreamClient {
14882
14893
  });
14883
14894
  };
14884
14895
  this.getUserAgent = () => {
14885
- const version = "0.7.11" ;
14896
+ const version = "0.7.13" ;
14886
14897
  return (this.userAgent ||
14887
14898
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14888
14899
  };