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

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 3dc50499e
2
+ * @license OpenTok.js 2.35.0 929017bbf
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: Wed, 17 Jun 2026 13:06:50 GMT
8
+ * Date: Fri, 19 Jun 2026 06:02:39 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":"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;
39205
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"929017bbf","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
  /**
@@ -62474,7 +62474,6 @@ function PeerConnectionFactory(deps) {
62474
62474
  options
62475
62475
  });
62476
62476
  const sdpTransforms = sdpTransformDefaults;
62477
- const shouldFilterCandidate = candidate => iceConfig.transportPolicy === 'relay' && candidate != null && candidate.candidate.indexOf('typ relay') === -1;
62478
62477
  const config = (0, _omit.default)(options, ['isPublisher', 'logAnalyticsEvent', 'offerOverrides', 'answerOverrides', 'sendMessage']);
62479
62478
  let _peerConnection, _channels, _offer, _answer, _transitionToFailedTimeOut;
62480
62479
  let _peerConnectionCompletionHandlers = [];
@@ -62606,16 +62605,23 @@ function PeerConnectionFactory(deps) {
62606
62605
  }
62607
62606
  };
62608
62607
  })();
62609
- const _readyToCompleteOffer = {
62608
+ let candidateReadyTimer;
62609
+ let candidatesReadyResolved = false;
62610
+ const _candidatesReady = {
62610
62611
  clean() {
62612
+ if (candidateReadyTimer) {
62613
+ clearTimeout(candidateReadyTimer);
62614
+ candidateReadyTimer = null;
62615
+ }
62616
+ candidatesReadyResolved = true;
62611
62617
  delete this.promise;
62612
62618
  delete this.resolve;
62613
62619
  delete this.reject;
62614
62620
  }
62615
62621
  };
62616
- _readyToCompleteOffer.promise = new Promise((resolve, reject) => {
62617
- _readyToCompleteOffer.resolve = resolve;
62618
- _readyToCompleteOffer.reject = reject;
62622
+ _candidatesReady.promise = new Promise((resolve, reject) => {
62623
+ _candidatesReady.resolve = resolve;
62624
+ _candidatesReady.reject = reject;
62619
62625
  });
62620
62626
  let _iceProcessor = new IceCandidateProcessor();
62621
62627
  let _state = 'new';
@@ -62780,7 +62786,6 @@ function PeerConnectionFactory(deps) {
62780
62786
  return _ref6.apply(this, arguments);
62781
62787
  };
62782
62788
  }();
62783
- _readyToCompleteOffer.resolve();
62784
62789
  const getOrCreateSFrameReceiverClient = /*#__PURE__*/function () {
62785
62790
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(sFrameSenderId) {
62786
62791
  return _regenerator.default.wrap(function _callee6$(_context6) {
@@ -62950,12 +62955,45 @@ function PeerConnectionFactory(deps) {
62950
62955
  logging,
62951
62956
  logAnalyticsEvent
62952
62957
  });
62958
+
62959
+ // Wait for a relay candidate before completing the offer so that relay
62960
+ // candidates are available as fallback when iceTransportPolicy is 'all'.
62961
+ const CANDIDATE_READY_TIMEOUT = 2000;
62962
+ const resolveCandidatesReady = function resolveCandidatesReady(timeoutReached) {
62963
+ if (timeoutReached === void 0) {
62964
+ timeoutReached = false;
62965
+ }
62966
+ if (candidateReadyTimer) {
62967
+ clearTimeout(candidateReadyTimer);
62968
+ candidateReadyTimer = null;
62969
+ }
62970
+ if (candidatesReadyResolved) return;
62971
+ candidatesReadyResolved = true;
62972
+ _candidatesReady.resolve();
62973
+ if (timeoutReached) {
62974
+ const msg = `In ${CANDIDATE_READY_TIMEOUT}ms the ICE gathering didn't finish and no relay candidate was received`;
62975
+ logging.warn(msg);
62976
+ logAnalyticsEvent('iceCandidatesReady', 'Event', {
62977
+ msg
62978
+ });
62979
+ }
62980
+ };
62981
+ if (candidateReadyTimer) {
62982
+ clearTimeout(candidateReadyTimer);
62983
+ }
62984
+ candidateReadyTimer = setTimeout(resolveCandidatesReady, CANDIDATE_READY_TIMEOUT, true);
62953
62985
  const onIceCandidate = event => {
62954
- _readyToCompleteOffer.resolve();
62955
- if (shouldFilterCandidate(event.candidate)) {
62956
- logging.debug('Ignore candidate', event.candidate.candidate);
62986
+ var _candidate$candidate;
62987
+ const candidate = event.candidate;
62988
+ const isRelayCandidate = candidate == null ? void 0 : (_candidate$candidate = candidate.candidate) == null ? void 0 : _candidate$candidate.includes('typ relay');
62989
+ if (candidate !== null && iceConfig.transportPolicy === 'relay' && !isRelayCandidate) {
62957
62990
  return;
62958
62991
  }
62992
+ if (isRelayCandidate || candidate === null) {
62993
+ // If we have a relay candidate or the gathering is completed (candidate === null),
62994
+ // resolve immediately
62995
+ resolveCandidatesReady();
62996
+ }
62959
62997
  forwarder(event);
62960
62998
  };
62961
62999
  const onTrackAdded = /*#__PURE__*/function () {
@@ -63029,11 +63067,18 @@ function PeerConnectionFactory(deps) {
63029
63067
  }
63030
63068
  api.trigger('negotiationNeeded');
63031
63069
  };
63070
+ const onIceGatheringStateChange = () => {
63071
+ if (_peerConnection.iceGatheringState === 'complete') {
63072
+ // Gathering is done — resolve even if no relay candidate arrived
63073
+ resolveCandidatesReady();
63074
+ }
63075
+ };
63032
63076
  _peerConnection.addEventListener('track', onTrackAdded);
63033
63077
  _peerConnection.addEventListener('icecandidate', onIceCandidate);
63034
63078
  _peerConnection.addEventListener('signalingstatechange', routeStateChanged);
63035
63079
  _peerConnection.addEventListener('negotiationneeded', onNegotiationNeeded);
63036
63080
  _peerConnection.addEventListener('iceconnectionstatechange', onIceConnectionStateChanged);
63081
+ _peerConnection.addEventListener('icegatheringstatechange', onIceGatheringStateChange);
63037
63082
  cleanupJobs.add(() => {
63038
63083
  if (!_peerConnection) {
63039
63084
  return;
@@ -63043,6 +63088,7 @@ function PeerConnectionFactory(deps) {
63043
63088
  _peerConnection.removeEventListener('signalingstatechange', routeStateChanged);
63044
63089
  _peerConnection.removeEventListener('negotiationneeded', onNegotiationNeeded);
63045
63090
  _peerConnection.removeEventListener('iceconnectionstatechange', onIceConnectionStateChanged);
63091
+ _peerConnection.removeEventListener('icegatheringstatechange', onIceGatheringStateChange);
63046
63092
  });
63047
63093
  triggerPeerConnectionCompletion(null);
63048
63094
  };
@@ -63064,7 +63110,7 @@ function PeerConnectionFactory(deps) {
63064
63110
  _peerConnectionCompletionHandlers = [];
63065
63111
  qos.stopCollecting();
63066
63112
  cleanupJobs.releaseAll();
63067
- _readyToCompleteOffer.clean();
63113
+ _candidatesReady.clean();
63068
63114
  statsCache.destroy();
63069
63115
  if (_peerConnection !== null) {
63070
63116
  if (_peerConnection.destroy) {
@@ -63187,7 +63233,7 @@ function PeerConnectionFactory(deps) {
63187
63233
  };
63188
63234
  const onRemoteVideoSupported = supported => api.trigger('remoteVideoSupported', supported);
63189
63235
  internalCreatePeerConnection(() => {
63190
- offerProcessor(_peerConnection, windowMock.RTCPeerConnection, windowMock.RTCSessionDescription, NativeRTCSessionDescription, sdpTransforms, offer, codecFlags, p2p, relayAnswer, reportError, onRemoteVideoSupported, replaceBaselineProfile, sourceStreamId);
63236
+ offerProcessor(_peerConnection, windowMock.RTCPeerConnection, windowMock.RTCSessionDescription, NativeRTCSessionDescription, sdpTransforms, offer, codecFlags, p2p, (answer, modifiedOffer) => _candidatesReady.promise.then(() => relayAnswer(answer, modifiedOffer)), reportError, onRemoteVideoSupported, replaceBaselineProfile, sourceStreamId);
63191
63237
  });
63192
63238
  };
63193
63239
  const processAnswer = message => {
@@ -63268,7 +63314,7 @@ function PeerConnectionFactory(deps) {
63268
63314
  }).then(offer => {
63269
63315
  logging.debug('processSubscribe: got offer, waiting for ' + '_readyToCompleteOffer');
63270
63316
  _offer = offer;
63271
- _readyToCompleteOffer.promise.then(() => onOfferCreated(_offer));
63317
+ _candidatesReady.promise.then(() => onOfferCreated(_offer));
63272
63318
  logAnalyticsEvent('peerConnection:processSubscribe', 'Success', {
63273
63319
  sdp: _offer.sdp
63274
63320
  });