@opentok/client 2.35.0-alpha.55 → 2.35.0-alpha.56

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.35.0 5b7d62ce7
2
+ * @license OpenTok.js 2.35.0 3dc50499e
3
3
  *
4
4
  * Copyright (c) 2010-2026 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: Tue, 16 Jun 2026 08:15:22 GMT
8
+ * Date: Wed, 17 Jun 2026 13:06:50 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -39202,7 +39202,7 @@ function staticConfigFactory(_temp) {
39202
39202
  _ref$axios = _ref.axios,
39203
39203
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
39204
39204
  _ref$properties = _ref.properties,
39205
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"5b7d62ce7","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;
39205
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"3dc50499e","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;
39206
39206
  /** @type builtInConfig */
39207
39207
  const builtInConfig = (0, _cloneDeep.default)(properties);
39208
39208
  /**
@@ -41014,6 +41014,7 @@ function PublisherFactory(_ref) {
41014
41014
  let _preferredWidth;
41015
41015
  let _preferredHeight;
41016
41016
  let _preferredFrameRate;
41017
+ let _suppressVideoDimensionsSignaling = false;
41017
41018
  let _targetScalabilityMode;
41018
41019
  let _peerId;
41019
41020
  let _raptorUri;
@@ -43018,7 +43019,7 @@ function PublisherFactory(_ref) {
43018
43019
  if (!properties.publishVideo) {
43019
43020
  return;
43020
43021
  }
43021
- if (_this.stream) {
43022
+ if (_this.stream && !_suppressVideoDimensionsSignaling) {
43022
43023
  _this.stream.setVideoDimensions(newValue.width, newValue.height);
43023
43024
  }
43024
43025
  _this.dispatchEvent(new Events.VideoDimensionsChangedEvent(_this, oldValue, newValue));
@@ -45464,6 +45465,20 @@ function PublisherFactory(_ref) {
45464
45465
  this._setScalableVideoLayers(properties.scalableVideoLayers);
45465
45466
  configureScalabilityMode().catch(() => {});
45466
45467
 
45468
+ // Propagate any preferred resolution/frameRate set before publish via signaling
45469
+ if (this.stream && (_preferredWidth || _preferredHeight || _preferredFrameRate)) {
45470
+ const _getPreferredVideoTra = getPreferredVideoTrackSettings(),
45471
+ width = _getPreferredVideoTra.width,
45472
+ height = _getPreferredVideoTra.height,
45473
+ actualFrameRate = _getPreferredVideoTra.frameRate;
45474
+ if (width && height && (_preferredWidth || _preferredHeight)) {
45475
+ this.stream.setVideoDimensions(width, height);
45476
+ }
45477
+ if (actualFrameRate && _preferredFrameRate) {
45478
+ this.stream.setVideoFrameRate(actualFrameRate);
45479
+ }
45480
+ }
45481
+
45467
45482
  // See OPENTOK-45935
45468
45483
  // Some users reuse the publisher when disconnecting and reconnecting
45469
45484
  // to a session. This re-synchronizes the state of the stream channels.
@@ -47412,9 +47427,17 @@ function PublisherFactory(_ref) {
47412
47427
  };
47413
47428
  return (0, _videoConstraints.default)(track, constraints);
47414
47429
  };
47430
+
47431
+ // Returns the settings of the most authoritative video track, using the same
47432
+ // priority order as applyVideoConstraints (original track before processed track).
47433
+ const getPreferredVideoTrackSettings = () => {
47434
+ var _videoMediaProcessorC, _webRTCStream, _webRTCStream$getVide6, _track$getSettings;
47435
+ const track = typeof (mediaProcessor == null ? void 0 : mediaProcessor.getOriginalVideoTrack) === 'function' && mediaProcessor.getOriginalVideoTrack() || ((_videoMediaProcessorC = _videoMediaProcessorConnector) == null ? void 0 : _videoMediaProcessorC.originalTrack) || ((_webRTCStream = webRTCStream) == null ? void 0 : (_webRTCStream$getVide6 = _webRTCStream.getVideoTracks()) == null ? void 0 : _webRTCStream$getVide6[0]);
47436
+ return (_track$getSettings = track == null ? void 0 : track.getSettings()) != null ? _track$getSettings : {};
47437
+ };
47415
47438
  const applyVideoConstraints = () => {
47416
- var _videoMediaProcessorC;
47417
- const videoTracks = [mediaProcessor == null ? void 0 : mediaProcessor.getOriginalVideoTrack(), (_videoMediaProcessorC = _videoMediaProcessorConnector) == null ? void 0 : _videoMediaProcessorC.originalTrack, ...webRTCStream.getVideoTracks()].filter(track => {
47439
+ var _videoMediaProcessorC2;
47440
+ const videoTracks = [typeof (mediaProcessor == null ? void 0 : mediaProcessor.getOriginalVideoTrack) === 'function' && mediaProcessor.getOriginalVideoTrack(), (_videoMediaProcessorC2 = _videoMediaProcessorConnector) == null ? void 0 : _videoMediaProcessorC2.originalTrack, ...webRTCStream.getVideoTracks()].filter(track => {
47418
47441
  var _window$MediaStreamTr;
47419
47442
  return track && (
47420
47443
  // On Chrome both original and filtered track (instance of MediaStreamTrackGenerator) need to
@@ -47449,15 +47472,15 @@ function PublisherFactory(_ref) {
47449
47472
  */
47450
47473
  this.setPreferredResolution = /*#__PURE__*/function () {
47451
47474
  var _ref71 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64(preferredResolution) {
47452
- var _webRTCStream, _webRTCStream$getVide6, _properties$videoDime3, _properties$videoDime4;
47453
- var message, startingWidth, startingHeight, startingArea, preferredArea, result;
47475
+ var _webRTCStream2, _webRTCStream2$getVid, _properties$videoDime3, _properties$videoDime4;
47476
+ var message, startingWidth, startingHeight, startingArea, preferredArea, result, _getPreferredVideoTra2, width, height;
47454
47477
  return _regenerator.default.wrap(function _callee64$(_context64) {
47455
47478
  while (1) switch (_context64.prev = _context64.next) {
47456
47479
  case 0:
47457
47480
  logAnalyticsEvent('setPreferredResolution', 'Attempt', {
47458
47481
  preferredResolution
47459
47482
  });
47460
- if (!(!properties.publishVideo || !((_webRTCStream = webRTCStream) != null && (_webRTCStream$getVide6 = _webRTCStream.getVideoTracks()) != null && _webRTCStream$getVide6.length))) {
47483
+ if (!(!properties.publishVideo || !((_webRTCStream2 = webRTCStream) != null && (_webRTCStream2$getVid = _webRTCStream2.getVideoTracks()) != null && _webRTCStream2$getVid.length))) {
47461
47484
  _context64.next = 5;
47462
47485
  break;
47463
47486
  }
@@ -47496,28 +47519,46 @@ function PublisherFactory(_ref) {
47496
47519
  case 17:
47497
47520
  _preferredWidth = preferredResolution.width;
47498
47521
  _preferredHeight = preferredResolution.height;
47499
- _context64.prev = 19;
47500
- _context64.next = 22;
47522
+ // Suppress videoDimensionsChanged before applying constraints: the video element
47523
+ // resize triggered by applyVideoConstraints() would otherwise cause a duplicate
47524
+ // streamChannelUpdate. We do the signaling ourselves below with the actual track settings.
47525
+ _suppressVideoDimensionsSignaling = true;
47526
+ _context64.prev = 20;
47527
+ _context64.prev = 21;
47528
+ _context64.next = 24;
47501
47529
  return applyVideoConstraints();
47502
- case 22:
47530
+ case 24:
47503
47531
  result = _context64.sent;
47532
+ if (_this.stream) {
47533
+ _getPreferredVideoTra2 = getPreferredVideoTrackSettings(), width = _getPreferredVideoTra2.width, height = _getPreferredVideoTra2.height;
47534
+ if (width && height) {
47535
+ _this.stream.setVideoDimensions(width, height);
47536
+ }
47537
+ }
47504
47538
  logAnalyticsEvent('setPreferredResolution', 'Success', {
47505
47539
  preferredResolution
47506
47540
  });
47507
47541
  return _context64.abrupt("return", result);
47508
- case 27:
47509
- _context64.prev = 27;
47510
- _context64.t0 = _context64["catch"](19);
47542
+ case 28:
47543
+ _context64.prev = 28;
47544
+ _suppressVideoDimensionsSignaling = false;
47545
+ return _context64.finish(28);
47546
+ case 31:
47547
+ _context64.next = 37;
47548
+ break;
47549
+ case 33:
47550
+ _context64.prev = 33;
47551
+ _context64.t0 = _context64["catch"](20);
47511
47552
  logAnalyticsEvent('setPreferredResolution', 'Failure', {
47512
47553
  preferredResolution,
47513
47554
  message: _context64.t0.message
47514
47555
  });
47515
47556
  throw _context64.t0;
47516
- case 31:
47557
+ case 37:
47517
47558
  case "end":
47518
47559
  return _context64.stop();
47519
47560
  }
47520
- }, _callee64, null, [[19, 27]]);
47561
+ }, _callee64, null, [[20, 33], [21,, 28, 31]]);
47521
47562
  }));
