@stream-io/video-client 0.4.4 → 0.4.5

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
@@ -9160,19 +9160,6 @@ const doJoin = async (httpClient, type, id, data) => {
9160
9160
  ...data,
9161
9161
  location,
9162
9162
  };
9163
- // FIXME OL: remove this once cascading is enabled by default
9164
- const cascadingModeParams = getCascadingModeParams();
9165
- if (cascadingModeParams) {
9166
- // FIXME OL: remove after SFU migration is done
9167
- if (data?.migrating_from && cascadingModeParams['next_sfu_id']) {
9168
- cascadingModeParams['sfu_id'] = cascadingModeParams['next_sfu_id'];
9169
- }
9170
- return httpClient.doAxiosRequest('post', `/call/${type}/${id}/join`, request, {
9171
- params: {
9172
- ...cascadingModeParams,
9173
- },
9174
- });
9175
- }
9176
9163
  return httpClient.post(`/call/${type}/${id}/join`, request);
9177
9164
  };
9178
9165
  const toRtcConfiguration = (config) => {
@@ -9187,20 +9174,6 @@ const toRtcConfiguration = (config) => {
9187
9174
  };
9188
9175
  return rtcConfig;
9189
9176
  };
9190
- const getCascadingModeParams = () => {
9191
- if (typeof window === 'undefined')
9192
- return null;
9193
- const params = new URLSearchParams(window.location?.search);
9194
- const cascadingEnabled = params.get('cascading') !== null;
9195
- if (cascadingEnabled) {
9196
- const rawParams = {};
9197
- params.forEach((value, key) => {
9198
- rawParams[key] = value;
9199
- });
9200
- return rawParams;
9201
- }
9202
- return null;
9203
- };
9204
9177
  /**
9205
9178
  * Reconciles the local state of the source participant into the target participant.
9206
9179
  *
@@ -10633,8 +10606,9 @@ class CameraManager extends InputMediaDeviceManager {
10633
10606
  };
10634
10607
  }
10635
10608
  /**
10636
- * Select the camera direaction
10637
- * @param direction
10609
+ * Select the camera direction.
10610
+ *
10611
+ * @param direction the direction of the camera to select.
10638
10612
  */
10639
10613
  async selectDirection(direction) {
10640
10614
  this.state.setDirection(direction);
@@ -10664,6 +10638,7 @@ class CameraManager extends InputMediaDeviceManager {
10664
10638
  }
10665
10639
  catch (error) {
10666
10640
  // couldn't enable device, target resolution will be applied the next time user attempts to start the device
10641
+ this.logger('warn', 'could not apply target resolution', error);
10667
10642
  }
10668
10643
  }
10669
10644
  if (this.state.status === 'enabled') {
@@ -10671,11 +10646,21 @@ class CameraManager extends InputMediaDeviceManager {
10671
10646
  .mediaStream.getVideoTracks()[0]
10672
10647
  ?.getSettings();
10673
10648
  if (width !== this.targetResolution.width ||
10674
- height !== this.targetResolution.height)
10649
+ height !== this.targetResolution.height) {
10675
10650
  await this.applySettingsToStream();
10676
- this.logger('debug', `${width}x${height} target resolution applied to media stream`);
10651
+ this.logger('debug', `${width}x${height} target resolution applied to media stream`);
10652
+ }
10677
10653
  }
10678
10654
  }
10655
+ /**
10656
+ * Sets the preferred codec for encoding the video.
10657
+ *
10658
+ * @internal internal use only, not part of the public API.
10659
+ * @param codec the codec to use for encoding the video.
10660
+ */
10661
+ setPreferredCodec(codec) {
10662
+ this.preferredCodec = codec;
10663
+ }
10679
10664
  getDevices() {
10680
10665
  return getVideoDevices();
10681
10666
  }
@@ -10691,7 +10676,9 @@ class CameraManager extends InputMediaDeviceManager {
10691
10676
  return getVideoStream(constraints);
10692
10677
  }
10693
10678
  publishStream(stream) {
10694
- return this.call.publishVideoStream(stream);
10679
+ return this.call.publishVideoStream(stream, {
10680
+ preferredCodec: this.preferredCodec,
10681
+ });
10695
10682
  }
10696
10683
  stopPublishStream(stopTracks) {
10697
10684
  return this.call.stopPublish(TrackType.VIDEO, stopTracks);
@@ -11274,13 +11261,6 @@ class Call {
11274
11261
  this.state.setCallingState(callingState);
11275
11262
  throw error;
11276
11263
  }
11277
- // FIXME OL: remove once cascading is implemented
11278
- if (typeof window !== 'undefined' && window.location?.search) {
11279
- const params = new URLSearchParams(window.location.search);
11280
- sfuServer.url = params.get('sfuUrl') || sfuServer.url;
11281
- sfuServer.ws_endpoint = params.get('sfuWsUrl') || sfuServer.ws_endpoint;
11282
- sfuServer.edge_name = params.get('sfuUrl') || sfuServer.edge_name;
11283
- }
11284
11264
  const previousSfuClient = this.sfuClient;
11285
11265
  const sfuClient = (this.sfuClient = new StreamSfuClient({
11286
11266
  dispatcher: this.dispatcher,
@@ -11347,8 +11327,11 @@ class Call {
11347
11327
  // restore previous publishing state
11348
11328
  if (audioStream)
11349
11329
  await this.publishAudioStream(audioStream);
11350
- if (videoStream)
11351
- await this.publishVideoStream(videoStream);
11330
+ if (videoStream) {
11331
+ await this.publishVideoStream(videoStream, {
11332
+ preferredCodec: this.camera.preferredCodec,
11333
+ });
11334
+ }
11352
11335
  if (screenShare)
11353
11336
  await this.publishScreenShareStream(screenShare);
11354
11337
  }
@@ -12374,9 +12357,11 @@ class Call {
12374
12357
  if (this.camera.state.status === 'enabled' &&
12375
12358
  this.camera.state.mediaStream &&
12376
12359
  !this.publisher?.isPublishing(TrackType.VIDEO)) {
12377
- await this.publishVideoStream(this.camera.state.mediaStream);
12360
+ await this.publishVideoStream(this.camera.state.mediaStream, {
12361
+ preferredCodec: this.camera.preferredCodec,
12362
+ });
12378
12363
  }
12379
- // Start camera if backend config speicifies, and there is no local setting
12364
+ // Start camera if backend config specifies, and there is no local setting
12380
12365
  if (this.camera.state.status === undefined &&
12381
12366
  this.state.settings?.video.camera_default_on) {
12382
12367
  await this.camera.enable();
@@ -13992,7 +13977,7 @@ class StreamClient {
13992
13977
  });
13993
13978
  };
13994
13979
  this.getUserAgent = () => {
13995
- const version = "0.4.4" ;
13980
+ const version = "0.4.5" ;
13996
13981
  return (this.userAgent ||
13997
13982
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
13998
13983
  };