@opentok/client 2.30.3-alpha.12 → 2.30.3-alpha.3

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 fa52308
2
+ * @license OpenTok.js 2.30.3 662ef4d28
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: Thu, 03 Jul 2025 22:37:07 GMT
8
+ * Date: Thu, 26 Jun 2025 14:49:47 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":"fa52308","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":"662ef4d28","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',
@@ -16859,7 +16859,7 @@ function WidgetViewFactory(_temp) {
16859
16859
  _context.prev = 15;
16860
16860
  _context.t0 = _context["catch"](5);
16861
16861
  // We are not interested in the error.
16862
- if (env.isChromium && stream.getVideoTracks().length) {
16862
+ if (env.isChromium) {
16863
16863
  // For Chromium browsers, we need to enable the video track before playing it to ensure we
16864
16864
  // do not see a black screen during an AMR transition. See VIDCS-3570 for more details.
16865
16865
  // eslint-disable-next-line no-param-reassign
@@ -17106,27 +17106,36 @@ function WidgetViewFactory(_temp) {
17106
17106
  });
17107
17107
  hasExistingElement = !!this._videoElementFacade;
17108
17108
  cancellation = this._getNewBindCancellation();
17109
- if (!hasExistingElement) {
17110
- this._createVideoElementFacade({
17111
- _inject,
17112
- audioVolume,
17113
- fallbackText,
17114
- muted
17115
- });
17116
- this._videoFacadeEvents.on('mediaElementEvent', action => {
17117
- this.trigger('mediaElementEvent', action);
17118
- });
17109
+ if (hasExistingElement) {
17110
+ _context5.next = 10;
17111
+ break;
17112
+ }
17113
+ this._createVideoElementFacade({
17114
+ _inject,
17115
+ audioVolume,
17116
+ fallbackText,
17117
+ muted
17118
+ });
17119
+ this._videoFacadeEvents.on('mediaElementEvent', action => {
17120
+ this.trigger('mediaElementEvent', action);
17121
+ });
17122
+ _context5.next = 14;
17123
+ break;
17124
+ case 10:
17125
+ if (!(webRTCStream instanceof MediaStream)) {
17126
+ _context5.next = 14;
17127
+ break;
17119
17128
  }
17120
- if (!(webRTCStream instanceof MediaStream && hasVideo && isSubscribingToVideo)) {
17121
- _context5.next = 9;
17129
+ if (!hasVideo) {
17130
+ _context5.next = 14;
17122
17131
  break;
17123
17132
  }
17124
- _context5.next = 9;
17133
+ _context5.next = 14;
17125
17134
  return this._tryToLoadVideoBuffer(webRTCStream, cancellation, throwIfBufferFails, hasVideo && isSubscribingToVideo);
17126
- case 9:
17127
- _context5.next = 11;
17135
+ case 14:
17136
+ _context5.next = 16;
17128
17137
  return this._bindToStream(webRTCStream, cancellation);
17129
- case 11:
17138
+ case 16:
17130
17139
  if (!hasExistingElement) {
17131
17140
  this._triggerVideoElementCreated();
17132
17141
  }
@@ -17135,16 +17144,16 @@ function WidgetViewFactory(_temp) {
17135
17144
  defaultVideoElementFacade: this._videoElementFacade,
17136
17145
  maxWaitTime: 5000
17137
17146
  });
17138
- _context5.next = 16;
17147
+ _context5.next = 21;
17139
17148
  return this._waitForVideoResolution(webRTCStream);
17140
- case 16:
17149
+ case 21:
17141
17150
  logging.debug('Waiting for video to be playing');
17142
- _context5.next = 19;
17151
+ _context5.next = 24;
17143
17152
  return whenVideoPlaying;
17144
- case 19:
17153
+ case 24:
17145
17154
  logging.debug('Video is playing');
17146
17155
  throwIfBindCancelled(cancellation);
17147
- case 21:
17156
+ case 26:
17148
17157
  case "end":
17149
17158
  return _context5.stop();
17150
17159
  }
@@ -18667,9 +18676,6 @@ function PublisherFactory(_ref) {
18667
18676
  return ((_audioFallbackCoordin2 = audioFallbackCoordinator) == null ? void 0 : _audioFallbackCoordin2.getState()) === _audioFallbackVideoStates.default.SUSPENDED_VIDEO;
18668
18677
  };
18669
18678
  const onPeerConnected = peerConnection => {
18670
- // First apply the default P2P maxBitrate. This can be override by custom maxBitrate
18671
- // Please note, _setP2PDefaultMaxBitrate will be noop, if peerConnections is Mantis
18672
- peerConnection._setP2PDefaultMaxBitrate();
18673
18679
  // Don't apply max bitrate if PAF is active. setMaxBitrate can alter the active state.
18674
18680
  // max bitrate will be applied once PAF is inactive.
18675
18681
  if (!isAudioFallbackActive()) {
@@ -19684,41 +19690,34 @@ function PublisherFactory(_ref) {
19684
19690
  let isTrackManuallyStopped = false;
19685
19691
  const updateVideo = () => {
19686
19692
  const shouldSendVideo = haveWorkingTracks('video') && properties.publishVideo;
19687
- (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
19688
- var peerConnections, shouldApplyCustomMaxBitrate, executionSentinel;
19689
- return _regenerator.default.wrap(function _callee17$(_context17) {
19690
- while (1) switch (_context17.prev = _context17.next) {
19691
- case 0:
19692
- _context17.next = 2;
19693
- return getAllPeerConnections();
19694
- case 2:
19695
- peerConnections = _context17.sent;
19696
- // Set maxBitrare only if video is enabled and customMaxBitrate/videoPreset is enforced.
19697
- // Please note this may disable some encodings in Simulcast VP8.
19698
- shouldApplyCustomMaxBitrate = shouldSendVideo && _videoMaxBitrateSetting;
19699
- if (shouldApplyCustomMaxBitrate) {
19700
- peerConnections.forEach(peerConnection => {
19701
- setMaxVideoBitrateToPublisher(peerConnection);
19702
- });
19703
- } else if (_env.default.name === 'Chrome' && _env.default.version >= 69) {
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:
19704
19699
  if (updateVideoSenderParametersSentinel) {
19705
19700
  updateVideoSenderParametersSentinel.cancel();
19706
19701
  }
19707
19702
  updateVideoSenderParametersSentinel = new _cancel.default();
19708
19703
  executionSentinel = updateVideoSenderParametersSentinel;
19704
+ _context17.next = 5;
19705
+ return getAllPeerConnections();
19706
+ case 5:
19707
+ peerConnections = _context17.sent;
19709
19708
  if (!executionSentinel.isCanceled()) {
19710
19709
  // only proceed if we weren't canceled during the async operation above
19711
19710
  peerConnections.forEach(peerConnection => {
19712
19711
  peerConnection.setVideoActiveState(shouldSendVideo);
19713
19712
  });
19714
19713
  }
19715
- }
19716
- case 5:
19717
- case "end":
19718
- return _context17.stop();
19719
- }
19720
- }, _callee17);
19721
- }))();
19714
+ case 7:
19715
+ case "end":
19716
+ return _context17.stop();
19717
+ }
19718
+ }, _callee17);
19719
+ }))();
19720
+ }
19722
19721
  if (isCustomVideoTrack && mediaProcessor) {
19723
19722
  const originalTrack = mediaProcessor.getOriginalVideoTrack();
19724
19723
  if (originalTrack) {
@@ -20010,15 +20009,15 @@ function PublisherFactory(_ref) {
20010
20009
  case 0:
20011
20010
  (_chromeMixin3 = chromeMixin) == null ? void 0 : _chromeMixin3.videoDisabledIndicator.disableVideo(false);
20012
20011
  (_chromeMixin4 = chromeMixin) == null ? void 0 : _chromeMixin4.videoDisabledIndicator.setWarning(false);
20013
- setMaxVideoBitrateToPublisher();
20014
20012
  if (previousState === _audioFallbackVideoStates.default.SUSPENDED_VIDEO) {
20015
20013
  _this.trigger('videoEnabled', {
20016
20014
  reason: 'quality'
20017
20015
  });
20016
+ setMaxVideoBitrateToPublisher();
20018
20017
  } else {
20019
20018
  _this.trigger('videoDisableWarningLifted');
20020
20019
  }
20021
- case 4:
20020
+ case 3:
20022
20021
  case "end":
20023
20022
  return _context21.stop();
20024
20023
  }
@@ -20599,8 +20598,13 @@ function PublisherFactory(_ref) {
20599
20598
  _context26.next = 2;
20600
20599
  return pc.findAndReplaceTrack(oldTrack, newTrack);
20601
20600
  case 2:
20602
- pc._setP2PDefaultMaxBitrate();
20603
- case 3:
20601
+ if (isAudioFallbackActive()) {
20602
+ _context26.next = 5;
20603
+ break;
20604
+ }
20605
+ _context26.next = 5;
20606
+ return setMaxVideoBitrateToPublisher(pc);
20607
+ case 5:
20604
20608
  case "end":
20605
20609
  return _context26.stop();
20606
20610
  }
@@ -36153,38 +36157,32 @@ function PublisherPeerConnectionFactory(deps) {
36153
36157
  return _regenerator.default.wrap(function _callee2$(_context2) {
36154
36158
  while (1) switch (_context2.prev = _context2.next) {
36155
36159
  case 0:
36156
- if (!(_this.getSourceStreamId() !== 'P2P')) {
36157
- _context2.next = 2;
36158
- break;
36159
- }
36160
- return _context2.abrupt("return");
36161
- case 2:
36162
36160
  _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;
36163
36161
  if (!(!sender || !sendParams)) {
36164
- _context2.next = 5;
36162
+ _context2.next = 3;
36165
36163
  break;
36166
36164
  }
36167
36165
  return _context2.abrupt("return");
36168
- case 5:
36166
+ case 3:
36169
36167
  maxBitrate = (0, _getMaxBitrateForResolution.default)(width, height);
36170
36168
  sendParams.encodings.forEach(encoding => {
36171
36169
  // eslint-disable-line no-param-reassign
36172
36170
  encoding.maxBitrate = maxBitrate;
36173
36171
  });
36174
- _context2.prev = 7;
36175
- _context2.next = 10;
36172
+ _context2.prev = 5;
36173
+ _context2.next = 8;
36176
36174
  return sender.setParameters(sendParams);
36177
- case 10:
36178
- _context2.next = 14;
36175
+ case 8:
36176
+ _context2.next = 12;
36179
36177
  break;
36178
+ case 10:
36179
+ _context2.prev = 10;
36180
+ _context2.t0 = _context2["catch"](5);
36180
36181
  case 12:
36181
- _context2.prev = 12;
36182
- _context2.t0 = _context2["catch"](7);
36183
- case 14:
36184
36182
  case "end":
36185
36183
  return _context2.stop();
36186
36184
  }
36187
- }, _callee2, null, [[7, 12]]);
36185
+ }, _callee2, null, [[5, 10]]);
36188
36186
  }));
