@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.cjs.js CHANGED
@@ -6441,7 +6441,7 @@ const withSimulcastConstraints = (settings, optimalVideoLayers) => {
6441
6441
  rid: ridMapping[index], // reassign rid
6442
6442
  }));
6443
6443
  };
6444
- const findOptimalScreenSharingLayers = (videoTrack, preferences) => {
6444
+ const findOptimalScreenSharingLayers = (videoTrack, preferences, defaultMaxBitrate = 3000000) => {
6445
6445
  const settings = videoTrack.getSettings();
6446
6446
  return [
6447
6447
  {
@@ -6450,7 +6450,7 @@ const findOptimalScreenSharingLayers = (videoTrack, preferences) => {
6450
6450
  width: settings.width || 0,
6451
6451
  height: settings.height || 0,
6452
6452
  scaleResolutionDownBy: 1,
6453
- maxBitrate: preferences?.maxBitrate ?? 3000000,
6453
+ maxBitrate: preferences?.maxBitrate ?? defaultMaxBitrate,
6454
6454
  maxFramerate: preferences?.maxFramerate ?? 30,
6455
6455
  },
6456
6456
  ];
@@ -7958,10 +7958,11 @@ class Publisher {
7958
7958
  if (!transceiver) {
7959
7959
  const { settings } = this.state;
7960
7960
  const targetResolution = settings?.video.target_resolution;
7961
+ const screenShareBitrate = settings?.screensharing.target_resolution?.bitrate;
7961
7962
  const videoEncodings = trackType === TrackType.VIDEO
7962
7963
  ? findOptimalVideoLayers(track, targetResolution)
7963
7964
  : trackType === TrackType.SCREEN_SHARE
7964
- ? findOptimalScreenSharingLayers(track, opts.screenShareSettings)
7965
+ ? findOptimalScreenSharingLayers(track, opts.screenShareSettings, screenShareBitrate)
7965
7966
  : undefined;
7966
7967
  let preferredCodec = opts.preferredCodec;
7967
7968
  if (!preferredCodec && trackType === TrackType.VIDEO) {
@@ -8905,7 +8906,7 @@ class StreamSfuClient {
8905
8906
  return retryable(() => this.rpc.updateSubscriptions({
8906
8907
  sessionId: this.sessionId,
8907
8908
  tracks: subscriptions,
8908
- }), this.logger);
8909
+ }), this.logger, 'debug');
8909
8910
  };
8910
8911
  this.setPublisher = async (data) => {
8911
8912
  return retryable(() => this.rpc.setPublisher({
@@ -8951,7 +8952,7 @@ class StreamSfuClient {
8951
8952
  return retryable(() => this.rpc.sendStats({
8952
8953
  ...stats,
8953
8954
  sessionId: this.sessionId,
8954
- }), this.logger);
8955
+ }), this.logger, 'debug');
8955
8956
  };
8956
8957
  this.startNoiseCancellation = async () => {
8957
8958
  return retryable(() => this.rpc.startNoiseCancellation({
@@ -9088,7 +9089,7 @@ const MAX_RETRIES = 5;
9088
9089
  * @param <I> the type of the request object.
9089
9090
  * @param <O> the type of the response object.
9090
9091
  */
9091
- const retryable = async (rpc, logger) => {
9092
+ const retryable = async (rpc, logger, level = 'error') => {
9092
9093
  let retryAttempt = 0;
9093
9094
  let rpcCallResult;
9094
9095
  do {
@@ -9097,10 +9098,9 @@ const retryable = async (rpc, logger) => {
9097
9098
  await sleep(retryInterval(retryAttempt));
9098
9099
  }
9099
9100
  rpcCallResult = await rpc();
9100
- logger('trace', `SFU RPC response received for ${rpcCallResult.method.name}`, rpcCallResult);
9101
9101
  // if the RPC call failed, log the error and retry
9102
9102
  if (rpcCallResult.response.error) {
9103
- logger('error', `SFU RPC Error (${rpcCallResult.method.name}):`, rpcCallResult.response.error);
9103
+ logger(level, `SFU RPC Error (${rpcCallResult.method.name}):`, rpcCallResult.response.error);
9104
9104
  }
9105
9105
  retryAttempt++;
9106
9106
  } while (rpcCallResult.response.error?.shouldRetry &&
@@ -11643,6 +11643,17 @@ class ScreenShareState extends InputMediaDeviceManagerState {
11643
11643
  class ScreenShareManager extends InputMediaDeviceManager {
11644
11644
  constructor(call) {
11645
11645
  super(call, new ScreenShareState(), TrackType.SCREEN_SHARE);
11646
+ this.subscriptions.push(createSubscription(call.state.settings$, (settings) => {
11647
+ const maybeTargetResolution = settings?.screensharing.target_resolution;
11648
+ if (maybeTargetResolution) {
11649
+ this.setDefaultConstraints({
11650
+ video: {
11651
+ width: maybeTargetResolution.width,
11652
+ height: maybeTargetResolution.height,
11653
+ },
11654
+ });
11655
+ }
11656
+ }));
11646
11657
  }
11647
11658
  /**
11648
11659
  * Will enable screen share audio options on supported platforms.
@@ -14901,7 +14912,7 @@ class StreamClient {
14901
14912
  });
14902
14913
  };
14903
14914
  this.getUserAgent = () => {
14904
- const version = "0.7.11" ;
14915
+ const version = "0.7.13" ;
14905
14916
  return (this.userAgent ||
14906
14917
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14907
14918
  };