@opentok/client 2.30.1-alpha.5 → 2.30.1-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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.30.1 731f57d0a
2
+ * @license OpenTok.js 2.30.1 a0036fd
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, 29 May 2025 15:38:48 GMT
8
+ * Date: Fri, 30 May 2025 07:16:18 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -8672,7 +8672,7 @@ const logging = (0, _log.default)('StaticConfig');
8672
8672
  */
8673
8673
 
8674
8674
  /** @type builtInConfig */
8675
- const builtInConfig = (0, _cloneDeep.default)({"version":"v2.30.1","buildHash":"731f57d0a","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"});
8675
+ const builtInConfig = (0, _cloneDeep.default)({"version":"v2.30.1","buildHash":"a0036fd","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"});
8676
8676
  const whitelistAllowedRuntimeProperties = (0, _pick.default)(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
8677
8677
  const liveConfigMap = {
8678
8678
  apiUrl: 'apiURL',
@@ -18729,6 +18729,7 @@ function PublisherFactory(_ref) {
18729
18729
  scalableVideo: properties.scalableVideo
18730
18730
  });
18731
18731
  peerConnectionsAsync[peerConnectionId] = Promise.all([this.session._.getIceConfig(), this.session._.getVideoCodecsCompatible(webRTCStream)]).then(_ref13 => {
18732
+ var _this$session4, _this$session4$sessio, _this$session5, _this$session5$sessio;
18732
18733
  let iceConfig = _ref13[0],
18733
18734
  videoCodecsCompatible = _ref13[1];
18734
18735
  let pcStream = webRTCStream;
@@ -18757,11 +18758,11 @@ function PublisherFactory(_ref) {
18757
18758
  codecFlags: properties._codecFlags || this.session._.getCodecFlags()
18758
18759
  },
18759
18760
  // FIXME - Remove answerOverrides once maxaveragebitrate is supported by Mantis
18760
- answerOverrides: this.session.sessionInfo.p2pEnabled ? undefined : {
18761
+ answerOverrides: (_this$session4 = this.session) != null && (_this$session4$sessio = _this$session4.sessionInfo) != null && _this$session4$sessio.p2pEnabled ? undefined : {
18761
18762
  audioBitrate: properties.audioBitrate
18762
18763
  },
18763
18764
  sourceStreamId,
18764
- isP2pEnabled: this.session.sessionInfo.p2pEnabled,
18765
+ isP2pEnabled: (_this$session5 = this.session) == null ? void 0 : (_this$session5$sessio = _this$session5.sessionInfo) == null ? void 0 : _this$session5$sessio.p2pEnabled,
18765
18766
  sessionId: this.session.id,
18766
18767
  keyStore: this.session.keyStore,
18767
18768
  sFrameClientStore: this.session.sFrameClientStore,
@@ -20895,7 +20896,7 @@ function PublisherFactory(_ref) {
20895
20896
  document.addEventListener('visibilitychange', visibilityHandler);
20896
20897
  };
20897
20898
  const handleBuggedUnMutedLocalAudioTrack = audioTrack => {
20898
- var _this$session4;
20899
+ var _this$session6;
20899
20900
  if (hasAudio()) {
20900
20901
  if (!hasVideo()) {
20901
20902
  // We only need to reset the audio source when the publisher is audio only.
@@ -20910,7 +20911,7 @@ function PublisherFactory(_ref) {
20910
20911
  this.videoElement().pause();
20911
20912
  }
20912
20913
  }
20913
- this == null ? void 0 : (_this$session4 = this.session) == null ? void 0 : _this$session4.trigger('gsmCallEnded');
20914
+ this == null ? void 0 : (_this$session6 = this.session) == null ? void 0 : _this$session6.trigger('gsmCallEnded');
20914
20915
  };
20915
20916
 
20916
20917
  /**
@@ -21671,6 +21672,7 @@ function PublisherFactory(_ref) {
21671
21672
  },
21672
21673
  startMigration: function () {
21673
21674
  var _startMigration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
21675
+ var _this$session7, _this$session7$sessio;
21674
21676
  var relayedPeerConnection, onCreateStreamError;
21675
21677
  return _regenerator.default.wrap(function _callee39$(_context39) {
21676
21678
  while (1) switch (_context39.prev = _context39.next) {
@@ -21691,7 +21693,7 @@ function PublisherFactory(_ref) {
21691
21693
  throw new Error(error);
21692
21694
  }
21693
21695
  };
21694
- if (!_this.session.sessionInfo.p2pEnabled) {
21696
+ if (!((_this$session7 = _this.session) != null && (_this$session7$sessio = _this$session7.sessionInfo) != null && _this$session7$sessio.p2pEnabled)) {
21695
21697
  _context39.next = 12;
21696
21698
  break;
21697
21699
  }
@@ -43475,6 +43477,7 @@ function SessionFactory(deps) {
43475
43477
  _socket.connect(_token, this.sessionInfo, {
43476
43478
  connectionEventsSuppressed
43477
43479
  }, (error, sessionState) => {
43480
+ var _socket3;
43478
43481
  if (error) {
43479
43482
  const payload = {};
43480
43483
  let options;
@@ -43488,11 +43491,12 @@ function SessionFactory(deps) {
43488
43491
  error.message = converted.message;
43489
43492
  }
43490
43493
  if (error.code || error.message || error.reason) {
43494
+ var _socket2;
43491
43495
  options = {
43492
43496
  failureCode: error.code,
43493
43497
  failureMessage: error.message,
43494
43498
  failureReason: error.reason,
43495
- socketId: _socket.socketId
43499
+ socketId: (_socket2 = _socket) == null ? void 0 : _socket2.socketId
43496
43500
  };
43497
43501
  }
43498
43502
  _socket = null;
@@ -43517,7 +43521,7 @@ function SessionFactory(deps) {
43517
43521
  sessionObjects.publishers.forEach(publisher => publisher._.startMigration());
43518
43522
  return;
43519
43523
  }
43520
- this.connection = this.connections.get(_socket.id());
43524
+ this.connection = this.connections.get((_socket3 = _socket) == null ? void 0 : _socket3.id());
43521
43525
  if (this.connection) {
43522
43526
  this.capabilities = this.connection.permissions;
43523
43527
  }
@@ -43571,6 +43575,12 @@ function SessionFactory(deps) {
43571
43575
  analytics
43572
43576
  });
43573
43577
  };
43578
+ const dispatchSocketIsNullError = (action, completionHandler) => {
43579
+ const socketNotDefined = `Unable to perform ${action}, you are not connected.`;
43580
+ const otErrorInstance = otError(errors.NOT_CONNECTED, new Error(socketNotDefined), 404);
43581
+ dispatchOTError(otErrorInstance, completionHandler);
43582
+ return otErrorInstance;
43583
+ };
43574
43584
  const dispatchMuteError = err => {
43575
43585
  const error = otError(err.code, new Error(err.message), err.exceptionCode);
43576
43586
  dispatchOTError(error);
@@ -45024,7 +45034,8 @@ function SessionFactory(deps) {
45024
45034
  return _isSocketReconnecting;
45025
45035
  },
45026
45036
  isSocketConnected() {
45027
- return _socket.is('connected') && !_isSocketReconnecting;
45037
+ var _socket4;
45038
+ return ((_socket4 = _socket) == null ? void 0 : _socket4.is('connected')) && !_isSocketReconnecting;
45028
45039
  },
45029
45040
  getSocket() {
45030
45041
  return _socket;
@@ -45314,7 +45325,8 @@ function SessionFactory(deps) {
45314
45325
  },
45315
45326
  testMigrate: () => {
45316
45327
  if (this.isNot('migrating')) {
45317
- _socket.migrateSession();
45328
+ var _socket5;
45329
+ (_socket5 = _socket) == null ? void 0 : _socket5.migrateSession();
45318
45330
  } else {
45319
45331
  _logging.warn('Session is currently migrating');
45320
45332
  }
@@ -45470,6 +45482,10 @@ function SessionFactory(deps) {
45470
45482
  return undefined;
45471
45483
  }
45472
45484
  }
45485
+ if (!_socket) {
45486
+ dispatchSocketIsNullError('signal', _completion);
45487
+ return;
45488
+ }
45473
45489
  _socket.signal(_options, function (error) {
45474
45490
  if (error) {
45475
45491
  const errorName = getErrorNameFromCode(error.code);
@@ -45588,6 +45604,10 @@ function SessionFactory(deps) {
45588
45604
  dispatchOTError(otError(errors.PERMISSION_DENIED, new Error(notPermittedErrorMsg), ExceptionCodes.UNABLE_TO_FORCE_DISCONNECT), completionHandler);
45589
45605
  return;
45590
45606
  }
45607
+ if (!_socket) {
45608
+ dispatchSocketIsNullError('forceDisconnect', completionHandler);
45609
+ return;
45610
+ }
45591
45611
  _socket.forceDisconnect(connectionId, function (err) {
45592
45612
  if (err) {
45593
45613
  dispatchOTError(otError(errors.INVALID_PARAMETER, new Error(invalidParameterErrorMsg), ExceptionCodes.INVALID_PARAMETER), completionHandler);
@@ -45701,6 +45721,10 @@ function SessionFactory(deps) {
45701
45721
  dispatchError(notPermittedError);
45702
45722
  return;
45703
45723
  }
45724
+ if (!_socket) {
45725
+ dispatchSocketIsNullError('forceUnpublish', completionHandler);
45726
+ return;
45727
+ }
45704
45728
  _socket.forceUnpublish(stream.id, err => {
45705
45729
  if (!err) {
45706
45730
  completionHandler(null);
@@ -45779,6 +45803,10 @@ function SessionFactory(deps) {
45779
45803
  reject(dispatchMuteError(_forceMuteErrors.default.INVALID_PARAMETER));
45780
45804
  return;
45781
45805
  }
45806
+ if (!_socket) {
45807
+ reject(dispatchSocketIsNullError('forceMuteStream'));
45808
+ return;
45809
+ }
45782
45810
  _socket.forceMuteStream(stream.id, err => {
45783
45811
  if (err) {
45784
45812
  reject(handleMuteServerError(err));
@@ -45886,6 +45914,10 @@ function SessionFactory(deps) {
45886
45914
  reject(dispatchMuteError(_forceMuteErrors.default.INVALID_PARAMETER));
45887
45915
  return;
45888
45916
  }
45917
+ if (!_socket) {
45918
+ reject(dispatchSocketIsNullError('forceMuteAll'));
45919
+ return;
45920
+ }
45889
45921
  const excludedStreamIds = (excludedStreams || []).map(stream => stream.id);
45890
45922
  _socket.forceMuteAll(excludedStreamIds, true, err => {
45891
45923
  if (err) {
@@ -45955,6 +45987,10 @@ function SessionFactory(deps) {
45955
45987
  reject(error);
45956
45988
  return;
45957
45989
  }
45990
+ if (!_socket) {
45991
+ reject(dispatchSocketIsNullError('disableForceMute'));
45992
+ return;
45993
+ }
45958
45994
  _socket.forceMuteAll([], false, err => {
45959
45995
  if (err) {
45960
45996
  reject(handleMuteServerError(err));