36189
36187
  this._setCustomMaxBitrate = /*#__PURE__*/function () {
36190
36188
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(bitrate) {
@@ -37595,25 +37593,24 @@ function SubscriberFactory(_ref2) {
37595
37593
  _context3.next = 9;
37596
37594
  return _widgetView.bindVideo(webRTCStream, videoContainerOptions, throwIfBufferFails);
37597
37595
  case 9:
37598
- _widgetView.loading(false);
37599
- _context3.next = 18;
37596
+ _context3.next = 17;
37600
37597
  break;
37601
- case 12:
37602
- _context3.prev = 12;
37598
+ case 11:
37599
+ _context3.prev = 11;
37603
37600
  _context3.t0 = _context3["catch"](6);
37604
37601
  if (!(_context3.t0 instanceof _cancel.CancellationError || _state.isDestroyed())) {
37605
- _context3.next = 16;
37602
+ _context3.next = 15;
37606
37603
  break;
37607
37604
  }
37608
37605
  return _context3.abrupt("return");
37609
- case 16:
37606
+ case 15:
37610
37607
  onVideoError(_context3.t0);
37611
37608
  throw _context3.t0;
37612
- case 18:
37609
+ case 17:
37613
37610
  case "end":
37614
37611
  return _context3.stop();
37615
37612
  }
37616
- }, _callee3, null, [[6, 12]]);
37613
+ }, _callee3, null, [[6, 11]]);
37617
37614
  }));
