@opentok/client 2.35.0-alpha.1 → 2.35.0-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.35.0 c9880a403
2
+ * @license OpenTok.js 2.35.0 e74a3686c
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: Mon, 13 Apr 2026 08:59:20 GMT
8
+ * Date: Thu, 16 Apr 2026 12:47:51 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -8593,7 +8593,7 @@ function staticConfigFactory(_temp) {
8593
8593
  _ref$axios = _ref.axios,
8594
8594
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
8595
8595
  _ref$properties = _ref.properties,
8596
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"c9880a403","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;
8596
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"e74a3686c","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;
8597
8597
  /** @type builtInConfig */
8598
8598
  const builtInConfig = (0, _cloneDeep.default)(properties);
8599
8599
  /**
@@ -10004,10 +10004,14 @@ function PeerConnectionFactory(deps) {
10004
10004
  iceRestartTimeout = null;
10005
10005
  }
10006
10006
  };
10007
- const _createOfferWithIceRestart = () => {
10007
+ const _createOfferWithIceRestart = force => {
10008
10008
  clearIceRestartTimeout();
10009
10009
  if (!api.iceConnectionStateIsConnected()) {
10010
- debouncedGenerateOfferAndSend();
10010
+ if (force) {
10011
+ api.generateOfferAndSend();
10012
+ } else {
10013
+ debouncedGenerateOfferAndSend();
10014
+ }
10011
10015
  } else {
10012
10016
  logging.debug('iceRestart is going to wait until we disconnect or negotiationNeeded' + ' and then restart ice');
10013
10017
  iceRestartTimeout = setTimeout(() => {
@@ -10017,6 +10021,7 @@ function PeerConnectionFactory(deps) {
10017
10021
  };
10018
10022
  const _iceRestartNeeded = (() => {
10019
10023
  let value = false;
10024
+ let lastIceRestartNeededTime = 0;
10020
10025
  return {
10021
10026
  get() {
10022
10027
  return value;
@@ -10026,7 +10031,10 @@ function PeerConnectionFactory(deps) {
10026
10031
  if (newValue !== value) {
10027
10032
  value = newValue;
10028
10033
  if (value) {
10029
- _createOfferWithIceRestart();
10034
+ const prevIceRestartNeededTime = lastIceRestartNeededTime;
10035
+ lastIceRestartNeededTime = Date.now();
10036
+ const recentlyIceRestartNeeded = lastIceRestartNeededTime - prevIceRestartNeededTime < 10000;
10037
+ _createOfferWithIceRestart(recentlyIceRestartNeeded);
10030
10038
  } else {
10031
10039
  clearIceRestartTimeout();
10032
10040
  debouncedGenerateOfferAndSend.cancel();
@@ -10417,9 +10425,7 @@ function PeerConnectionFactory(deps) {
10417
10425
  if (_peerConnection.iceConnectionState === 'connected') {
10418
10426
  // Now that the iceConnectionState is connected, let's make sure the transitionToFailedTimeOut
10419
10427
  // is cleared ASAP to avoid triggering an iceConnectionStateChange event to failed.
10420
- if (_previousIceState === 'disconnected') {
10421
- api.clearFailedTimeout();
10422
- }
10428
+ api.clearFailedTimeout();
10423
10429
  api.emit('iceConnected');
10424
10430
  _iceRestartNeeded.set(false);
10425
10431
  } else if (_peerConnection.iceConnectionState === 'completed' && env.isLegacyEdge) {
@@ -10440,6 +10446,7 @@ function PeerConnectionFactory(deps) {
10440
10446
  // We only transition to failed in unified-plan
10441
10447
  // Plan-b will transition natively
10442
10448
  _transitionToFailedTimeOut = setTimeout(() => {
10449
+ _transitionToFailedTimeOut = null;
10443
10450
  const iceState = 'failed';
10444
10451
  logAnalyticsEvent('attachEventsToPeerConnection', 'iceconnectionstatechange', iceState);
10445
10452
  _previousIceState = iceState;
@@ -10908,7 +10915,12 @@ function PeerConnectionFactory(deps) {
10908
10915
  }
10909
10916
  };
10910
10917
  api.iceRestart = () => _iceRestartNeeded.set(true);
10911
- api.clearFailedTimeout = () => clearTimeout(_transitionToFailedTimeOut);
10918
+ api.clearFailedTimeout = () => {
10919
+ if (_transitionToFailedTimeOut) {
10920
+ clearTimeout(_transitionToFailedTimeOut);
10921
+ _transitionToFailedTimeOut = null;
10922
+ }
10923
+ };
10912
10924
  api.activateVideoEncodings = () => activateVideo(_peerConnection, true);
10913
10925
  api.deactivateVideoEncodings = () => activateVideo(_peerConnection, false);
10914
10926
  api.processMessage = (type, message) => {
@@ -19554,17 +19566,15 @@ function PublisherFactory(_ref) {
19554
19566
  remoteConnectionId
19555
19567
  });
19556
19568
  };
19557
- const handleDisconnect = (peerConnection, sourceStreamId) => {
19558
- setTimeout(() => {
19559
- if (lastIceConnectionStates[sourceStreamId] === 'disconnected' && _session._.isSocketConnected()) {
19560
- const _getPeerConnectionMet6 = getPeerConnectionMeta(peerConnection),
19561
- remoteConnectionId = _getPeerConnectionMet6.remoteConnectionId;
19562
- logRepublish('Attempt', {
19563
- remoteConnectionId
19564
- });
19565
- peerConnection.iceRestart();
19566
- }
19567
- }, 2000);
19569
+ const handleDisconnect = peerConnection => {
19570
+ if (_session._.isSocketConnected()) {
19571
+ const _getPeerConnectionMet6 = getPeerConnectionMeta(peerConnection),
19572
+ remoteConnectionId = _getPeerConnectionMet6.remoteConnectionId;
19573
+ logRepublish('Attempt', {
19574
+ remoteConnectionId
19575
+ });
19576
+ peerConnection.iceRestart();
19577
+ }
19568
19578
  };
19569
19579
  const handleConnect = /*#__PURE__*/function () {
19570
19580
  var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
@@ -19670,7 +19680,7 @@ function PublisherFactory(_ref) {
19670
19680
  break;
19671
19681
  case 7:
19672
19682
  if (newState === 'disconnected') {
19673
- handleDisconnect(peerConnection, sourceStreamId);
19683
+ handleDisconnect(peerConnection);
19674
19684
  } else if (newState === 'failed') {
19675
19685
  handleFail(sourceStreamId);
19676
19686
  }
@@ -48901,22 +48911,9 @@ function SubscriberFactory(_ref2) {
48901
48911
  };
48902
48912
  const handleDisconnect = sourceStreamId => {
48903
48913
  if (sourceStreamId !== 'P2P') {
48904
- setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
48905
- return _regenerator.default.wrap(function _callee10$(_context10) {
48906
- while (1) switch (_context10.prev = _context10.next) {
48907
- case 0:
48908
- if (!(_lastConnectionStatesMap[sourceStreamId] === 'disconnected' && _session._.isSocketConnected())) {
48909
- _context10.next = 3;
48910
- break;
48911
- }
48912
- _context10.next = 3;
48913
- return _this._.iceRestart('peer connection disconnected');
48914
- case 3:
48915
- case "end":
48916
- return _context10.stop();
48917
- }
48918
- }, _callee10);
48919
- })), 2000);
48914
+ if (_session._.isSocketConnected()) {
48915
+ this._.iceRestart('peer connection disconnected');
48916
+ }
48920
48917
  }
