@opentok/client 2.29.5 → 2.29.6-alpha.1

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.29.5 635a60c
2
+ * @license OpenTok.js 2.29.6 d3eee2761
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: Mon, 09 Jun 2025 07:06:16 GMT
8
+ * Date: Thu, 09 Oct 2025 10:51:32 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.29.5","buildHash":"635a60c","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.29.6","buildHash":"d3eee2761","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',
@@ -17710,9 +17710,9 @@ function PublisherFactory(_ref) {
17710
17710
  const amrAudioTrackProcessor = new _amrAudioTrackProcessor.default();
17711
17711
  this.once('publishComplete', err => {
17712
17712
  if (!err) {
17713
- var _this$session;
17713
+ var _this$session, _this$session$session;
17714
17714
  didPublishComplete = true;
17715
- activeSourceStreamId = activeSourceStreamId || (_this$session = this.session) != null && _this$session.sessionInfo.p2pEnabled ? 'P2P' : 'MANTIS';
17715
+ activeSourceStreamId = activeSourceStreamId || (_this$session = this.session) != null && (_this$session$session = _this$session.sessionInfo) != null && _this$session$session.p2pEnabled ? 'P2P' : 'MANTIS';
17716
17716
  }
17717
17717
  });
17718
17718
  this.on('sourceStreamIdChanged', newSourceStreamId => {
@@ -18031,7 +18031,7 @@ function PublisherFactory(_ref) {
18031
18031
  logAnalyticsEvent('GetRtcStatsReport', 'Called');
18032
18032
  });
18033
18033
  const recordQOS = _ref4 => {
18034
- var _this$session2, _this$session3, _this$session3$connec, _properties$audioFall;
18034
+ var _this$session2, _this$session3, _this$session3$connec, _properties$audioFall, _this$session4;
18035
18035
  let parsedStats = _ref4.parsedStats,
18036
18036
  simulcastEnabled = _ref4.simulcastEnabled,
18037
18037
  remoteConnectionId = _ref4.remoteConnectionId,
@@ -18056,7 +18056,7 @@ function PublisherFactory(_ref) {
18056
18056
  scalableVideo: simulcastEnabled,
18057
18057
  sourceStreamId: (0, _getMediaModeBySourceStreamId.default)(sourceStreamId),
18058
18058
  publisherAudioFallbackEnabled: ((_properties$audioFall = properties.audioFallback) == null ? void 0 : _properties$audioFall.publisher) || false,
18059
- cpuPerformanceState: this.session._.getCpuPerformanceState()
18059
+ cpuPerformanceState: (_this$session4 = this.session) == null ? void 0 : _this$session4._.getCpuPerformanceState()
18060
18060
  };
18061
18061
  let videoSource = isScreenSharing && isCustomVideoTrack && 'Screen' || isScreenSharing && options.videoSource || isCustomVideoTrack && 'Custom' || properties.constraints.video && 'Camera' || null;
18062
18062
 
@@ -18388,8 +18388,8 @@ function PublisherFactory(_ref) {
18388
18388
  (_audioFallbackCoordin = audioFallbackCoordinator) == null ? void 0 : _audioFallbackCoordin.onPeerConnectionDisconnected();
18389
18389
  };
18390
18390
  this._removeSubscriber = subscriberId => {
18391
- const isAdaptiveEnabled = this.session.sessionInfo.isAdaptiveEnabled;
18392
- if (isAdaptiveEnabled && activeSourceStreamId === 'P2P') {
18391
+ var _this$session5, _this$session5$sessio;
18392
+ if ((_this$session5 = this.session) != null && (_this$session5$sessio = _this$session5.sessionInfo) != null && _this$session5$sessio.isAdaptiveEnabled && activeSourceStreamId === 'P2P') {
18393
18393
  this._.startRelayedToRoutedTransition();
18394
18394
  }
18395
18395
  getPeerConnectionsBySubscriber(subscriberId).then(peerConnections => {
@@ -18410,20 +18410,20 @@ function PublisherFactory(_ref) {
18410
18410
  // @todo find out if we get onPeerDisconnected when a failure occurs.
18411
18411
  const onPeerConnectionFailure = /*#__PURE__*/function () {
18412
18412
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(peerConnection, _ref7) {
18413
- var reason, prefix, sessionInfo, _ref9, _ref9$remoteConnectio, remoteConnectionId, peerConnectionId, error, payload, logOptions, pc;
18413
+ var _this$session6, _this$session6$sessio;
18414
+ var reason, prefix, _ref9, _ref9$remoteConnectio, remoteConnectionId, peerConnectionId, error, payload, logOptions, pc;
18414
18415
  return _regenerator.default.wrap(function _callee3$(_context3) {
18415
18416
  while (1) switch (_context3.prev = _context3.next) {
18416
18417
  case 0:
18417
18418
  reason = _ref7.reason, prefix = _ref7.prefix;
18418
- sessionInfo = _this.session && _this.session.sessionInfo;
18419
- if (!(prefix === 'ICEWorkflow' && sessionInfo && sessionInfo.reconnection && loaded)) {
18420
- _context3.next = 5;
18419
+ if (!(prefix === 'ICEWorkflow' && (_this$session6 = _this.session) != null && (_this$session6$sessio = _this$session6.sessionInfo) != null && _this$session6$sessio.reconnection && loaded)) {
18420
+ _context3.next = 4;
18421
18421
  break;
18422
18422
  }
18423
18423
  // @todo not sure this is the right thing to do
18424
18424
  logging.debug('Ignoring peer connection failure due to possibility of reconnection.');
18425
18425
  return _context3.abrupt("return");
18426
- case 5:
18426
+ case 4:
18427
18427
  _ref9 = getPeerConnectionMeta(peerConnection) || {}, _ref9$remoteConnectio = _ref9.remoteConnectionId, remoteConnectionId = _ref9$remoteConnectio === void 0 ? '(not found)' : _ref9$remoteConnectio, peerConnectionId = _ref9.peerConnectionId;
18428
18428
  error = interpretPeerConnectionError(undefined, reason, prefix, remoteConnectionId, 'Publisher');
18429
18429
  payload = {
@@ -18448,13 +18448,13 @@ function PublisherFactory(_ref) {
18448
18448
  target: _this,
18449
18449
  analytics
18450
18450
  });
18451
- _context3.next = 14;
18451
+ _context3.next = 13;
18452
18452
  return peerConnectionsAsync[peerConnectionId];
18453
- case 14:
18453
+ case 13:
18454
18454
  pc = _context3.sent;
18455
18455
  pc.destroy();
18456
18456
  delete peerConnectionsAsync[peerConnectionId];
18457
- case 17:
18457
+ case 16:
18458
18458
  case "end":
18459
18459
  return _context3.stop();
18460
18460
  }
@@ -18465,8 +18465,8 @@ function PublisherFactory(_ref) {
18465
18465
  };
18466
18466
  }();
18467
18467
  const isRoutedToRelayedTransitionComplete = peerConnection => {
18468
- const isAdaptiveEnabled = this.session.sessionInfo.isAdaptiveEnabled;
18469
- return isAdaptiveEnabled && peerConnection.getSourceStreamId() === 'P2P';
18468
+ var _this$session7, _this$session7$sessio;
18469
+ return ((_this$session7 = this.session) == null ? void 0 : (_this$session7$sessio = _this$session7.sessionInfo) == null ? void 0 : _this$session7$sessio.isAdaptiveEnabled) && peerConnection.getSourceStreamId() === 'P2P';
18470
18470
  };
18471
18471
  const onIceRestartSuccess = peerConnection => {
18472
18472
  const _getPeerConnectionMet3 = getPeerConnectionMeta(peerConnection),
@@ -18498,12 +18498,13 @@ function PublisherFactory(_ref) {
18498
18498
  };
18499
18499
  const handleConnect = /*#__PURE__*/function () {
18500
18500
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
18501
+ var _this$session8, _this$session8$sessio;
18501
18502
  var _yield$getMantisPeerC, _yield$getP2pPeerConn, isMantisConnected, isP2PConnected;
18502
18503
  return _regenerator.default.wrap(function _callee4$(_context4) {
18503
18504
  while (1) switch (_context4.prev = _context4.next) {
18504
18505
  case 0:
18505
18506
  clearTimeout(_streamDestroyTimeout);
18506
- if (!_this.session.sessionInfo.isAdaptiveEnabled) {
18507
+ if (!((_this$session8 = _this.session) != null && (_this$session8$sessio = _this$session8.sessionInfo) != null && _this$session8$sessio.isAdaptiveEnabled)) {
18507
18508
  _context4.next = 21;
18508
18509
  break;
18509
18510
  }
@@ -18551,22 +18552,24 @@ function PublisherFactory(_ref) {
18551
18552
  };
18552
18553
  }();
18553
18554
  const shouldDestroyPublisher = sourceStreamId => {
18554
- const p2pEnabled = this.session.sessionInfo.p2pEnabled;
18555
- // We destroy the publisher if:
18556
- // Socket is connected. Otherwise we will try to reconnect once socket reconnects.
18557
- return _session._.isSocketConnected()
18558
- // And this is the active leg. Inactive leg fail independently.
18559
- && sourceStreamId === activeSourceStreamId
18560
- // And it is not P2P. In P2P the other peer can be reconnecting.
18561
- // If we don't detroy the Publisher, this will be destroyed once Rumors says so.
18562
- && !p2pEnabled;
18555
+ var _this$session9, _this$session9$sessio;
18556
+ return (
18557
+ // We destroy the publisher if:
18558
+ // Socket is connected. Otherwise we will try to reconnect once socket reconnects.
18559
+ _session._.isSocketConnected()
18560
+ // And this is the active leg. Inactive leg fail independently.
18561
+ && sourceStreamId === activeSourceStreamId
18562
+ // And it is not P2P. In P2P the other peer can be reconnecting.
18563
+ // If we don't detroy the Publisher, this will be destroyed once Rumors says so.
18564
+ && !((_this$session9 = this.session) != null && (_this$session9$sessio = _this$session9.sessionInfo) != null && _this$session9$sessio.p2pEnabled)
18565
+ );
18563
18566
  };
18564
18567
  const handleFail = sourceStreamId => {
18568
+ var _this$session10, _this$session10$sessi;
18565
18569
  if (!shouldDestroyPublisher(sourceStreamId)) {
18566
18570
  return;
18567
18571
  }
18568
- const isAdaptiveEnabled = this.session.sessionInfo.isAdaptiveEnabled;
18569
- if (isAdaptiveEnabled && sourceStreamId === 'P2P') {
18572
+ if ((_this$session10 = this.session) != null && (_this$session10$sessi = _this$session10.sessionInfo) != null && _this$session10$sessi.isAdaptiveEnabled && sourceStreamId === 'P2P') {
18570
18573
  // In adaptive if P2P PC has failed and the socket is connected we will transition to Mantis
18571
18574
  this._.startRelayedToRoutedTransition();
18572
18575
  } else {
@@ -18574,7 +18577,8 @@ function PublisherFactory(_ref) {
18574
18577
  // in order to avoid a race condition where we just got the socket connected at the
18575
18578
  // same moment PC transition to failed
18576
18579
  _streamDestroyTimeout = setTimeout(() => {
18577
- this.session._.streamDestroy(this.streamId, sourceStreamId);
18580
+ var _this$session11;
18581
+ (_this$session11 = this.session) == null ? void 0 : _this$session11._.streamDestroy(this.streamId, sourceStreamId);
18578
18582
  }, STREAM_DESTROY_DELAY);
18579
18583
  }
18580
18584
  };
@@ -18612,8 +18616,9 @@ function PublisherFactory(_ref) {
18612
18616
  };
18613
18617
  }();
18614
18618
  const onPeerConnected = peerConnection => {
18619
+ var _this$session12;
18615
18620
  peerConnection.setP2PMaxBitrate();
18616
- peerConnection.startEncryption(this.session.connection.id);
18621
+ peerConnection.startEncryption((_this$session12 = this.session) == null ? void 0 : _this$session12.connection.id);
18617
18622
  if (isRoutedToRelayedTransitionComplete(peerConnection)) {
18618
18623
  logRoutedToRelayedTransition('Success');
18619
18624
  }
@@ -18658,6 +18663,7 @@ function PublisherFactory(_ref) {
18658
18663
  * @returns {Promise<Error, PublisherPeerConnection>}
18659
18664
  */
18660
18665
  const createPeerConnection = _ref12 => {
18666
+ var _this$session13, _this$session14, _this$session15;
18661
18667
  let peerConnectionId = _ref12.peerConnectionId,
18662
18668
  send = _ref12.send,
18663
18669
  log = _ref12.log,
@@ -18673,13 +18679,14 @@ function PublisherFactory(_ref) {
18673
18679
  browserName: OTHelpers.env.name,
18674
18680
  isScreenSharing,
18675
18681
  isCustomVideoTrack,
18676
- sessionInfo: this.session.sessionInfo,
18682
+ sessionInfo: (_this$session13 = this.session) == null ? void 0 : _this$session13.sessionInfo,
18677
18683
  constraints: properties.constraints,
18678
18684
  videoDimensions: getVideoDimensions(),
18679
18685
  capableSimulcastScreenshare: properties.capableSimulcastScreenshare,
18680
18686
  scalableVideo: properties.scalableVideo
18681
18687
  });
18682
- peerConnectionsAsync[peerConnectionId] = Promise.all([this.session._.getIceConfig(), this.session._.getVideoCodecsCompatible(webRTCStream)]).then(_ref13 => {
18688
+ peerConnectionsAsync[peerConnectionId] = Promise.all([(_this$session14 = this.session) == null ? void 0 : _this$session14._.getIceConfig(), (_this$session15 = this.session) == null ? void 0 : _this$session15._.getVideoCodecsCompatible(webRTCStream)]).then(_ref13 => {
18689
+ var _this$session16, _this$session16$sessi, _this$session17, _this$session18, _this$session18$sessi, _this$session19, _this$session19$sessi, _this$session20, _this$session21, _this$session22, _this$session23;
18683
18690
  let iceConfig = _ref13[0],
18684
18691
  videoCodecsCompatible = _ref13[1];
18685
18692
  let pcStream = webRTCStream;
@@ -18712,19 +18719,19 @@ function PublisherFactory(_ref) {
18712
18719
  enableDtx: properties.enableDtx,
18713
18720
  enableStereo: properties.enableStereo,
18714
18721
  audioBitrate: properties.audioBitrate,
18715
- priorityVideoCodec: properties._priorityVideoCodec || this.session.sessionInfo.priorityVideoCodec,
18716
- codecFlags: properties._codecFlags || this.session._.getCodecFlags()
18722
+ priorityVideoCodec: properties._priorityVideoCodec || ((_this$session16 = this.session) == null ? void 0 : (_this$session16$sessi = _this$session16.sessionInfo) == null ? void 0 : _this$session16$sessi.priorityVideoCodec),
18723
+ codecFlags: properties._codecFlags || ((_this$session17 = this.session) == null ? void 0 : _this$session17._.getCodecFlags())
18717
18724
  },
18718
18725
  // FIXME - Remove answerOverrides once maxaveragebitrate is supported by Mantis
18719
- answerOverrides: this.session.sessionInfo.p2pEnabled ? undefined : {
18726
+ answerOverrides: (_this$session18 = this.session) != null && (_this$session18$sessi = _this$session18.sessionInfo) != null && _this$session18$sessi.p2pEnabled ? undefined : {
18720
18727
  audioBitrate: properties.audioBitrate
18721
18728
  },
18722
18729
  sourceStreamId,
18723
- isP2pEnabled: this.session.sessionInfo.p2pEnabled,
18724
- sessionId: this.session.id,
18725
- keyStore: this.session.keyStore,
18726
- sFrameClientStore: this.session.sFrameClientStore,
18727
- isE2ee: this.session._.isE2ee(),
18730
+ isP2pEnabled: (_this$session19 = this.session) == null ? void 0 : (_this$session19$sessi = _this$session19.sessionInfo) == null ? void 0 : _this$session19$sessi.p2pEnabled,
18731
+ sessionId: (_this$session20 = this.session) == null ? void 0 : _this$session20.id,
18732
+ keyStore: (_this$session21 = this.session) == null ? void 0 : _this$session21.keyStore,
18733
+ sFrameClientStore: (_this$session22 = this.session) == null ? void 0 : _this$session22.sFrameClientStore,
18734
+ isE2ee: (_this$session23 = this.session) == null ? void 0 : _this$session23._.isE2ee(),
18728
18735
  audioFallbackEnabled: properties.publisherAudioFallbackEnabled,
18729
18736
  resolution: {
18730
18737
  width: this.videoWidth(),
@@ -18903,8 +18910,8 @@ function PublisherFactory(_ref) {
18903
18910
  }
18904
18911
  return peerConnections;
18905
18912
  }).then(peerConnections => {
18906
- const isAdaptiveEnabled = this.session.sessionInfo.isAdaptiveEnabled;
18907
- if (!isAdaptiveEnabled) {
18913
+ var _this$session24, _this$session24$sessi;
18914
+ if (!((_this$session24 = this.session) != null && (_this$session24$sessi = _this$session24.sessionInfo) != null && _this$session24$sessi.isAdaptiveEnabled)) {
18908
18915
  return peerConnections;
18909
18916
  }
18910
18917
 
@@ -18937,6 +18944,7 @@ function PublisherFactory(_ref) {
18937
18944
  const _getStats = callback => _getStatsWrapper(callback);
18938
18945
  const _getRtcStatsReport = callback => _getStatsWrapper('rtcStatsReport', callback);
18939
18946
  const _createStream = (sourceStreamId, completionHandler) => {
18947
+ var _this$session25, _this$session26;
18940
18948
  const streamOptions = {
18941
18949
  name: properties.name || '',
18942
18950
  streamId: this.streamId,
@@ -18944,13 +18952,13 @@ function PublisherFactory(_ref) {
18944
18952
  channels: streamChannels,
18945
18953
  minBitrate: properties.minVideoBitrate,
18946
18954
  sourceStreamId,
18947
- e2ee: this.session._.isE2ee(),
18955
+ e2ee: (_this$session25 = this.session) == null ? void 0 : _this$session25._.isE2ee(),
18948
18956
  publisherAudioFallbackEnabled: properties.publisherAudioFallbackEnabled,
18949
18957
  customProperties: {
18950
18958
  initials: properties.initials
18951
18959
  }
18952
18960
  };
18953
- this.session._.streamCreate(streamOptions, completionHandler);
18961
+ (_this$session26 = this.session) == null ? void 0 : _this$session26._.streamCreate(streamOptions, completionHandler);
18954
18962
  };
18955
18963
  const _stopSendingRtpToMantis = /*#__PURE__*/function () {
18956
18964
  var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
@@ -19142,6 +19150,7 @@ function PublisherFactory(_ref) {
19142
19150
  };
19143
19151
  const _transitionRelayedToRouted = /*#__PURE__*/function () {
19144
19152
  var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
19153
+ var _this$session27;
19145
19154
  return _regenerator.default.wrap(function _callee10$(_context10) {
19146
19155
  while (1) switch (_context10.prev = _context10.next) {
19147
19156
  case 0:
@@ -19173,7 +19182,7 @@ function PublisherFactory(_ref) {
19173
19182
  _context10.next = 11;
19174
19183
  return _restartSendingRtpToMantis();
19175
19184
  case 11:
19176
- _this.session._.streamDestroy(_this.streamId, 'P2P');
19185
+ (_this$session27 = _this.session) == null ? void 0 : _this$session27._.streamDestroy(_this.streamId, 'P2P');
19177
19186
  _context10.t0 = _this;
19178
19187
  _context10.next = 15;
19179
19188
  return getP2pPeerConnection();
@@ -19193,8 +19202,9 @@ function PublisherFactory(_ref) {
19193
19202
  };
19194
19203
  }();
19195
19204
  const getSourceStreamIds = () => {
19205
+ var _this$session28, _this$session28$sessi;
19196
19206
  const sourceStreamIds = [];
19197
- if (!this.session.sessionInfo.p2pEnabled) {
19207
+ if (!((_this$session28 = this.session) != null && (_this$session28$sessi = _this$session28.sessionInfo) != null && _this$session28$sessi.p2pEnabled)) {
19198
19208
  sourceStreamIds.push('MANTIS');
19199
19209
  }
19200
19210
  if (activeSourceStreamId === 'P2P') {
@@ -19210,10 +19220,11 @@ function PublisherFactory(_ref) {
19210
19220
  }));
19211
19221
  };
19212
19222
  const startMigrationTimeout = () => {
19223
+ var _this$session29;
19213
19224
  _migrationTimeoutId = setTimeout(() => {
19214
19225
  logAnalyticsEvent('Migrate', 'Failed');
19215
19226
  this.destroy();
19216
- }, this.session.MIGRATION_TIMEOUT);
19227
+ }, (_this$session29 = this.session) == null ? void 0 : _this$session29.MIGRATION_TIMEOUT);
19217
19228
  };
19218
19229
  this.publish = targetElement => {
19219
19230
  logging.debug('OT.Publisher: publish');
@@ -20241,8 +20252,9 @@ function PublisherFactory(_ref) {
20241
20252
  logging.debug(message);
20242
20253
  const futurePeerConnection = getPeerConnectionById(peerConnectionId);
20243
20254
  const addPeerConnection = () => {
20255
+ var _this$session30;
20244
20256
  const send = createSendMethod({
20245
- socket: this.session._.getSocket(),
20257
+ socket: (_this$session30 = this.session) == null ? void 0 : _this$session30._.getSocket(),
20246
20258
  uri: message.uri,
20247
20259
  content: {
20248
20260
  peerId,
@@ -20293,14 +20305,14 @@ function PublisherFactory(_ref) {
20293
20305
  logging.error('OT.Publisher failed to create a peerConnection', err);
20294
20306
  });
20295
20307
  };
20296
- const isAdaptiveEnabled = this.session.sessionInfo.isAdaptiveEnabled;
20297
20308
  switch (type) {
20298
20309
  case 'unsubscribe':
20299
20310
  this._removeSubscriber(subscriberId);
20300
20311
  break;
20301
20312
  default:
20302
20313
  if (!futurePeerConnection) {
20303
- if (!state.isMigrating() && isAdaptiveEnabled && getP2pPeerConnection()) {
20314
+ var _this$session31, _this$session31$sessi;
20315
+ if (!state.isMigrating() && (_this$session31 = this.session) != null && (_this$session31$sessi = _this$session31.sessionInfo) != null && _this$session31$sessi.isAdaptiveEnabled && getP2pPeerConnection()) {
20304
20316
  // In the case Rumor sends two generateOffers for the P2P leg,
20305
20317
  // we need to ignore the second one.
20306
20318
  return;
@@ -20658,7 +20670,8 @@ function PublisherFactory(_ref) {
20658
20670
  }();
20659
20671
  const replaceAudioTrackInPeerConnections = /*#__PURE__*/function () {
20660
20672
  var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(oldTrack, newTrack) {
20661
- var isAdaptiveEnabled, activePeerConnection, inactivePeerConnection, pcs;
20673
+ var _this$session32, _this$session32$sessi;
20674
+ var activePeerConnection, inactivePeerConnection, pcs;
20662
20675
  return _regenerator.default.wrap(function _callee30$(_context30) {
20663
20676
  while (1) switch (_context30.prev = _context30.next) {
20664
20677
  case 0:
@@ -20668,41 +20681,38 @@ function PublisherFactory(_ref) {
20668
20681
  }
20669
20682
  return _context30.abrupt("return");
20670
20683
  case 2:
20671
- isAdaptiveEnabled = _this.session.sessionInfo.isAdaptiveEnabled; // If we are in an AMR session and a P2P PC, we need to change the track in the P2P PC
20672
- // and check the Mantis PC, if we need to add the new track to the muted Mantis audio tracks and replace it.
20673
- // activeSourceStreamId may be undefined if we haven't finished publishing yet
20674
- if (!(activeSourceStreamId && isAdaptiveEnabled)) {
20675
- _context30.next = 17;
20684
+ if (!(activeSourceStreamId && (_this$session32 = _this.session) != null && (_this$session32$sessi = _this$session32.sessionInfo) != null && _this$session32$sessi.isAdaptiveEnabled)) {
20685
+ _context30.next = 16;
20676
20686
  break;
20677
20687
  }
20678
- _context30.next = 6;
20688
+ _context30.next = 5;
20679
20689
  return getPeerConnectionBySourceStreamId(activeSourceStreamId);
20680
- case 6:
20690
+ case 5:
20681
20691
  activePeerConnection = _context30.sent;
20682
- _context30.next = 9;
20692
+ _context30.next = 8;
20683
20693
  return activePeerConnection == null ? void 0 : activePeerConnection.findAndReplaceTrack(oldTrack, newTrack);
20684
- case 9:
20694
+ case 8:
20685
20695
  if (!(activeSourceStreamId === 'P2P')) {
20686
- _context30.next = 15;
20696
+ _context30.next = 14;
20687
20697
  break;
20688
20698
  }
20689
- _context30.next = 12;
20699
+ _context30.next = 11;
20690
20700
  return getMantisPeerConnection();
20691
- case 12:
20701
+ case 11:
20692
20702
  inactivePeerConnection = _context30.sent;
20693
- _context30.next = 15;
20703
+ _context30.next = 14;
20694
20704
  return amrAudioTrackProcessor.replaceTrackInMutedAudioTracks(inactivePeerConnection, oldTrack, newTrack);
20695
- case 15:
20696
- _context30.next = 22;
20705
+ case 14:
20706
+ _context30.next = 21;
20697
20707
  break;
20698
- case 17:
20699
- _context30.next = 19;
20708
+ case 16:
20709
+ _context30.next = 18;
20700
20710
  return getAllPeerConnections();
20701
- case 19:
20711
+ case 18:
20702
20712
  pcs = _context30.sent;
20703
- _context30.next = 22;
20713
+ _context30.next = 21;
20704
20714
  return Promise.all(pcs.map(pc => pc.findAndReplaceTrack(oldTrack, newTrack)));
20705
- case 22:
20715
+ case 21:
20706
20716
  case "end":
20707
20717
  return _context30.stop();
20708
20718
  }
@@ -20846,7 +20856,7 @@ function PublisherFactory(_ref) {
20846
20856
  document.addEventListener('visibilitychange', visibilityHandler);
20847
20857
  };
20848
20858
  const handleBuggedUnMutedLocalAudioTrack = audioTrack => {
20849
- var _this$session4;
20859
+ var _this$session33;
20850
20860
  if (hasAudio()) {
20851
20861
  if (!hasVideo()) {
20852
20862
  // We only need to reset the audio source when the publisher is audio only.
@@ -20861,7 +20871,7 @@ function PublisherFactory(_ref) {
20861
20871
  this.videoElement().pause();
20862
20872
  }
20863
20873
  }
20864
- this == null ? void 0 : (_this$session4 = this.session) == null ? void 0 : _this$session4.trigger('gsmCallEnded');
20874
+ this == null ? void 0 : (_this$session33 = this.session) == null ? void 0 : _this$session33.trigger('gsmCallEnded');
20865
20875
  };
20866
20876
 
20867
20877
  /**
@@ -21576,7 +21586,8 @@ function PublisherFactory(_ref) {
21576
21586
  unpublishFromSession: (session, reason) => {
21577
21587
  if (!this.session || session.id !== this.session.id) {
21578
21588
  if (reason === 'unpublished') {
21579
- const selfSessionText = this.session && this.session.id || 'no session';
21589
+ var _this$session34;
21590
+ const selfSessionText = ((_this$session34 = this.session) == null ? void 0 : _this$session34.id) || 'no session';
21580
21591
  logging.warn(`The publisher ${guid} is trying to unpublish from a session ${session.id} it is not ` + `attached to (it is attached to ${selfSessionText})`);
21581
21592
  }
21582
21593
  return this;