@opentok/client 2.30.3-alpha.1 → 2.30.3-alpha.11

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.30.3 769bcbc1f
2
+ * @license OpenTok.js 2.30.3 86f91ca
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, 20 Jun 2025 15:59:08 GMT
8
+ * Date: Wed, 02 Jul 2025 18:28:38 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -8679,7 +8679,7 @@ const logging = (0, _log.default)('StaticConfig');
8679
8679
  */
8680
8680
 
8681
8681
  /** @type builtInConfig */
8682
- const builtInConfig = (0, _cloneDeep.default)({"version":"v2.30.3","buildHash":"769bcbc1f","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"});
8682
+ const builtInConfig = (0, _cloneDeep.default)({"version":"v2.30.3","buildHash":"86f91ca","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"});
8683
8683
  const whitelistAllowedRuntimeProperties = (0, _pick.default)(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
8684
8684
  const liveConfigMap = {
8685
8685
  apiUrl: 'apiURL',
@@ -18676,6 +18676,9 @@ function PublisherFactory(_ref) {
18676
18676
  return ((_audioFallbackCoordin2 = audioFallbackCoordinator) == null ? void 0 : _audioFallbackCoordin2.getState()) === _audioFallbackVideoStates.default.SUSPENDED_VIDEO;
18677
18677
  };
18678
18678
  const onPeerConnected = peerConnection => {
18679
+ // First apply the default P2P maxBitrate. This can be override by custom maxBitrate
18680
+ // Please note, _setP2PDefaultMaxBitrate will be noop, if peerConnections is Mantis
18681
+ peerConnection._setP2PDefaultMaxBitrate();
18679
18682
  // Don't apply max bitrate if PAF is active. setMaxBitrate can alter the active state.
18680
18683
  // max bitrate will be applied once PAF is inactive.
18681
18684
  if (!isAudioFallbackActive()) {
@@ -19690,34 +19693,41 @@ function PublisherFactory(_ref) {
19690
19693
  let isTrackManuallyStopped = false;
19691
19694
  const updateVideo = () => {
19692
19695
  const shouldSendVideo = haveWorkingTracks('video') && properties.publishVideo;
19693
- if (_env.default.name === 'Chrome' && _env.default.version >= 69) {
19694
- (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
19695
- var executionSentinel, peerConnections;
19696
- return _regenerator.default.wrap(function _callee17$(_context17) {
19697
- while (1) switch (_context17.prev = _context17.next) {
19698
- case 0:
19696
+ (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
19697
+ var peerConnections, shouldApplyCustomMaxBitrate, executionSentinel;
19698
+ return _regenerator.default.wrap(function _callee17$(_context17) {
19699
+ while (1) switch (_context17.prev = _context17.next) {
19700
+ case 0:
19701
+ _context17.next = 2;
19702
+ return getAllPeerConnections();
19703
+ case 2:
19704
+ peerConnections = _context17.sent;
19705
+ // Set maxBitrare only if video is enabled and customMaxBitrate/videoPreset is enforced.
19706
+ // Please note this may disable some encodings in Simulcast VP8.
19707
+ shouldApplyCustomMaxBitrate = shouldSendVideo && _videoMaxBitrateSetting;
19708
+ if (shouldApplyCustomMaxBitrate) {
19709
+ peerConnections.forEach(peerConnection => {
19710
+ setMaxVideoBitrateToPublisher(peerConnection);
19711
+ });
19712
+ } else if (_env.default.name === 'Chrome' && _env.default.version >= 69) {
19699
19713
  if (updateVideoSenderParametersSentinel) {
19700
19714
  updateVideoSenderParametersSentinel.cancel();
19701
19715
  }
19702
19716
  updateVideoSenderParametersSentinel = new _cancel.default();
19703
19717
  executionSentinel = updateVideoSenderParametersSentinel;
19704
- _context17.next = 5;
19705
- return getAllPeerConnections();
19706
- case 5:
19707
- peerConnections = _context17.sent;
19708
19718
  if (!executionSentinel.isCanceled()) {
19709
19719
  // only proceed if we weren't canceled during the async operation above
19710
19720
  peerConnections.forEach(peerConnection => {
19711
19721
  peerConnection.setVideoActiveState(shouldSendVideo);
19712
19722
  });
19713
19723
  }
19714
- case 7:
19715
- case "end":
19716
- return _context17.stop();
19717
- }
19718
- }, _callee17);
19719
- }))();
19720
- }
19724
+ }
19725
+ case 5:
19726
+ case "end":
19727
+ return _context17.stop();
19728
+ }
19729
+ }, _callee17);
19730
+ }))();
19721
19731
  if (isCustomVideoTrack && mediaProcessor) {
19722
19732
  const originalTrack = mediaProcessor.getOriginalVideoTrack();
19723
19733
  if (originalTrack) {
@@ -20009,15 +20019,15 @@ function PublisherFactory(_ref) {
20009
20019
  case 0:
20010
20020
  (_chromeMixin3 = chromeMixin) == null ? void 0 : _chromeMixin3.videoDisabledIndicator.disableVideo(false);
20011
20021
  (_chromeMixin4 = chromeMixin) == null ? void 0 : _chromeMixin4.videoDisabledIndicator.setWarning(false);
20022
+ setMaxVideoBitrateToPublisher();
20012
20023
  if (previousState === _audioFallbackVideoStates.default.SUSPENDED_VIDEO) {
20013
20024
  _this.trigger('videoEnabled', {
20014
20025
  reason: 'quality'
20015
20026
  });
20016
- setMaxVideoBitrateToPublisher();
20017
20027
  } else {
20018
20028
  _this.trigger('videoDisableWarningLifted');
20019
20029
  }
20020
- case 3:
20030
+ case 4:
20021
20031
  case "end":
20022
20032
  return _context21.stop();
20023
20033
  }
@@ -20598,13 +20608,8 @@ function PublisherFactory(_ref) {
20598
20608
  _context26.next = 2;
20599
20609
  return pc.findAndReplaceTrack(oldTrack, newTrack);
20600
20610
  case 2:
20601
- if (isAudioFallbackActive()) {
20602
- _context26.next = 5;
20603
- break;
20604
- }
20605
- _context26.next = 5;
20606
- return setMaxVideoBitrateToPublisher(pc);
20607
- case 5:
20611
+ pc._setP2PDefaultMaxBitrate();
20612
+ case 3:
20608
20613
  case "end":
20609
20614
  return _context26.stop();
20610
20615
  }
@@ -36157,32 +36162,38 @@ function PublisherPeerConnectionFactory(deps) {
36157
36162
  return _regenerator.default.wrap(function _callee2$(_context2) {
36158
36163
  while (1) switch (_context2.prev = _context2.next) {
36159
36164
  case 0:
36165
+ if (!(_this.getSourceStreamId() !== 'P2P')) {
36166
+ _context2.next = 2;
36167
+ break;
36168
+ }
36169
+ return _context2.abrupt("return");
36170
+ case 2:
36160
36171
  _this$_getVideoSender = _this._getVideoSender(), sender = _this$_getVideoSender.sender, sendParams = _this$_getVideoSender.sendParams, _this$_getVideoSender2 = _this$_getVideoSender.settings, width = _this$_getVideoSender2.width, height = _this$_getVideoSender2.height;
36161
36172
  if (!(!sender || !sendParams)) {
36162
- _context2.next = 3;
36173
+ _context2.next = 5;
36163
36174
  break;
36164
36175
  }
36165
36176
  return _context2.abrupt("return");
36166
- case 3:
36177
+ case 5:
36167
36178
  maxBitrate = (0, _getMaxBitrateForResolution.default)(width, height);
36168
36179
  sendParams.encodings.forEach(encoding => {
36169
36180
  // eslint-disable-line no-param-reassign
36170
36181
  encoding.maxBitrate = maxBitrate;
36171
36182
  });
36172
- _context2.prev = 5;
36173
- _context2.next = 8;
36183
+ _context2.prev = 7;
36184
+ _context2.next = 10;
36174
36185
  return sender.setParameters(sendParams);
36175
- case 8:
36176
- _context2.next = 12;
36177
- break;
36178
36186
  case 10:
36179
- _context2.prev = 10;
36180
- _context2.t0 = _context2["catch"](5);
36187
+ _context2.next = 14;
36188
+ break;
36181
36189
  case 12:
36190
+ _context2.prev = 12;
36191
+ _context2.t0 = _context2["catch"](7);
36192
+ case 14:
36182
36193
  case "end":
36183
36194
  return _context2.stop();
36184
36195
  }
36185
- }, _callee2, null, [[5, 10]]);
36196
+ }, _callee2, null, [[7, 12]]);
36186
36197
  }));