48921
48918
  };
48922
48919
  const handleFailMantis = () => {
@@ -49195,22 +49192,22 @@ function SubscriberFactory(_ref2) {
49195
49192
  });
49196
49193
  function setAudioOnly(audioOnly) {
49197
49194
  getAllPeerConnections().forEach( /*#__PURE__*/function () {
49198
- var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(peerConnection) {
49199
- return _regenerator.default.wrap(function _callee11$(_context11) {
49200
- while (1) switch (_context11.prev = _context11.next) {
49195
+ var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(peerConnection) {
49196
+ return _regenerator.default.wrap(function _callee10$(_context10) {
49197
+ while (1) switch (_context10.prev = _context10.next) {
49201
49198
  case 0:
49202
- _context11.next = 2;
49199
+ _context10.next = 2;
49203
49200
  return peerConnection;
49204
49201
  case 2:
49205
- _context11.sent.subscribeToVideo(!audioOnly);
49202
+ _context10.sent.subscribeToVideo(!audioOnly);
49206
49203
  case 3:
49207
49204
  case "end":
49208
- return _context11.stop();
49205
+ return _context10.stop();
49209
49206
  }
49210
- }, _callee11);
49207
+ }, _callee10);
49211
49208
  }));
49212
49209
  return function (_x12) {
49213
- return _ref22.apply(this, arguments);
49210
+ return _ref21.apply(this, arguments);
49214
49211
  };
49215
49212
  }());
49216
49213
 
@@ -49233,24 +49230,24 @@ function SubscriberFactory(_ref2) {
49233
49230
  logAnalyticsEvent('GetRtcStatsReport', 'Called');
49234
49231
  });
49235
49232
  const createAudioLevelSampler = /*#__PURE__*/function () {
49236
- var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(peerConnection) {
49237
- return _regenerator.default.wrap(function _callee12$(_context12) {
49238
- while (1) switch (_context12.prev = _context12.next) {
49233
+ var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(peerConnection) {
49234
+ return _regenerator.default.wrap(function _callee11$(_context11) {
49235
+ while (1) switch (_context11.prev = _context11.next) {
49239
49236
  case 0:
49240
49237
  if (_audioLevelBehaviour) {
49241
49238
  _audioLevelBehaviour.destroy();
49242
49239
  _audioLevelBehaviour = undefined;
49243
49240
  }
49244
- _context12.prev = 1;
49245
- _context12.next = 4;
49241
+ _context11.prev = 1;
49242
+ _context11.next = 4;
49246
49243
  return waitUntil(() => peerConnection._hasAudioTracks());
49247
49244
  case 4:
49248
- _context12.next = 9;
49245
+ _context11.next = 9;
49249
49246
  break;
49250
49247
  case 6:
49251
- _context12.prev = 6;
49252
- _context12.t0 = _context12["catch"](1);
49253
- return _context12.abrupt("return");
49248
+ _context11.prev = 6;
49249
+ _context11.t0 = _context11["catch"](1);
49250
+ return _context11.abrupt("return");
49254
49251
  case 9:
49255
49252
  // prefer the audioLevelSampler (more efficient and better responsiveness)
49256
49253
  _audioLevelSampler = audioLevelSamplerFactory(peerConnection);
@@ -49269,12 +49266,12 @@ function SubscriberFactory(_ref2) {
49269
49266
  }
49270
49267
  case 11:
49271
49268
  case "end":
49272
- return _context12.stop();
49269
+ return _context11.stop();
49273
49270
  }
49274
- }, _callee12, null, [[1, 6]]);
49271
+ }, _callee11, null, [[1, 6]]);
49275
49272
  }));
49276
49273
  return function createAudioLevelSampler(_x13) {
49277
- return _ref23.apply(this, arguments);
49274
+ return _ref22.apply(this, arguments);
49278
49275
  };
49279
49276
  }();
49280
49277
  const setPeerConnectionEvents = (peerConnection, sourceStreamId) => {
@@ -49291,35 +49288,35 @@ function SubscriberFactory(_ref2) {
49291
49288
  peerConnectionEvents.once('connected', () => onPeerConnected(peerConnection));
49292
49289
  peerConnectionEvents.on('disconnected', onPeerDisconnected);
49293
49290
  peerConnectionEvents.on('error', onPeerConnectionFailure);
49294
- peerConnectionEvents.once('remoteTrackAdded', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
49295
- var _args13 = arguments;
49296
- return _regenerator.default.wrap(function _callee13$(_context13) {
49297
- while (1) switch (_context13.prev = _context13.next) {
49291
+ peerConnectionEvents.once('remoteTrackAdded', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
49292
+ var _args12 = arguments;
49293
+ return _regenerator.default.wrap(function _callee12$(_context12) {
49294
+ while (1) switch (_context12.prev = _context12.next) {
49298
49295
  case 0:
49299
- _context13.next = 2;
49296
+ _context12.next = 2;
49300
49297
  return createAudioLevelSampler(peerConnection);
49301
49298
  case 2:
49302
- _context13.prev = 2;
49303
- _context13.next = 5;
49304
- return onTrackAdded(..._args13);
49299
+ _context12.prev = 2;
49300
+ _context12.next = 5;
49301
+ return onTrackAdded(..._args12);
49305
49302
  case 5:
49306
- _context13.next = 10;
49303
+ _context12.next = 10;
49307
49304
  break;
49308
49305
  case 7:
49309
- _context13.prev = 7;
49310
- _context13.t0 = _context13["catch"](2);
49311
- logging.error(_context13.t0);
49306
+ _context12.prev = 7;
49307
+ _context12.t0 = _context12["catch"](2);
49308
+ logging.error(_context12.t0);
49312
49309
  case 10:
49313
49310
  case "end":
49314
- return _context13.stop();
49311
+ return _context12.stop();
49315
49312
  }
49316
- }, _callee13, null, [[2, 7]]);
49313
+ }, _callee12, null, [[2, 7]]);
49317
49314
  })));
49318
49315
  peerConnectionEvents.on('audioLevelStuckWarning', onAudioLevelStuckWarning);
49319
- peerConnectionEvents.on('signalingStateStable', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
49316
+ peerConnectionEvents.on('signalingStateStable', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
49320
49317
  var video;
49321
- return _regenerator.default.wrap(function _callee14$(_context14) {
49322
- while (1) switch (_context14.prev = _context14.next) {
49318
+ return _regenerator.default.wrap(function _callee13$(_context13) {
49319
+ while (1) switch (_context13.prev = _context13.next) {
49323
49320
  case 0:
49324
49321
  _subscriber.trigger('signalingStateStable');
49325
49322
  video = _widgetView && _widgetView.video();
@@ -49330,9 +49327,9 @@ function SubscriberFactory(_ref2) {
49330
49327
  }
49331
49328
  case 3:
49332
49329
  case "end":
49333
- return _context14.stop();
49330
+ return _context13.stop();
49334
49331
  }
49335
- }, _callee14);
49332
+ }, _callee13);
49336
49333
  })));
49337
49334
  peerConnectionEvents.on('iceConnectionStateChange', state => onIceConnectionStateChange(state, peerConnection));
49338
49335
  peerConnectionEvents.on('iceRestartSuccess', onIceRestartSuccess);