47522
47563
  return function (_x52) {
47523
47564
  return _ref71.apply(this, arguments);
@@ -47542,15 +47583,15 @@ function PublisherFactory(_ref) {
47542
47583
  */
47543
47584
  this.setPreferredFrameRate = /*#__PURE__*/function () {
47544
47585
  var _ref72 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65(frameRate) {
47545
- var _webRTCStream2, _webRTCStream2$getVid;
47546
- var message, result;
47586
+ var _webRTCStream3, _webRTCStream3$getVid;
47587
+ var message, result, _getPreferredVideoTra3, actualFrameRate;
47547
47588
  return _regenerator.default.wrap(function _callee65$(_context65) {
47548
47589
  while (1) switch (_context65.prev = _context65.next) {
47549
47590
  case 0:
47550
47591
  logAnalyticsEvent('setPreferredFrameRate', 'Attempt', {
47551
47592
  frameRate
47552
47593
  });
47553
- if (!(!properties.publishVideo || !((_webRTCStream2 = webRTCStream) != null && (_webRTCStream2$getVid = _webRTCStream2.getVideoTracks()) != null && _webRTCStream2$getVid.length))) {
47594
+ if (!(!properties.publishVideo || !((_webRTCStream3 = webRTCStream) != null && (_webRTCStream3$getVid = _webRTCStream3.getVideoTracks()) != null && _webRTCStream3$getVid.length))) {
47554
47595
  _context65.next = 5;
47555
47596
  break;
47556
47597
  }
@@ -47578,23 +47619,29 @@ function PublisherFactory(_ref) {
47578
47619
  return applyVideoConstraints();
47579
47620
  case 13:
47580
47621
  result = _context65.sent;
47622
+ if (_this.stream) {
47623
+ _getPreferredVideoTra3 = getPreferredVideoTrackSettings(), actualFrameRate = _getPreferredVideoTra3.frameRate;
47624
+ if (actualFrameRate) {
47625
+ _this.stream.setVideoFrameRate(actualFrameRate);
47626
+ }
47627
+ }
47581
47628
  logAnalyticsEvent('setPreferredFrameRate', 'Success', {
47582
47629
  frameRate
47583
47630
  });
47584
47631
  return _context65.abrupt("return", result);
47585
- case 18:
47586
- _context65.prev = 18;
47632
+ case 19:
47633
+ _context65.prev = 19;
47587
47634
  _context65.t0 = _context65["catch"](10);
47588
47635
  logAnalyticsEvent('setPreferredFrameRate', 'Failure', {
47589
47636
  frameRate,
47590
47637
  message: _context65.t0.message
47591
47638
  });
47592
47639
  throw _context65.t0;
47593
- case 22:
47640
+ case 23:
47594
47641
  case "end":
47595
47642
  return _context65.stop();
47596
47643
  }
47597
- }, _callee65, null, [[10, 18]]);
47644
+ }, _callee65, null, [[10, 19]]);
47598
47645
  }));
47599
47646
  return function (_x53) {
47600
47647
  return _ref72.apply(this, arguments);
@@ -106050,6 +106097,9 @@ function Stream(id, name, creationTime, connection, session, channel, initials,
106050
106097
  case 'videoDimensions':
106051
106098
  self.videoDimensions = newValue;
106052
106099
  break;
106100
+ case 'frameRate':
106101
+ self.frameRate = newValue;
106102
+ break;
106053
106103
  case 'orientation':
106054
106104
  case 'width':
106055
106105
  case 'height':
@@ -106154,6 +106204,11 @@ function Stream(id, name, creationTime, connection, session, channel, initials,
106154
106204
  orientation: 0
106155
106205
  });
106156
106206
  };
106207
+ this.setVideoFrameRate = function setVideoFrameRate(frameRate) {
106208
+ updateChannelsOfType('video', {
106209
+ frameRate
106210
+ });
106211
+ };
106157
106212
  this.setRestrictFrameRate = function setRestrictFrameRate(restrict, completion) {
106158
106213
  if (completion === void 0) {
106159
106214
  completion = () => {};