36187
36198
  this._setCustomMaxBitrate = /*#__PURE__*/function () {
36188
36199
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(bitrate) {
@@ -43681,11 +43692,13 @@ function SessionFactory(deps) {
43681
43692
  cpuPressureMonitor.initMonitoring(PressureObserver);
43682
43693
  cpuPressureMonitor.startMonitoring();
43683
43694
  cpuPressureMonitor.on('pressureMonitorEvent', newState => {
43684
- _cpuPerformanceState = newState;
43685
- this.dispatchEvent(new Events.CpuPerformanceChangedEvent(newState));
43686
- this.logEvent('cpuPerformanceChanged', 'Event', {
43687
- cpuPerformanceState: newState
43688
- });
43695
+ if (_cpuPerformanceState !== newState) {
43696
+ _cpuPerformanceState = newState;
43697
+ this.dispatchEvent(new Events.CpuPerformanceChangedEvent(newState));
43698
+ this.logEvent('cpuPerformanceChanged', 'Event', {
43699
+ cpuPerformanceState: newState
43700
+ });
43701
+ }
43689
43702
  });
43690
43703
  }
43691
43704
 
@@ -43925,9 +43938,10 @@ function SessionFactory(deps) {
43925
43938
  if (proxyUrl) {
43926
43939
  sessionInfoSuccessLogPayload.proxyUrl = proxyUrl;
43927
43940
  }
43928
- this.logEvent('SessionInfo', 'Success', null, sessionInfoSuccessLogPayload, {
43929
- messagingServer: sessionInfo.messagingServer
43930
- });
43941
+ if (_attemptStartTime) {
43942
+ sessionInfoSuccessLogPayload.attemptDuration = new Date().getTime() - _attemptStartTime;
43943
+ }
43944
+ this.logEvent('SessionInfo', 'Success', null, sessionInfoSuccessLogPayload);
43931
43945
  const overrides = this.staticConfig.sessionInfoOverrides || {};
43932
43946
  if (_prioritizeVP9) {
43933
43947
  overrides.priorityVideoCodec = 'vp9';
@@ -44517,6 +44531,7 @@ function SessionFactory(deps) {
44517
44531
  }
44518
44532
  };
44519
44533
  const targetUrl = (0, _proxyUrlHelper.default)(staticConfig.apiUrl, proxyUrl);
44534
+ _attemptStartTime = new Date().getTime();
44520
44535
  return getSessionInfo({
44521
44536
  anvilUrl: targetUrl,
44522
44537
  sessionId,
@@ -45840,7 +45855,7 @@ function SessionFactory(deps) {
45840
45855
  }, this.MIGRATION_TIMEOUT);
45841
45856
  };
45842
45857
  const targetUrl = (0, _proxyUrlHelper.default)(this.staticConfig.apiUrl, proxyUrl);
45843
-
45858
+ _attemptStartTime = new Date().getTime();
45844
45859
  // GSI
45845
45860
  getSessionInfo({
45846
45861
  anvilUrl: targetUrl,