@@ -49350,18 +49347,18 @@ function SubscriberFactory(_ref2) {
49350
49347
  _peerConnectionEvents[sourceStreamId] = peerConnectionEvents;
49351
49348
  };
49352
49349
  const _transitionRoutedToRelayed = /*#__PURE__*/function () {
49353
- var _ref26 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
49350
+ var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
49354
49351
  var mantisPeerConnection;
49355
- return _regenerator.default.wrap(function _callee15$(_context15) {
49356
- while (1) switch (_context15.prev = _context15.next) {
49352
+ return _regenerator.default.wrap(function _callee14$(_context14) {
49353
+ while (1) switch (_context14.prev = _context14.next) {
49357
49354
  case 0:
49358
49355
  logRoutedToRelayedTransition('Attempt');
49359
- _context15.next = 3;
49356
+ _context14.next = 3;
49360
49357
  return getPeerConnectionBySourceStreamId('MANTIS');
49361
49358
  case 3:
49362
- mantisPeerConnection = _context15.sent;
49359
+ mantisPeerConnection = _context14.sent;
49363
49360
  if (mantisPeerConnection != null && mantisPeerConnection.iceConnectionStateIsConnected()) {
49364
- _context15.next = 7;
49361
+ _context14.next = 7;
49365
49362
  break;
49366
49363
  }
49367
49364
  // This is for avoiding corner cases, e.g. two subscribers that join concurrently.
@@ -49375,7 +49372,7 @@ function SubscriberFactory(_ref2) {
49375
49372
  logRoutedToRelayedTransition('Failure', {
49376
49373
  reason: 'Attempted to transition to Relayed without being connected in Routed mode.'
49377
49374
  });
49378
- return _context15.abrupt("return");
49375
+ return _context14.abrupt("return");
49379
49376
  case 7:
49380
49377
  socket.subscriberCreate(_stream.id, _widgetId,
49381
49378
  // subscriberId
@@ -49387,67 +49384,67 @@ function SubscriberFactory(_ref2) {
49387
49384
  });
49388
49385
  case 8:
49389
49386
  case "end":
49390
- return _context15.stop();
49387
+ return _context14.stop();
49391
49388
  }
49392
- }, _callee15);
49389
+ }, _callee14);
49393
49390
  }));
49394
49391
  return function _transitionRoutedToRelayed() {
49395
- return _ref26.apply(this, arguments);
49392
+ return _ref25.apply(this, arguments);
49396
49393
  };
49397
49394
  }();
