@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/dist/index.es.js CHANGED
@@ -6421,7 +6421,7 @@ const withSimulcastConstraints = (settings, optimalVideoLayers) => {
6421
6421
  rid: ridMapping[index], // reassign rid
6422
6422
  }));
6423
6423
  };
6424
- const findOptimalScreenSharingLayers = (videoTrack, preferences) => {
6424
+ const findOptimalScreenSharingLayers = (videoTrack, preferences, defaultMaxBitrate = 3000000) => {
6425
6425
  const settings = videoTrack.getSettings();
6426
6426
  return [
6427
6427
  {
@@ -6430,7 +6430,7 @@ const findOptimalScreenSharingLayers = (videoTrack, preferences) => {
6430
6430
  width: settings.width || 0,
6431
6431
  height: settings.height || 0,
6432
6432
  scaleResolutionDownBy: 1,
6433
- maxBitrate: preferences?.maxBitrate ?? 3000000,
6433
+ maxBitrate: preferences?.maxBitrate ?? defaultMaxBitrate,
6434
6434
  maxFramerate: preferences?.maxFramerate ?? 30,
6435
6435
  },
6436
6436
  ];
@@ -7938,10 +7938,11 @@ class Publisher {
7938
7938
  if (!transceiver) {
7939
7939
  const { settings } = this.state;
7940
7940
  const targetResolution = settings?.video.target_resolution;
7941
+ const screenShareBitrate = settings?.screensharing.target_resolution?.bitrate;
7941
7942
  const videoEncodings = trackType === TrackType.VIDEO
7942
7943
  ? findOptimalVideoLayers(track, targetResolution)
7943
7944
  : trackType === TrackType.SCREEN_SHARE
7944
- ? findOptimalScreenSharingLayers(track, opts.screenShareSettings)
7945
+ ? findOptimalScreenSharingLayers(track, opts.screenShareSettings, screenShareBitrate)
7945
7946
  : undefined;
7946
7947
  let preferredCodec = opts.preferredCodec;
7947
7948
  if (!preferredCodec && trackType === TrackType.VIDEO) {
@@ -8885,7 +8886,7 @@ class StreamSfuClient {
8885
8886
  return retryable(() => this.rpc.updateSubscriptions({
8886
8887
  sessionId: this.sessionId,
8887
8888
  tracks: subscriptions,
8888
- }), this.logger);
8889
+ }), this.logger, 'debug');
8889
8890
  };
8890
8891
  this.setPublisher = async (data) => {
8891
8892
  return retryable(() => this.rpc.setPublisher({
@@ -8931,7 +8932,7 @@ class StreamSfuClient {
8931
8932
  return retryable(() => this.rpc.sendStats({
8932
8933
  ...stats,
8933
8934
  sessionId: this.sessionId,
8934
- }), this.logger);
8935
+ }), this.logger, 'debug');
8935
8936
  };
8936
8937
  this.startNoiseCancellation = async () => {
8937
8938
  return retryable(() => this.rpc.startNoiseCancellation({
@@ -9068,7 +9069,7 @@ const MAX_RETRIES = 5;
9068
9069
  * @param <I> the type of the request object.
9069
9070
  * @param <O> the type of the response object.
9070
9071
  */
9071
- const retryable = async (rpc, logger) => {
9072
+ const retryable = async (rpc, logger, level = 'error') => {
9072
9073
  let retryAttempt = 0;
9073
9074
  let rpcCallResult;
9074
9075
  do {
@@ -9077,10 +9078,9 @@ const retryable = async (rpc, logger) => {
9077
9078
  await sleep(retryInterval(retryAttempt));
9078
9079
  }
9079
9080
  rpcCallResult = await rpc();
9080
- logger('trace', `SFU RPC response received for ${rpcCallResult.method.name}`, rpcCallResult);
9081
9081
  // if the RPC call failed, log the error and retry
9082
9082
  if (rpcCallResult.response.error) {
9083
- logger('error', `SFU RPC Error (${rpcCallResult.method.name}):`, rpcCallResult.response.error);
9083
+ logger(level, `SFU RPC Error (${rpcCallResult.method.name}):`, rpcCallResult.response.error);
9084
9084
  }
9085
9085
  retryAttempt++;
9086
9086
  } while (rpcCallResult.response.error?.shouldRetry &&
@@ -11623,6 +11623,17 @@ class ScreenShareState extends InputMediaDeviceManagerState {
11623
11623
  class ScreenShareManager extends InputMediaDeviceManager {
11624
11624
  constructor(call) {
11625
11625
  super(call, new ScreenShareState(), TrackType.SCREEN_SHARE);
11626
+ this.subscriptions.push(createSubscription(call.state.settings$, (settings) => {
11627
+ const maybeTargetResolution = settings?.screensharing.target_resolution;
11628
+ if (maybeTargetResolution) {
11629
+ this.setDefaultConstraints({
11630
+ video: {
11631
+ width: maybeTargetResolution.width,
11632
+ height: maybeTargetResolution.height,
11633
+ },
11634
+ });
11635
+ }
11636
+ }));
11626
11637
  }
11627
11638
  /**
11628
11639
  * Will enable screen share audio options on supported platforms.
@@ -14881,7 +14892,7 @@ class StreamClient {
14881
14892
  });
14882
14893
  };
14883
14894
  this.getUserAgent = () => {
14884
- const version = "0.7.11" ;
14895
+ const version = "0.7.13" ;
14885
14896
  return (this.userAgent ||
14886
14897
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14887
14898
  };