@opentok/client 2.33.0-alpha.5 → 2.33.0-alpha.6

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.
@@ -450,6 +450,8 @@ declare namespace OT {
450
450
  videoHeight(): number | undefined;
451
451
  setVideoMediaProcessorConnector(connector: MediaProcessorConnector | null): Promise<void>;
452
452
  setAudioMediaProcessorConnector(connector: MediaProcessorConnector | null): Promise<void>;
453
+ setPreferredFrameRate(frameRate: number): Promise<void>;
454
+ setPreferredResolution(resolution: Dimensions): Promise<void>;
453
455
  }
454
456
 
455
457
  export function getUserMedia(
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.33.0 0f415e1d5
2
+ * @license OpenTok.js 2.33.0 fd056a26b
3
3
  *
4
4
  * Copyright (c) 2010-2025 TokBox, Inc.
5
5
  * Subject to the applicable Software Development Kit (SDK) License Agreement:
6
6
  * https://www.vonage.com/legal/communications-apis/terms-of-use/
7
7
  *
8
- * Date: Fri, 21 Nov 2025 12:46:54 GMT
8
+ * Date: Fri, 21 Nov 2025 13:28:25 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -8603,7 +8603,7 @@ function staticConfigFactory(_temp) {
8603
8603
  _ref$axios = _ref.axios,
8604
8604
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
8605
8605
  _ref$properties = _ref.properties,
8606
- properties = _ref$properties === void 0 ? {"version":"v2.33.0","buildHash":"0f415e1d5","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com","vonageApiURL":""} : _ref$properties;
8606
+ properties = _ref$properties === void 0 ? {"version":"v2.33.0","buildHash":"fd056a26b","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com","vonageApiURL":""} : _ref$properties;
8607
8607
  /** @type builtInConfig */
8608
8608
  const builtInConfig = (0, _cloneDeep.default)(properties);
8609
8609
  /**
@@ -18051,6 +18051,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
18051
18051
  const defaultWidgetView = (0, _widget_view.default)();
18052
18052
  const _allDeviceHelpers = (0, _deviceHelpers.default)(),
18053
18053
  getInputMediaDevices = _allDeviceHelpers.getInputMediaDevices;
18054
+ const publisherDefaultResolution = {
18055
+ width: 640,
18056
+ height: 480
18057
+ };
18054
18058
  function PublisherFactory(_ref) {
18055
18059
  if (_ref === void 0) {
18056
18060
  _ref = {};
@@ -18217,6 +18221,9 @@ function PublisherFactory(_ref) {
18217
18221
  let _migrationTimeoutId;
18218
18222
  let _previousPeerConnection;
18219
18223
  let _videoMaxBitrateSetting;
18224
+ let _preferredWidth;
18225
+ let _preferredHeight;
18226
+ let _preferredFrameRate;
18220
18227
  let _peerId;
18221
18228
  let _raptorUri;
18222
18229
  let publisherSenderStats;
@@ -18629,8 +18636,8 @@ function PublisherFactory(_ref) {
18629
18636
  // Values order are:
18630
18637
  // - Defined by the user.
18631
18638
  // - Default: VGA (640x480).
18632
- let width = ((_properties$videoDime = properties.videoDimensions) == null ? void 0 : _properties$videoDime.width) || 640;
18633
- let height = ((_properties$videoDime2 = properties.videoDimensions) == null ? void 0 : _properties$videoDime2.height) || 480;
18639
+ let width = ((_properties$videoDime = properties.videoDimensions) == null ? void 0 : _properties$videoDime.width) || publisherDefaultResolution.width;
18640
+ let height = ((_properties$videoDime2 = properties.videoDimensions) == null ? void 0 : _properties$videoDime2.height) || publisherDefaultResolution.height;
18634
18641
  if (properties.publishVideo) {
18635
18642
  var _widgetView2;
18636
18643
  // When video is on, we get the real video dimensions. If undefined, we will take the
@@ -24055,6 +24062,82 @@ function PublisherFactory(_ref) {
24055
24062
  return _ref62.apply(this, arguments);
24056
24063
  };
24057
24064
  }();
24065
+ const applyVideoConstraints = () => {
24066
+ const constraints = {
24067
+ width: {
24068
+ ideal: _preferredWidth
24069
+ },
24070
+ height: {
24071
+ ideal: _preferredHeight
24072
+ },
24073
+ frameRate: {
24074
+ ideal: _preferredFrameRate
24075
+ }
24076
+ };
24077
+ return webRTCStream.getVideoTracks().at(0).applyConstraints(constraints);
24078
+ };
24079
+
24080
+ /**
24081
+ * @brief Sets the preferred video resolution.
24082
+ *
24083
+ * This function sets the preferred resolution for the video publisher.
24084
+ * It validates that the input is an object with positive integer width and height properties,
24085
+ * and verifies the resolution is not greater than the initial publishing resolution.
24086
+ * If successful, applies the new constraints to the video track.
24087
+ *
24088
+ * @param {Object} preferredResolution - The desired resolution.
24089
+ * @param {number} preferredResolution.width - Preferred video width (pixels).
24090
+ * @param {number} preferredResolution.height - Preferred video height (pixels).
24091
+ *
24092
+ * @throws {Error} If not called on a video publisher, if the dimensions are invalid,
24093
+ * or if the resolution exceeds the initial resolution.
24094
+ *
24095
+ * @returns {Promise} Resolves when video constraints are successfully applied.
24096
+ */
24097
+ this.setPreferredResolution = preferredResolution => {
24098
+ var _webRTCStream, _webRTCStream$getVide6, _properties$videoDime3, _properties$videoDime4;
24099
+ if (!properties.publishVideo || !((_webRTCStream = webRTCStream) != null && (_webRTCStream$getVide6 = _webRTCStream.getVideoTracks()) != null && _webRTCStream$getVide6.length)) {
24100
+ throw new Error('setPreferredResolution needs to be called on a video publisher');
24101
+ }
24102
+ if (!preferredResolution || !Number.isInteger(preferredResolution.width) || preferredResolution.width <= 0 || !Number.isInteger(preferredResolution.height) || preferredResolution.height <= 0) {
24103
+ throw new Error('preferredResolution must be an object with positive integer width and height properties');
24104
+ }
24105
+ const startingWidth = ((_properties$videoDime3 = properties.videoDimensions) == null ? void 0 : _properties$videoDime3.width) || publisherDefaultResolution.width;
24106
+ const startingHeight = ((_properties$videoDime4 = properties.videoDimensions) == null ? void 0 : _properties$videoDime4.height) || publisherDefaultResolution.height;
24107
+ const startingArea = startingWidth * startingHeight;
24108
+ const preferredArea = preferredResolution.width * preferredResolution.height;
24109
+ if (preferredArea > startingArea) {
24110
+ throw new Error('preferredResolution cannot be higher than the initial ' + 'publishing resolution');
24111
+ }
24112
+ _preferredWidth = preferredResolution.width;
24113
+ _preferredHeight = preferredResolution.height;
24114
+ return applyVideoConstraints();
24115
+ };
24116
+
24117
+ /**
24118
+ * @brief Sets the preferred video frame rate.
24119
+ *
24120
+ * This function sets the desired frame rate for video publishing.
24121
+ * The frame rate must be an integer ≥ 1.
24122
+ * If successful, applies the new frame rate constraints to the video track.
24123
+ *
24124
+ * @param {number} frameRate - The preferred video frame rate.
24125
+ *
24126
+ * @throws {Error} If not called on a video publisher or if frameRate is invalid.
24127
+ *
24128
+ * @returns {Promise} Resolves when video constraints are successfully applied.
24129
+ */
24130
+ this.setPreferredFrameRate = frameRate => {
24131
+ var _webRTCStream2, _webRTCStream2$getVid;
24132
+ if (!properties.publishVideo || !((_webRTCStream2 = webRTCStream) != null && (_webRTCStream2$getVid = _webRTCStream2.getVideoTracks()) != null && _webRTCStream2$getVid.length)) {
24133
+ throw new Error('setPreferredFrameRate needs to be called on a video publisher');
24134
+ }
24135
+ if (!Number.isInteger(frameRate) || frameRate < 1) {
24136
+ throw new Error('Invalid frameRate: must be an integer ≥ 1');
24137
+ }
24138
+ _preferredFrameRate = frameRate;
24139
+ return applyVideoConstraints();
24140
+ };
24058
24141
 
24059
24142
  /**
24060
24143
  * Sets a custom maximum video bitrate for the publisher.