49398
49395
  const _transitionRelayedToRouted = /*#__PURE__*/function () {
49399
- var _ref27 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
49396
+ var _ref26 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
49400
49397
  var mantisPC;
49401
- return _regenerator.default.wrap(function _callee16$(_context16) {
49402
- while (1) switch (_context16.prev = _context16.next) {
49398
+ return _regenerator.default.wrap(function _callee15$(_context15) {
49399
+ while (1) switch (_context15.prev = _context15.next) {
49403
49400
  case 0:
49404
49401
  if (!(_properties.testNetwork || isLocalStream(_stream, _session) || _activeSourceStreamId !== 'P2P')) {
49405
- _context16.next = 2;
49402
+ _context15.next = 2;
49406
49403
  break;
49407
49404
  }
49408
- return _context16.abrupt("return");
49405
+ return _context15.abrupt("return");
49409
49406
  case 2:
49410
- onRemoteStreamAdded.remove(_ref28 => {
49411
- let sourceStreamId = _ref28.data.sourceStreamId;
49407
+ onRemoteStreamAdded.remove(_ref27 => {
49408
+ let sourceStreamId = _ref27.data.sourceStreamId;
49412
49409
  return sourceStreamId === 'P2P';
49413
49410
  });
49414
49411
  logRelayedToRoutedTransition('Attempt');
49415
49412
  if (!(_webRTCStream !== webRTCStreams.MANTIS)) {
49416
- _context16.next = 21;
49413
+ _context15.next = 21;
49417
49414
  break;
49418
49415
  }
49419
49416
  _webRTCStream = webRTCStreams.MANTIS;
49420
49417
  if (!(_videoEnabled && _videoMediaProcessorConnector)) {
49421
- _context16.next = 9;
49418
+ _context15.next = 9;
49422
49419
  break;
49423
49420
  }
49424
- _context16.next = 9;
49421
+ _context15.next = 9;
49425
49422
  return _setVideoMediaProcessorConnector();
49426
49423
  case 9:
49427
49424
  if (!(_audioConnector.audioMediaProcessorConnector && _isSubscribingToAudio)) {
49428
- _context16.next = 19;
49425
+ _context15.next = 19;
49429
49426
  break;
49430
49427
  }
49431
- _context16.prev = 10;
49432
- _context16.next = 13;
49428
+ _context15.prev = 10;
49429
+ _context15.next = 13;
49433
49430
  return _audioConnector.applyAudioConnectorOnRelayedToRoutedTransition();
49434
49431
  case 13:
49435
49432
  _logPendingSetAudioMediaProcessorConnector('Success', 'Audio connector applied on relayed to routed transition.');
49436
- _context16.next = 19;
49433
+ _context15.next = 19;
49437
49434
  break;
49438
49435
  case 16:
49439
- _context16.prev = 16;
49440
- _context16.t0 = _context16["catch"](10);
49441
- if (!_logPendingSetAudioMediaProcessorConnector('Failure', _context16.t0.message)) {
49436
+ _context15.prev = 16;
49437
+ _context15.t0 = _context15["catch"](10);
49438
+ if (!_logPendingSetAudioMediaProcessorConnector('Failure', _context15.t0.message)) {
49442
49439
  logAnalyticsEvent('applyAudioConnectorOnRelayedToRoutedTransition', 'Event', {
49443
- message: _context16.t0.message
49440
+ message: _context15.t0.message
49444
49441
  });
49445
49442
  }
49446
49443
  case 19:
49447
- _context16.next = 21;
49444
+ _context15.next = 21;
49448
49445
  return bindWebRTCStream(_webRTCStream);
49449
49446
  case 21:
49450
- _context16.next = 23;
49447
+ _context15.next = 23;
49451
49448
  return removePeerConnectionBySourceStreamId('P2P');
49452
49449
  case 23:
49453
49450
  // Keep the loading spinner hidden so that the transition looks transparent.
@@ -49459,32 +49456,32 @@ function SubscriberFactory(_ref2) {
49459
49456
  removeWebRTCStream('P2P');
49460
49457
 
49461
49458
  // Create audioLevelSampler for the current peer connection
49462
- _context16.next = 29;
49459
+ _context15.next = 29;
49463
49460
  return getPeerConnectionBySourceStreamId('MANTIS');
49464
49461
  case 29:
49465
- mantisPC = _context16.sent;
49466
- _context16.next = 32;
49462
+ mantisPC = _context15.sent;
49463
+ _context15.next = 32;
49467
49464
  return createAudioLevelSampler(mantisPC);
49468
49465
  case 32:
49469
49466
  startMonitors(_webRTCStream, mantisPC);
49470
49467
  logRelayedToRoutedTransition('Success');
49471
49468
  case 34:
49472
49469
  case "end":
49473
- return _context16.stop();
49470
+ return _context15.stop();
49474
49471
  }
49475
- }, _callee16, null, [[10, 16]]);
49472
+ }, _callee15, null, [[10, 16]]);
49476
49473
  }));
49477
49474
  return function _transitionRelayedToRouted() {
49478
- return _ref27.apply(this, arguments);
49475
+ return _ref26.apply(this, arguments);
49479
49476
  };
49480
49477
  }();
49481
- this._destroy = _ref29 => {
49478
+ this._destroy = _ref28 => {
49482
49479
  var _session10, _session11, _session11$connection, _session$sessionInfo$2, _session12, _session12$sessionInf;
49483
- let _ref29$reason = _ref29.reason,
49484
- reason = _ref29$reason === void 0 ? 'Unknown' : _ref29$reason,
49485
- quiet = _ref29.quiet,
49486
- _ref29$noStateTransit = _ref29.noStateTransition,
49487
- noStateTransition = _ref29$noStateTransit === void 0 ? false : _ref29$noStateTransit;
49480
+ let _ref28$reason = _ref28.reason,
49481
+ reason = _ref28$reason === void 0 ? 'Unknown' : _ref28$reason,
49482
+ quiet = _ref28.quiet,
49483
+ _ref28$noStateTransit = _ref28.noStateTransition,
49484
+ noStateTransition = _ref28$noStateTransit === void 0 ? false : _ref28$noStateTransit;
49488
49485
  if (_state.isDestroyed()) {
49489
49486
  return this;
49490
49487
  }
@@ -49544,10 +49541,10 @@ function SubscriberFactory(_ref2) {
49544
49541
  });
49545
49542
  };
49546
49543
  this._disconnect = function (_temp3) {
49547
- let _ref30 = _temp3 === void 0 ? {} : _temp3,
49548
- _ref30$reason = _ref30.reason,
49549
- reason = _ref30$reason === void 0 ? 'Unknown' : _ref30$reason,
49550
- noStateTransition = _ref30.noStateTransition;
49544
+ let _ref29 = _temp3 === void 0 ? {} : _temp3,
49545
+ _ref29$reason = _ref29.reason,
49546
+ reason = _ref29$reason === void 0 ? 'Unknown' : _ref29$reason,
49547
+ noStateTransition = _ref29.noStateTransition;
49551
49548
  // known reasons:
49552
49549
  // forceUnpublished (publisher stream was destroyed by forceUnpublish)
49553
49550
  // clientDisconnected (publisher unpublished)
@@ -49591,12 +49588,12 @@ function SubscriberFactory(_ref2) {
49591
49588
  });
49592
49589
  };
49593
49590
  const processOffer = /*#__PURE__*/function () {
49594
- var _ref32 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(_ref31) {
49591
+ var _ref31 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(_ref30) {
49595
49592
  var peerId, fromConnectionId, sourceStreamId, uri, send, log, logQoS;
49596
- return _regenerator.default.wrap(function _callee17$(_context17) {
49597
- while (1) switch (_context17.prev = _context17.next) {
49593
+ return _regenerator.default.wrap(function _callee16$(_context16) {
49594
+ while (1) switch (_context16.prev = _context16.next) {
49598
49595
  case 0:
49599
- peerId = _ref31.peerId, fromConnectionId = _ref31.fromConnectionId, sourceStreamId = _ref31.sourceStreamId;
49596
+ peerId = _ref30.peerId, fromConnectionId = _ref30.fromConnectionId, sourceStreamId = _ref30.sourceStreamId;
49600
49597
  uri = constructSubscriberUri({
49601
49598
  apiKey: _session.apiKey,
49602
49599
  sessionId: _session.sessionId,
@@ -49632,7 +49629,7 @@ function SubscriberFactory(_ref2) {
49632
49629
  sourceStreamId
49633
49630
  }));
49634
49631
  };
49635
- return _context17.abrupt("return", _this._setupPeerConnection({
49632
+ return _context16.abrupt("return", _this._setupPeerConnection({
49636
49633
  send,
49637
49634
  log,
49638
49635
  logQoS,
@@ -49640,12 +49637,12 @@ function SubscriberFactory(_ref2) {
49640
49637
  }));
49641
49638
  case 6:
49642
49639
  case "end":
49643
- return _context17.stop();
49640
+ return _context16.stop();
49644
49641
  }
49645
- }, _callee17);
49642
+ }, _callee16);
49646
49643
  }));
49647
49644
  return function processOffer(_x14) {
49648
- return _ref32.apply(this, arguments);
49645
+ return _ref31.apply(this, arguments);
49649
49646
  };
49650
49647
  }();
49651
49648
 
@@ -49653,31 +49650,31 @@ function SubscriberFactory(_ref2) {
49653
49650
  // we don't need to create a new one, just accept the new offer.
49654
49651
  const isRoutedToRelayedTransitionDuringMigration = (type, sourceStreamId) => _isAdaptiveEnabled && sourceStreamId === 'P2P' && type === 'offer' && _state.isMigrating();
49655
49652
  this.processMessage = /*#__PURE__*/function () {
49656
- var _ref33 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(type, fromConnectionId, message) {
49653
+ var _ref32 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(type, fromConnectionId, message) {
49657
49654
  var peerId, sourceStreamId, peerConnection, relayedStream;
49658
- return _regenerator.default.wrap(function _callee18$(_context18) {
49659
- while (1) switch (_context18.prev = _context18.next) {
49655
+ return _regenerator.default.wrap(function _callee17$(_context17) {
49656
+ while (1) switch (_context17.prev = _context17.next) {
49660
49657
  case 0:
49661
49658
  logging.debug(`OT.Subscriber.processMessage: Received ${type} message from ${fromConnectionId}`);
49662
49659
  logging.debug(message);
49663
49660
  peerId = (0, _get.default)(message, 'content.peerId');
49664
49661
  sourceStreamId = (0, _get.default)(message, 'content.sourceStreamId');
49665
- _context18.next = 6;
49662
+ _context17.next = 6;
49666
49663
  return getPeerConnectionBySourceStreamId(sourceStreamId);
49667
49664
  case 6:
49668
- peerConnection = _context18.sent;
49665
+ peerConnection = _context17.sent;
49669
49666
  if (!(type === 'offer' && (!peerConnection || _state.isMigrating() && sourceStreamId === 'MANTIS'))) {
49670
- _context18.next = 14;
49667
+ _context17.next = 14;
49671
49668
  break;
49672
49669
  }
49673
- _context18.next = 10;
49670
+ _context17.next = 10;
49674
49671
  return processOffer({
49675
49672
  peerId,
49676
49673
  fromConnectionId,
49677
49674
  sourceStreamId
49678
49675
  });
49679
49676
  case 10:
49680
- peerConnection = _context18.sent;
49677
+ peerConnection = _context17.sent;
49681
49678
  if (_shouldUseSpc && sourceStreamId === 'MANTIS') {
49682
49679
  _session._singlePeerConnectionController.addSubscriber(_this.widgetId, () => {
49683
49680
  peerConnection.processMessage('offer', message);
@@ -49686,7 +49683,7 @@ function SubscriberFactory(_ref2) {
49686
49683
  // Pace subscriber creation when MPC.
49687
49684
  _this.session._.addSubscriberToPeerConnectionsQueue(peerConnection, message);
49688
49685
  }
49689
- _context18.next = 15;
49686
+ _context17.next = 15;
49690
49687
  break;
49691
49688
  case 14:
49692
49689
  if (peerConnection) {
@@ -49704,12 +49701,12 @@ function SubscriberFactory(_ref2) {
49704
49701
  }
49705
49702
  case 15:
49706
49703
  case "end":
49707
- return _context18.stop();
49704
+ return _context17.stop();
49708
49705
  }
49709
- }, _callee18);
49706
+ }, _callee17);
49710
49707
  }));
49711
49708
  return function (_x15, _x16, _x17) {
49712
- return _ref33.apply(this, arguments);
49709
+ return _ref32.apply(this, arguments);
49713
49710
  };
49714
49711
  }();
49715
49712
  this.disableVideo = active => {
@@ -50051,22 +50048,22 @@ function SubscriberFactory(_ref2) {
50051
50048
  return this;
50052
50049
  }
50053
50050
  getAllPeerConnections().forEach( /*#__PURE__*/function () {
50054
- var _ref34 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(peerConnection) {
50055
- return _regenerator.default.wrap(function _callee19$(_context19) {
50056
- while (1) switch (_context19.prev = _context19.next) {
50051
+ var _ref33 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(peerConnection) {
50052
+ return _regenerator.default.wrap(function _callee18$(_context18) {
50053
+ while (1) switch (_context18.prev = _context18.next) {
50057
50054
  case 0:
50058
- _context19.next = 2;
50055
+ _context18.next = 2;
50059
50056
  return peerConnection;
50060
50057
  case 2:
50061
- _context19.sent.subscribeToAudio(value);
50058
+ _context18.sent.subscribeToAudio(value);
50062
50059
  case 3:
50063
50060
  case "end":
50064
- return _context19.stop();
50061
+ return _context18.stop();
50065
50062
  }
50066
- }, _callee19);
50063
+ }, _callee18);
50067
50064
  }));
50068
50065
  return function (_x18) {
50069
- return _ref34.apply(this, arguments);
50066
+ return _ref33.apply(this, arguments);
50070
50067
  };
50071
50068
  }());
50072
50069
  if (_stream && getAllPeerConnections().length !== 0) {
@@ -50493,12 +50490,12 @@ function SubscriberFactory(_ref2) {
50493
50490
  }
50494
50491
  };
50495
50492
  this._setupPeerConnection = /*#__PURE__*/function () {
50496
- var _ref36 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(_ref35) {
50493
+ var _ref35 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(_ref34) {
50497
50494
  var send, log, logQoS, sourceStreamId;
50498
- return _regenerator.default.wrap(function _callee20$(_context20) {
50499
- while (1) switch (_context20.prev = _context20.next) {
50495
+ return _regenerator.default.wrap(function _callee19$(_context19) {
50496
+ while (1) switch (_context19.prev = _context19.next) {
50500
50497
  case 0:
50501
- send = _ref35.send, log = _ref35.log, logQoS = _ref35.logQoS, sourceStreamId = _ref35.sourceStreamId;
50498
+ send = _ref34.send, log = _ref34.log, logQoS = _ref34.logQoS, sourceStreamId = _ref34.sourceStreamId;
50502
50499
  if (_properties.testNetwork) {
50503
50500
  _this.setAudioVolume(0);
50504
50501
  }
@@ -50550,15 +50547,15 @@ function SubscriberFactory(_ref2) {
50550
50547
  });
50551
50548
  });
50552
50549
  });
50553
- return _context20.abrupt("return", peerConnectionsAsync[sourceStreamId]);
50550
+ return _context19.abrupt("return", peerConnectionsAsync[sourceStreamId]);
50554
50551
  case 7:
50555
50552
  case "end":
50556
- return _context20.stop();
50553
+ return _context19.stop();
50557
50554
  }
50558
- }, _callee20);
50555
+ }, _callee19);
50559
50556
  }));
50560
50557
  return function (_x19) {
50561
- return _ref36.apply(this, arguments);
50558
+ return _ref35.apply(this, arguments);
50562
50559
  };
50563
50560
  }();
50564
50561
 
@@ -50615,60 +50612,60 @@ function SubscriberFactory(_ref2) {
50615
50612
  this.on('styleValueChanged', updateChromeForStyleChange, this);
50616
50613
  this._ = {
50617
50614
  getDataChannel(label, options, completion) {
50618
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
50619
- return _regenerator.default.wrap(function _callee21$(_context21) {
50620
- while (1) switch (_context21.prev = _context21.next) {
50615
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
50616
+ return _regenerator.default.wrap(function _callee20$(_context20) {
50617
+ while (1) switch (_context20.prev = _context20.next) {
50621
50618
  case 0:
50622
50619
  if (getCurrentPeerConnection()) {
50623
- _context21.next = 3;
50620
+ _context20.next = 3;
50624
50621
  break;
50625
50622
  }
50626
50623
  completion(new OTHelpers.Error('Cannot create a DataChannel before there is a publisher connection.'));
50627
- return _context21.abrupt("return");
50624
+ return _context20.abrupt("return");
50628
50625
  case 3:
50629
- _context21.next = 5;
50626
+ _context20.next = 5;
50630
50627
  return getCurrentPeerConnection();
50631
50628
  case 5:
50632
- _context21.sent.getDataChannel(label, options, completion);
50629
+ _context20.sent.getDataChannel(label, options, completion);
50633
50630
  case 6:
50634
50631
  case "end":
50635
- return _context21.stop();
50632
+ return _context20.stop();
50636
50633
  }
50637
- }, _callee21);
50634
+ }, _callee20);
50638
50635
  }))();
50639
50636
  },
50640
50637
  iceRestart(reason, forcedRestart) {
50641
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
50638
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
50642
50639
  var peerConnection;
50643
- return _regenerator.default.wrap(function _callee22$(_context22) {
50644
- while (1) switch (_context22.prev = _context22.next) {
50640
+ return _regenerator.default.wrap(function _callee21$(_context21) {
50641
+ while (1) switch (_context21.prev = _context21.next) {
50645
50642
  case 0:
50646
50643
  if (forcedRestart === void 0) {
50647
50644
  forcedRestart = false;
50648
50645
  }
50649
50646
  if (_session._.isSocketConnected()) {
50650
- _context22.next = 4;
50647
+ _context21.next = 4;
50651
50648
  break;
50652
50649
  }
50653
50650
  logging.debug('Subscriber: Skipping ice restart, websocket is not connected');
50654
- return _context22.abrupt("return");
50651
+ return _context21.abrupt("return");
50655
50652
  case 4:
50656
50653
  if (!_session.sessionInfo.p2pEnabled) {
50657
- _context22.next = 6;
50654
+ _context21.next = 6;
50658
50655
  break;
50659
50656
  }
50660
- return _context22.abrupt("return");
50657
+ return _context21.abrupt("return");
50661
50658
  case 6:
50662
- _context22.next = 8;
50659
+ _context21.next = 8;
50663
50660
  return getPeerConnectionBySourceStreamId('MANTIS');
50664
50661
  case 8:
50665
- peerConnection = _context22.sent;
50662
+ peerConnection = _context21.sent;
50666
50663
  if (peerConnection) {
50667
- _context22.next = 12;
50664
+ _context21.next = 12;
50668
50665
  break;
50669
50666
  }
50670
50667
  logging.debug('Subscriber: Skipping ice restart, we have no peer connection');
50671
- return _context22.abrupt("return");
50668
+ return _context21.abrupt("return");
50672
50669
  case 12:
50673
50670
  logResubscribe('Attempt', {
50674
50671
  reason
@@ -50680,42 +50677,42 @@ function SubscriberFactory(_ref2) {
50680
50677
  }
50681
50678
  case 16:
50682
50679
  case "end":
50683
- return _context22.stop();
50680
+ return _context21.stop();
50684
50681
  }
50685
- }, _callee22);
50682
+ }, _callee21);
50686
50683
  }))();
50687
50684
  },
50688
50685
  unblockAudio: () => _widgetView && _widgetView.unblockAudio(),
50689
50686
  webRtcStream: () => _webRTCStream,
50690
50687
  setIceConfig: function () {
50691
- var _setIceConfig = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(iceConfig) {
50692
- return _regenerator.default.wrap(function _callee24$(_context24) {
50693
- while (1) switch (_context24.prev = _context24.next) {
50688
+ var _setIceConfig = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(iceConfig) {
50689
+ return _regenerator.default.wrap(function _callee23$(_context23) {
50690
+ while (1) switch (_context23.prev = _context23.next) {
50694
50691
  case 0:
50695
50692
  getAllPeerConnections().forEach( /*#__PURE__*/function () {
50696
- var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(pc) {
50697
- return _regenerator.default.wrap(function _callee23$(_context23) {
50698
- while (1) switch (_context23.prev = _context23.next) {
50693
+ var _ref36 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(pc) {
50694
+ return _regenerator.default.wrap(function _callee22$(_context22) {
50695
+ while (1) switch (_context22.prev = _context22.next) {
50699
50696
  case 0:
50700
- _context23.next = 2;
50697
+ _context22.next = 2;
50701
50698
  return pc;
50702
50699
  case 2:
50703
- return _context23.abrupt("return", _context23.sent.setIceConfig(iceConfig));
50700
+ return _context22.abrupt("return", _context22.sent.setIceConfig(iceConfig));
50704
50701
  case 3:
50705
50702
  case "end":
50706
- return _context23.stop();
50703
+ return _context22.stop();
50707
50704
  }
50708
- }, _callee23);
50705
+ }, _callee22);
50709
50706
  }));
50710
50707
  return function (_x21) {
50711
- return _ref37.apply(this, arguments);
50708
+ return _ref36.apply(this, arguments);
50712
50709
  };
50713
50710
  }());
50714
50711
  case 1:
50715
50712
  case "end":
50716
- return _context24.stop();
50713
+ return _context23.stop();
50717
50714
  }
50718
- }, _callee24);
50715
+ }, _callee23);
50719
50716
  }));
50720
50717
  function setIceConfig(_x20) {
50721
50718
  return _setIceConfig.apply(this, arguments);
@@ -50736,15 +50733,15 @@ function SubscriberFactory(_ref2) {
50736
50733
  amrState.startTransitionToRouted(_transitionRelayedToRouted);
50737
50734
  },
50738
50735
  startMigration() {
50739
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
50740
- return _regenerator.default.wrap(function _callee25$(_context25) {
50741
- while (1) switch (_context25.prev = _context25.next) {
50736
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
50737
+ return _regenerator.default.wrap(function _callee24$(_context24) {
50738
+ while (1) switch (_context24.prev = _context24.next) {
50742
50739
  case 0:
50743
50740
  if (!_state.isMigrating()) {
50744
- _context25.next = 2;
50741
+ _context24.next = 2;
50745
50742
  break;
50746
50743
  }
50747
- return _context25.abrupt("return");
50744
+ return _context24.abrupt("return");
50748
50745
  case 2:
50749
50746
  _state.set('Migrating');
50750
50747
  logAnalyticsEvent('SessionMigration', 'Attempt');
@@ -50754,53 +50751,53 @@ function SubscriberFactory(_ref2) {
50754
50751
  socket = _session._.getSocket();
50755
50752
  socket.on('signalingNetworkQualityScoreChanged', networkConditionChecker.checkNetworkConditionChange);
50756
50753
  if (!_session.sessionInfo.p2pEnabled) {
50757
- _context25.next = 12;
50754
+ _context24.next = 12;
50758
50755
  break;
50759
50756
  }
50760
50757
  subscriberCreate('P2P');
50761
- _context25.next = 16;
50758
+ _context24.next = 16;
50762
50759
  break;
50763
50760
  case 12:
50764
- _context25.next = 14;
50761
+ _context24.next = 14;
50765
50762
  return getPeerConnectionBySourceStreamId('MANTIS');
50766
50763
  case 14:
50767
- _previousPeerConnection = _context25.sent;
50764
+ _previousPeerConnection = _context24.sent;
50768
50765
  subscriberCreate('MANTIS');
50769
50766
  case 16:
50770
50767
  case "end":
50771
- return _context25.stop();
50768
+ return _context24.stop();
50772
50769
  }
50773
- }, _callee25);
50770
+ }, _callee24);
50774
50771
  }))();
50775
50772
  },
50776
50773
  finishMigration() {
50777
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
50774
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
50778
50775
  var destroyPeerConnection, _getPeerConnectionByS;
50779
- return _regenerator.default.wrap(function _callee27$(_context27) {
50780
- while (1) switch (_context27.prev = _context27.next) {
50776
+ return _regenerator.default.wrap(function _callee26$(_context26) {
50777
+ while (1) switch (_context26.prev = _context26.next) {
50781
50778
  case 0:
50782
50779
  destroyPeerConnection = /*#__PURE__*/function () {
50783
- var _ref38 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26(pc, sourceStreamId) {
50784
- return _regenerator.default.wrap(function _callee26$(_context26) {
50785
- while (1) switch (_context26.prev = _context26.next) {
50780
+ var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(pc, sourceStreamId) {
50781
+ return _regenerator.default.wrap(function _callee25$(_context25) {
50782
+ while (1) switch (_context25.prev = _context25.next) {
50786
50783
  case 0:
50787
50784
  if (!pc) {
50788
- _context26.next = 5;
50785
+ _context25.next = 5;
50789
50786
  break;
50790
50787
  }
50791
- _context26.next = 3;
50788
+ _context25.next = 3;
50792
50789
  return _subscriberStatsHelper.removePeerConnection(pc);
50793
50790
  case 3:
50794
50791
  pc.close();
50795
50792
  delete peerConnectionsAsync[sourceStreamId];
50796
50793
  case 5:
50797
50794
  case "end":
50798
- return _context26.stop();
50795
+ return _context25.stop();
50799
50796
  }
50800
- }, _callee26);
50797
+ }, _callee25);
50801
50798
  }));
50802
50799
  return function destroyPeerConnection(_x22, _x23) {
50803
- return _ref38.apply(this, arguments);
50800
+ return _ref37.apply(this, arguments);
50804
50801
  };
50805
50802
  }(); // Clear previous PC
50806
50803
  // We don't pass 'MANTIS' because we don't want to delete the new MANTIS peer connection
@@ -50816,9 +50813,9 @@ function SubscriberFactory(_ref2) {
50816
50813
  logAnalyticsEvent('SessionMigration', 'Success');
50817
50814
  case 7:
50818
50815
  case "end":
50819
- return _context27.stop();
50816
+ return _context26.stop();
50820
50817
  }
50821
- }, _callee27);
50818
+ }, _callee26);
50822
50819
  }))();
50823
50820
  },
50824
50821
  setSinkId(deviceId) {
@@ -50965,10 +50962,10 @@ function SubscriberFactory(_ref2) {
50965
50962
  * @memberOf Subscriber
50966
50963
  */
50967
50964
  this.subscribeToCaptions = /*#__PURE__*/function () {
50968
- var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(value) {
50965
+ var _ref38 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(value) {
50969
50966
  var active, attributes;
50970
- return _regenerator.default.wrap(function _callee28$(_context28) {
50971
- while (1) switch (_context28.prev = _context28.next) {
50967
+ return _regenerator.default.wrap(function _callee27$(_context27) {
50968
+ while (1) switch (_context27.prev = _context27.next) {
50972
50969
  case 0:
50973
50970
  active = (0, _castToBoolean.default)(value, true);
50974
50971
  attributes = {
@@ -50984,12 +50981,12 @@ function SubscriberFactory(_ref2) {
50984
50981
  });
50985
50982
  case 6:
50986
50983
  case "end":
50987
- return _context28.stop();
50984
+ return _context27.stop();
50988
50985
  }
50989
- }, _callee28);
50986
+ }, _callee27);
50990
50987
  }));
50991
50988
  return function (_x24) {
50992
- return _ref39.apply(this, arguments);
50989
+ return _ref38.apply(this, arguments);
50993
50990
  };
50994
50991
  }();
50995
50992
 
@@ -51003,13 +51000,13 @@ function SubscriberFactory(_ref2) {
51003
51000
  * @memberOf Subscriber
51004
51001
  */
51005
51002
  this.setCaptionsTranslationLanguage = /*#__PURE__*/function () {
51006
- var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(langCode) {
51003
+ var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(langCode) {
51007
51004
  var message, language, attributes;
51008
- return _regenerator.default.wrap(function _callee29$(_context29) {
51009
- while (1) switch (_context29.prev = _context29.next) {
51005
+ return _regenerator.default.wrap(function _callee28$(_context28) {
51006
+ while (1) switch (_context28.prev = _context28.next) {
51010
51007
  case 0:
51011
51008
  if (!(langCode !== null && !(0, _languageCodes.validateLanguageCode)(langCode))) {
51012
- _context29.next = 4;
51009
+ _context28.next = 4;
51013
51010
  break;
51014
51011
  }
51015
51012
  message = `Invalid captions language code ${langCode}`;
@@ -51027,12 +51024,12 @@ function SubscriberFactory(_ref2) {
51027
51024
  });
51028
51025
  case 9:
51029
51026
  case "end":
51030
- return _context29.stop();
51027
+ return _context28.stop();
51031
51028
  }
51032
- }, _callee29);
51029
+ }, _callee28);
51033
51030
  }));
51034
51031
  return function (_x25) {
51035
- return _ref40.apply(this, arguments);
51032
+ return _ref39.apply(this, arguments);
51036
51033
  };
51037
51034
  }();
51038
51035
 
@@ -51196,27 +51193,27 @@ function SubscriberFactory(_ref2) {
51196
51193
  * If there is an error, the promise is rejected and no connector is set.
51197
51194
  */
51198
51195
  this.setVideoMediaProcessorConnector = /*#__PURE__*/function () {
51199
- var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(mediaProcessorConnector) {
51196
+ var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(mediaProcessorConnector) {
51200
51197
  var isTransitioning;
51201
- return _regenerator.default.wrap(function _callee30$(_context30) {
51202
- while (1) switch (_context30.prev = _context30.next) {
51198
+ return _regenerator.default.wrap(function _callee29$(_context29) {
51199
+ while (1) switch (_context29.prev = _context29.next) {
51203
51200
  case 0:
51204
51201
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Attempt', {
51205
51202
  message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
51206
51203
  });
51207
51204
  _clearConnector();
51208
51205
  if (mediaProcessorConnector) {
51209
- _context30.next = 6;
51206
+ _context29.next = 6;
51210
51207
  break;
51211
51208
  }
51212
51209
  _resetVideoStream();
51213
51210
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success', {
51214
51211
  message: 'clearing the connector'
51215
51212
  });
51216
- return _context30.abrupt("return");
51213
+ return _context29.abrupt("return");
51217
51214
  case 6:
51218
51215
  if (_mediaProcessorConnector.default.isValidConnector(mediaProcessorConnector)) {
51219
- _context30.next = 9;
51216
+ _context29.next = 9;
51220
51217
  break;
51221
51218
  }
51222
51219
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
@@ -51229,49 +51226,49 @@ function SubscriberFactory(_ref2) {
51229
51226
  // this is needed to avoid double filtering during AMR transitions
51230
51227
  isTransitioning = amrState.isTransitioning();
51231
51228
  if (!(isTransitioning || !_videoEnabled)) {
51232
- _context30.next = 14;
51229
+ _context29.next = 14;
51233
51230
  break;
51234
51231
  }
51235
51232
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Pending', {
51236
51233
  isTransitioning,
51237
51234
  isVideoEnabled: _videoEnabled
51238
51235
  });
51239
- return _context30.abrupt("return");
51236
+ return _context29.abrupt("return");
51240
51237
  case 14:
51241
51238
  _resetVideoStream();
51242
- _context30.prev = 15;
51243
- _context30.next = 18;
51239
+ _context29.prev = 15;
51240
+ _context29.next = 18;
51244
51241
  return _setVideoMediaProcessorConnector();
51245
51242
  case 18:
51246
- _context30.next = 24;
51243
+ _context29.next = 24;
51247
51244
  break;
51248
51245
  case 20:
51249
- _context30.prev = 20;
51250
- _context30.t0 = _context30["catch"](15);
51246
+ _context29.prev = 20;
51247
+ _context29.t0 = _context29["catch"](15);
51251
51248
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
51252
- message: _context30.t0.message
51249
+ message: _context29.t0.message
51253
51250
  });
51254
- throw _context30.t0;
51251
+ throw _context29.t0;
51255
51252
  case 24:
51256
51253
  case "end":
51257
- return _context30.stop();
51254
+ return _context29.stop();
51258
51255
  }
51259
- }, _callee30, null, [[15, 20]]);
51256
+ }, _callee29, null, [[15, 20]]);
51260
51257
  }));
51261
51258
  return function (_x26) {
51262
- return _ref41.apply(this, arguments);
51259
+ return _ref40.apply(this, arguments);
51263
51260
  };
51264
51261
  }();
51265
51262
  const _setVideoMediaProcessorConnector = /*#__PURE__*/function () {
51266
- var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
51263
+ var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
51267
51264
  var _webRTCStream$getVide, message, filteredVideoTrack;
51268
- return _regenerator.default.wrap(function _callee31$(_context31) {
51269
- while (1) switch (_context31.prev = _context31.next) {
51265
+ return _regenerator.default.wrap(function _callee30$(_context30) {
51266
+ while (1) switch (_context30.prev = _context30.next) {
51270
51267
  case 0:
51271
51268
  _webRTCStream$getVide = _webRTCStream.getVideoTracks();
51272
51269
  _originalVideoTrack = _webRTCStream$getVide[0];
51273
51270
  if (_originalVideoTrack) {
51274
- _context31.next = 7;
51271
+ _context30.next = 7;
51275
51272
  break;
51276
51273
  }
51277
51274
  message = 'Connector not set as no video is present.';
@@ -51281,31 +51278,31 @@ function SubscriberFactory(_ref2) {
51281
51278
  message
51282
51279
  });
51283
51280
  case 7:
51284
- _context31.prev = 7;
51285
- _context31.next = 10;
51281
+ _context30.prev = 7;
51282
+ _context30.next = 10;
51286
51283
  return _videoMediaProcessorConnector.setTrack(_originalVideoTrack);
51287
51284
  case 10:
51288
- filteredVideoTrack = _context31.sent;
51285
+ filteredVideoTrack = _context30.sent;
51289
51286
  updateTrackOnStream(_webRTCStream, _originalVideoTrack, filteredVideoTrack);
51290
51287
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success');
51291
- _context31.next = 20;
51288
+ _context30.next = 20;
51292
51289
  break;
51293
51290
  case 15:
51294
- _context31.prev = 15;
51295
- _context31.t0 = _context31["catch"](7);
51291
+ _context30.prev = 15;
51292
+ _context30.t0 = _context30["catch"](7);
51296
51293
  _videoMediaProcessorConnector = null;
51297
- logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context31.t0}`);
51294
+ logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context30.t0}`);
51298
51295
  throw Error('setVideoMediaProcessorConnector', 'Failure', {
51299
- message: _context31.t0.message
51296
+ message: _context30.t0.message
51300
51297
  });
51301
51298
  case 20:
51302
51299
  case "end":
51303
- return _context31.stop();
51300
+ return _context30.stop();
51304
51301
  }
51305
- }, _callee31, null, [[7, 15]]);
51302
+ }, _callee30, null, [[7, 15]]);
51306
51303
  }));