37618
37615
  return function bindWebRTCStream(_x3) {
37619
37616
  return _ref6.apply(this, arguments);
@@ -37951,6 +37948,7 @@ function SubscriberFactory(_ref2) {
37951
37948
  logging.debug('OT.Subscriber.onLoaded');
37952
37949
  _state.set('Subscribing');
37953
37950
  _subscribeStartTime = (0, _now.default)();
37951
+ _widgetView.loading(false);
37954
37952
  if (_chrome) {
37955
37953
  _chrome.showAfterLoading();
37956
37954
  }
@@ -38640,8 +38638,7 @@ function SubscriberFactory(_ref2) {
38640
38638
  }
38641
38639
  };
38642
38640
  const updateWidgetView = currentConnectionState => {
38643
- // We check that the subscriber has loaded so we do not prematurely hide the loading spinner and show a flickering video.
38644
- if (_widgetView && _loaded) {
38641
+ if (_widgetView) {
38645
38642
  _widgetView.loading(currentConnectionState !== _eventNames.default.SUBSCRIBER_CONNECTED);
38646
38643
  }
38647
38644
  };
@@ -43930,10 +43927,9 @@ function SessionFactory(deps) {
43930
43927
  if (proxyUrl) {
43931
43928
  sessionInfoSuccessLogPayload.proxyUrl = proxyUrl;
43932
43929
  }
43933
- if (_attemptStartTime) {
43934
- sessionInfoSuccessLogPayload.attemptDuration = new Date().getTime() - _attemptStartTime;
43935
- }
43936
- this.logEvent('SessionInfo', 'Success', null, sessionInfoSuccessLogPayload);
43930
+ this.logEvent('SessionInfo', 'Success', null, sessionInfoSuccessLogPayload, {
43931
+ messagingServer: sessionInfo.messagingServer
43932
+ });
43937
43933
  const overrides = this.staticConfig.sessionInfoOverrides || {};
43938
43934
  if (_prioritizeVP9) {
43939
43935
  overrides.priorityVideoCodec = 'vp9';
@@ -44523,7 +44519,6 @@ function SessionFactory(deps) {
44523
44519
  }
44524
44520
  };
44525
44521
  const targetUrl = (0, _proxyUrlHelper.default)(staticConfig.apiUrl, proxyUrl);
44526
- _attemptStartTime = new Date().getTime();
44527
44522
  return getSessionInfo({
44528
44523
  anvilUrl: targetUrl,
44529
44524
  sessionId,
@@ -45847,7 +45842,7 @@ function SessionFactory(deps) {
45847
45842
  }, this.MIGRATION_TIMEOUT);
45848
45843
  };
45849
45844
  const targetUrl = (0, _proxyUrlHelper.default)(this.staticConfig.apiUrl, proxyUrl);
45850
- _attemptStartTime = new Date().getTime();
45845
+
45851
45846
  // GSI
45852
45847
  getSessionInfo({
45853
45848
  anvilUrl: targetUrl,