51307
51304
  return function _setVideoMediaProcessorConnector() {
51308
- return _ref42.apply(this, arguments);
51305
+ return _ref41.apply(this, arguments);
51309
51306
  };
51310
51307
  }();
51311
51308
  const _resetVideoStream = () => {
@@ -51381,27 +51378,27 @@ function SubscriberFactory(_ref2) {
51381
51378
  * If there is an error, the promise is rejected and no connector is set.
51382
51379
  */
51383
51380
  this.setAudioMediaProcessorConnector = /*#__PURE__*/function () {
51384
- var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(mediaProcessorConnector) {
51381
+ var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31(mediaProcessorConnector) {
51385
51382
  var message, isTransitioning;
51386
- return _regenerator.default.wrap(function _callee32$(_context32) {
51387
- while (1) switch (_context32.prev = _context32.next) {
51383
+ return _regenerator.default.wrap(function _callee31$(_context31) {
51384
+ while (1) switch (_context31.prev = _context31.next) {
51388
51385
  case 0:
51389
51386
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Attempt', {
51390
51387
  message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
51391
51388
  });
51392
51389
  _audioConnector == null ? void 0 : _audioConnector.clearAudioMediaProcessorConnector(_activeSourceStreamId);
51393
51390
  if (mediaProcessorConnector) {
51394
- _context32.next = 6;
51391
+ _context31.next = 6;
51395
51392
  break;
51396
51393
  }
51397
51394
  _audioConnector == null ? void 0 : _audioConnector.resetAudioStreamAndTrack();
51398
51395
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Success', {
51399
51396
  message: 'clearing the connector'
51400
51397
  });
51401
- return _context32.abrupt("return");
51398
+ return _context31.abrupt("return");
51402
51399
  case 6:
51403
51400
  if (_mediaProcessorConnector.default.isValidConnector(mediaProcessorConnector)) {
51404
- _context32.next = 11;
51401
+ _context31.next = 11;
51405
51402
  break;
51406
51403
  }
51407
51404
  message = 'Tried to set invalid MediaProcessorConnector';
@@ -51415,7 +51412,7 @@ function SubscriberFactory(_ref2) {
51415
51412
  _pendingSetAudioMediaProcessorConnector = true;
51416
51413
  isTransitioning = amrState.isTransitioning();
51417
51414
  if (!(isTransitioning || !_isSubscribingToAudio)) {
51418
- _context32.next = 17;
51415
+ _context31.next = 17;
51419
51416
  break;
51420
51417
  }
51421
51418
  // After the transition finishes, or when re-subscribing to audio, we will apply the
@@ -51424,52 +51421,52 @@ function SubscriberFactory(_ref2) {
51424
51421
  isTransitioning,
51425
51422
  subscribingToAudio: _isSubscribingToAudio
51426
51423
  });
51427
- return _context32.abrupt("return");
51424
+ return _context31.abrupt("return");
51428
51425
  case 17:
51429
51426
  _audioConnector.resetAudioStreamAndTrack();
51430
51427
  _setAudioMediaProcessorConnector();
51431
51428
  case 19:
51432
51429
  case "end":
51433
- return _context32.stop();
51430
+ return _context31.stop();
51434
51431
  }
51435
- }, _callee32);
51432
+ }, _callee31);
51436
51433
  }));
51437
51434
  return function (_x27) {
51438
- return _ref43.apply(this, arguments);
51435
+ return _ref42.apply(this, arguments);
51439
51436
  };
51440
51437
  }();
51441
51438
  const _setAudioMediaProcessorConnector = /*#__PURE__*/function () {
51442
- var _ref44 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33() {
51443
- return _regenerator.default.wrap(function _callee33$(_context33) {
51444
- while (1) switch (_context33.prev = _context33.next) {
51439
+ var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
51440
+ return _regenerator.default.wrap(function _callee32$(_context32) {
51441
+ while (1) switch (_context32.prev = _context32.next) {
51445
51442
  case 0:
51446
51443
  if (webRTCStreams[_activeSourceStreamId]) {
51447
- _context33.next = 2;
51444
+ _context32.next = 2;
51448
51445
  break;
51449
51446
  }
51450
- return _context33.abrupt("return");
51447
+ return _context32.abrupt("return");
51451
51448
  case 2:
51452
- _context33.prev = 2;
51453
- _context33.next = 5;
51449
+ _context32.prev = 2;
51450
+ _context32.next = 5;
51454
51451
  return _audioConnector == null ? void 0 : _audioConnector.setAudioMediaProcessorConnector(_activeSourceStreamId);
51455
51452
  case 5:
51456
51453
  _logPendingSetAudioMediaProcessorConnector('Success');
51457
- _context33.next = 13;
51454
+ _context32.next = 13;
51458
51455
  break;
51459
51456
  case 8:
51460
- _context33.prev = 8;
51461
- _context33.t0 = _context33["catch"](2);
51462
- logging.error(`setAudioMediaProcessorConnector: ${_context33.t0.message}`);
51463
- _logPendingSetAudioMediaProcessorConnector('Failure', _context33.t0.message);
51464
- throw _context33.t0;
51457
+ _context32.prev = 8;
51458
+ _context32.t0 = _context32["catch"](2);
51459
+ logging.error(`setAudioMediaProcessorConnector: ${_context32.t0.message}`);
51460
+ _logPendingSetAudioMediaProcessorConnector('Failure', _context32.t0.message);
51461
+ throw _context32.t0;
51465
51462
  case 13:
51466
51463
  case "end":
51467
- return _context33.stop();
51464
+ return _context32.stop();
51468
51465
  }
51469
- }, _callee33, null, [[2, 8]]);
51466
+ }, _callee32, null, [[2, 8]]);
51470
51467
  }));
51471
51468
  return function _setAudioMediaProcessorConnector() {
51472
- return _ref44.apply(this, arguments);
51469
+ return _ref43.apply(this, arguments);
51473
51470
  };
51474
51471
  }();
51475
51472
  const _logPendingSetAudioMediaProcessorConnector = function _logPendingSetAudioMediaProcessorConnector(variation, message) {