@opentok/client 2.36.0-alpha.15 → 2.36.0-alpha.17

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.
@@ -488,6 +488,8 @@ declare namespace OT {
488
488
  promise: (value: boolean) => Promise<void>;
489
489
  }
490
490
  publishCaptions(value: boolean): Promise<void>;
491
+ setCaptionsInputLanguage(langCode: CaptionsLanguageCode | null): Promise<void>;
492
+ getCaptionsInputLanguage(): CaptionsLanguageCode | null;
491
493
  cycleVideo(): Promise<{ deviceId: string }>;
492
494
  setAudioSource(audioSource:string | MediaStreamTrack): Promise<undefined>;
493
495
  getAudioSource(): MediaStreamTrack;
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.36.0 895d7e807
2
+ * @license OpenTok.js 2.36.0 738cef185
3
3
  *
4
4
  * Copyright (c) 2010-2026 TokBox, Inc.
5
5
  * Subject to the applicable Software Development Kit (SDK) License Agreement:
6
6
  * https://www.vonage.com/legal/communications-apis/terms-of-use/
7
7
  *
8
- * Date: Wed, 29 Jul 2026 10:30:07 GMT
8
+ * Date: Thu, 30 Jul 2026 10:15:47 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -27523,6 +27523,12 @@ function RaptorSocketFactory(deps) {
27523
27523
  }
27524
27524
  this.publish(RaptorMessage.streamChannels.update(_apiKey, _sessionId, streamId, channelId, attributes), {}, true, completion);
27525
27525
  };
27526
+ this.publisherChannelUpdate = function (streamId, channelId, attributes, completion) {
27527
+ if (completion === void 0) {
27528
+ completion = () => {};
27529
+ }
27530
+ this.publish(RaptorMessage.streamChannels.update(_apiKey, _sessionId, streamId, channelId, attributes), {}, true, completion);
27531
+ };
27526
27532
  this.streamChannelSendData = function (streamId, channelId, data, completion) {
27527
27533
  this.publish(RaptorMessage.streamChannels.data(_apiKey, _sessionId, streamId, channelId, data), {}, true, completion);
27528
27534
  };
@@ -39866,7 +39872,7 @@ function staticConfigFactory(_temp) {
39866
39872
  _ref$axios = _ref.axios,
39867
39873
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
39868
39874
  _ref$properties = _ref.properties,
39869
- properties = _ref$properties === void 0 ? {"version":"v2.36.0","buildHash":"895d7e807","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;
39875
+ properties = _ref$properties === void 0 ? {"version":"v2.36.0","buildHash":"738cef185","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;
39870
39876
  /** @type builtInConfig */
39871
39877
  const builtInConfig = (0, _cloneDeep.default)(properties);
39872
39878
  /**
@@ -41455,7 +41461,7 @@ var _promiseDelay = _interopRequireDefault(__webpack_require__(66395));
41455
41461
  var _env = _interopRequireDefault(__webpack_require__(28628));
41456
41462
  var _networkStatus = _interopRequireDefault(__webpack_require__(83655));
41457
41463
  var _deviceHelpers = _interopRequireDefault(__webpack_require__(78092));
41458
- var _blockCallsUntilComplete = _interopRequireDefault(__webpack_require__(86266));
41464
+ var _blockCallsUntilComplete = _interopRequireWildcard(__webpack_require__(86266));
41459
41465
  var _interval_runner = _interopRequireDefault(__webpack_require__(55605));
41460
41466
  var _exception_codes = _interopRequireDefault(__webpack_require__(90529));
41461
41467
  var _ot_error_class = _interopRequireDefault(__webpack_require__(4960));
@@ -41516,6 +41522,7 @@ var _getSpatialResolution = _interopRequireDefault(__webpack_require__(39841));
41516
41522
  var _VideoBitratePreset = _interopRequireDefault(__webpack_require__(51831));
41517
41523
  var _videoConstraints = _interopRequireDefault(__webpack_require__(49474));
41518
41524
  var _networkConditionConstants = __webpack_require__(46179);
41525
+ var _languageCodes = __webpack_require__(38891);
41519
41526
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41520
41527
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41521
41528
  /* eslint-disable global-require, func-names, max-len */
@@ -41717,6 +41724,9 @@ function PublisherFactory(_ref) {
41717
41724
  let networkCondition = _networkConditionConstants.NETWORK_CONDITION.GOOD;
41718
41725
  let getStatsCalled = false;
41719
41726
  let filteredVideoTrackId;
41727
+ let _captionsInputLanguage = null;
41728
+ let _pendingSetCaptionsInputLanguageArgs;
41729
+ let _setCaptionsInputLanguageInFlight = false;
41720
41730
 
41721
41731
  /** @type IntervalRunnerDefault | undefined */
41722
41732
  let connectivityAttemptPinger;
@@ -44175,6 +44185,102 @@ function PublisherFactory(_ref) {
44175
44185
  streamReadyJobs.add(() => finishPublishCaptions(value, resolve, reject));
44176
44186
  }
44177
44187
  });
44188
+ const sendCaptionsInputLanguageUpdate = () => {
44189
+ var _this$session22, _this$stream;
44190
+ _setCaptionsInputLanguageInFlight = true;
44191
+ const _pendingSetCaptionsIn = _pendingSetCaptionsInputLanguageArgs,
44192
+ langCode = _pendingSetCaptionsIn.langCode,
44193
+ resolve = _pendingSetCaptionsIn.resolve,
44194
+ reject = _pendingSetCaptionsIn.reject;
44195
+ _pendingSetCaptionsInputLanguageArgs = null;
44196
+ const attributes = {
44197
+ category: langCode === null ? '' : langCode
44198
+ };
44199
+ const socket = (_this$session22 = this.session) == null ? void 0 : _this$session22._.getSocket();
44200
+ const streamId = ((_this$stream = this.stream) == null ? void 0 : _this$stream.id) || this.streamId;
44201
+ socket.publisherChannelUpdate(streamId, 'caption1', attributes, err => {
44202
+ _setCaptionsInputLanguageInFlight = false;
44203
+ if (err) {
44204
+ reject(err);
44205
+ } else {
44206
+ _captionsInputLanguage = langCode;
44207
+ logAnalyticsEvent('setCaptionsInputLanguage', 'Event', {
44208
+ captionsInputLanguage: langCode
44209
+ });
44210
+ resolve();
44211
+ }
44212
+ // If there's a pending call queued while we were in-flight, process it now
44213
+ if (_pendingSetCaptionsInputLanguageArgs) {
44214
+ if (_pendingSetCaptionsInputLanguageArgs.langCode === _captionsInputLanguage) {
44215
+ // Same language as what just succeeded, resolve without another network call
44216
+ _pendingSetCaptionsInputLanguageArgs.resolve();
44217
+ _pendingSetCaptionsInputLanguageArgs = null;
44218
+ } else {
44219
+ sendCaptionsInputLanguageUpdate();
44220
+ }
44221
+ }
44222
+ });
44223
+ };
44224
+
44225
+ /**
44226
+ * Sets the language used for captions input on the publisher. The language code
44227
+ * is sent to the captions service to indicate the spoken language of the audio.
44228
+ * Pass <code>null</code> to clear the captions input language.
44229
+ *
44230
+ * <p>
44231
+ * If the publisher is not yet publishing to a session, the language will be applied
44232
+ * once publishing begins.
44233
+ *
44234
+ * @param {String|null} langCode A BCP-47 language code (for example, <code>"en-US"</code>,
44235
+ * <code>"es"</code>), or <code>null</code> to clear the captions input language.
44236
+ *
44237
+ * @see <a href="#getCaptionsInputLanguage">Publisher.getCaptionsInputLanguage()</a>
44238
+ * @see <a href="#publishCaptions">Publisher.publishCaptions()</a>
44239
+ * @returns {Promise<void>} A promise that resolves when the language has been set,
44240
+ * or rejects with an error if the language code is invalid or the operation fails.
44241
+ * @method #setCaptionsInputLanguage
44242
+ * @memberOf Publisher
44243
+ */
44244
+ this.setCaptionsInputLanguage = langCode => new Promise((resolve, reject) => {
44245
+ if (langCode !== null && !(0, _languageCodes.validateLanguageCode)(langCode)) {
44246
+ const message = `Invalid captions input language ${langCode}`;
44247
+ logging.warn(`setCaptionsInputLanguage: ${message}`);
44248
+ reject(otError(Errors.INVALID_PARAMETER, new Error(`setCaptionsInputLanguage: ${message}`)));
44249
+ return;
44250
+ }
44251
+ if (_pendingSetCaptionsInputLanguageArgs) {
44252
+ streamReadyJobs.remove(sendCaptionsInputLanguageUpdate);
44253
+ _pendingSetCaptionsInputLanguageArgs.reject(new Error('setCaptionsInputLanguage: call superseded by a newer setCaptionsInputLanguage call'));
44254
+ _pendingSetCaptionsInputLanguageArgs = undefined;
44255
+ }
44256
+ if (langCode === _captionsInputLanguage && !_setCaptionsInputLanguageInFlight) {
44257
+ resolve();
44258
+ return;
44259
+ }
44260
+ _pendingSetCaptionsInputLanguageArgs = {
44261
+ langCode,
44262
+ resolve,
44263
+ reject
44264
+ };
44265
+ if (this.stream) {
44266
+ if (!_setCaptionsInputLanguageInFlight) {
44267
+ sendCaptionsInputLanguageUpdate();
44268
+ }
44269
+ } else {
44270
+ streamReadyJobs.add(sendCaptionsInputLanguageUpdate);
44271
+ }
44272
+ });
44273
+
44274
+ /**
44275
+ * Returns the current captions input language set for the publisher.
44276
+ *
44277
+ * @return {String|null} The BCP-47 language code (for example, <code>"en-US"</code>)
44278
+ * currently set for captions input, or <code>null</code> if no language has been set.
44279
+ * @see <a href="#setCaptionsInputLanguage">Publisher.setCaptionsInputLanguage()</a>
44280
+ * @method #getCaptionsInputLanguage
44281
+ * @memberOf Publisher
44282
+ */
44283
+ this.getCaptionsInputLanguage = () => _captionsInputLanguage;
44178
44284
  let updateVideoSenderParametersSentinel;
44179
44285
 
44180
44286
  // keeps track of if the client has called mediaStreamTrack.stop(), so that we don't restart
@@ -44317,45 +44423,58 @@ function PublisherFactory(_ref) {
44317
44423
  let currentDeviceId;
44318
44424
  let currentVideoFilter;
44319
44425
  let currentAudioFilter;
44320
- this._toggleVideo = (0, _blockCallsUntilComplete.default)( /*#__PURE__*/function () {
44426
+ this._toggleVideo = (0, _blockCallsUntilComplete.queueLatestCall)( /*#__PURE__*/function () {
44321
44427
  var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(shouldHaveVideo, videoDimensions) {
44322
44428
  var _vidDevices$find;
44323
44429
  var vidDevices, oldTrack, oldTrackDeviceId, newTrack, videoFilter, originalVideoTrack, _originalVideoTrack;
44324
44430
  return _regenerator.default.wrap(function _callee28$(_context28) {
44325
44431
  while (1) switch (_context28.prev = _context28.next) {
44326
44432
  case 0:
44433
+ if (properties.publisherAudioFallbackEnabled || getStatsCalled || networkConditionChangedListenersCount > 0) {
44434
+ resetCongestionLevelEstimationOnPeerConnection(shouldHaveVideo);
44435
+ if (shouldHaveVideo === false && audioFallbackCoordinator && audioFallbackCoordinator.getState() !== _audioFallbackVideoStates.default.ACTIVE_VIDEO) {
44436
+ // We will reset audio fallback state now, but rumor doesn't expect the message until we re-enable the video
44437
+ // so we flag the message as pending
44438
+ pendingRumorAudioFallbackMessage = true;
44439
+ resetAudioFallbackState();
44440
+ }
44441
+ }
44442
+
44443
+ // we don't need to worry about the camera if we're screensharing or using
44444
+ // a custom video track
44445
+ // if we add support for switching between screen and camera this may cause issues
44327
44446
  if (!(isScreenSharing || isCustomVideoTrack || isTrackManuallyStopped)) {
44328
- _context28.next = 2;
44447
+ _context28.next = 3;
44329
44448
  break;
44330
44449
  }
44331
44450
  return _context28.abrupt("return");
44332
- case 2:
44333
- _context28.next = 4;
44451
+ case 3:
44452
+ _context28.next = 5;
44334
44453
  return getVideoDevices();
44335
- case 4:
44454
+ case 5:
44336
44455
  vidDevices = _context28.sent;
44337
44456
  oldTrack = getCurrentTrack();
44338
44457
  if (oldTrack) {
44339
- _context28.next = 8;
44458
+ _context28.next = 9;
44340
44459
  break;
44341
44460
  }
44342
44461
  throw otError(Errors.NOT_SUPPORTED, new Error('Publisher._toggleVideo cannot toggleVideo when you have no video source.'));
44343
- case 8:
44462
+ case 9:
44344
44463
  // oldTrackDeviceId is undefined when it comes from a canvasTracks, i.e.: it is currently muted
44345
44464
  oldTrackDeviceId = (_vidDevices$find = vidDevices.find(device => device.label === oldTrack.label)) == null ? void 0 : _vidDevices$find.deviceId;
44346
44465
  if (isNewTrackNeeded(shouldHaveVideo, oldTrackDeviceId)) {
44347
- _context28.next = 11;
44466
+ _context28.next = 12;
44348
44467
  break;
44349
44468
  }
44350
44469
  return _context28.abrupt("return");
44351
- case 11:
44470
+ case 12:
44352
44471
  if (!(oldTrack.readyState === 'ended')) {
44353
- _context28.next = 14;
44472
+ _context28.next = 15;
44354
44473
  break;
44355
44474
  }
44356
44475
  isTrackManuallyStopped = true;
44357
44476
  return _context28.abrupt("return");
44358
- case 14:
44477
+ case 15:
44359
44478
  if (shouldHaveVideo && OTHelpers.env.isAndroid && (OTHelpers.env.isChrome || OTHelpers.env.isSamsung)) {
44360
44479
  // On Chrome on Android you need to stop the previous video track OPENTOK-37206
44361
44480
  if (oldTrack && oldTrack.stop) {
@@ -44363,18 +44482,18 @@ function PublisherFactory(_ref) {
44363
44482
  }
44364
44483
  }
44365
44484
  if (shouldHaveVideo) {
44366
- _context28.next = 31;
44485
+ _context28.next = 32;
44367
44486
  break;
44368
44487
  }
44369
- _context28.prev = 16;
44488
+ _context28.prev = 17;
44370
44489
  newTrack = (0, _createCanvasVideoTrack.default)(videoDimensions);
44371
- _context28.next = 23;
44490
+ _context28.next = 24;
44372
44491
  break;
44373
- case 20:
44374
- _context28.prev = 20;
44375
- _context28.t0 = _context28["catch"](16);
44492
+ case 21:
44493
+ _context28.prev = 21;
44494
+ _context28.t0 = _context28["catch"](17);
44376
44495
  return _context28.abrupt("return");
44377
- case 23:
44496
+ case 24:
44378
44497
  if (oldTrackDeviceId) {
44379
44498
  // store the current deviceId to reacquire the video later
44380
44499
  currentDeviceId = oldTrackDeviceId;
@@ -44382,102 +44501,102 @@ function PublisherFactory(_ref) {
44382
44501
  setCurrentTrackDeviceId(newTrack.label);
44383
44502
  videoFilter = mediaProcessor.getVideoFilter();
44384
44503
  if (!videoFilter) {
44385
- _context28.next = 30;
44504
+ _context28.next = 31;
44386
44505
  break;
44387
44506
  }
44388
44507
  // Save the current video filter because we want to make sure it
44389
44508
  // gets enabled when the user publishes video again
44390
44509
  currentVideoFilter = videoFilter;
44391
- _context28.next = 30;
44510
+ _context28.next = 31;
44392
44511
  return destroyMediaProcessor();
44393
- case 30:
44512
+ case 31:
44394
44513
  if (_videoMediaProcessorConnector) {
44395
44514
  _videoMediaProcessorConnector.destroy();
44396
44515
  _videoMediaProcessorConnector.stopOriginalTrack();
44397
44516
  }
44398
- case 31:
44517
+ case 32:
44399
44518
  if (!(currentDeviceId && vidDevices.findIndex(device => device.deviceId === currentDeviceId) === -1)) {
44400
- _context28.next = 33;
44519
+ _context28.next = 34;
44401
44520
  break;
44402
44521
  }
44403
44522
  throw otError(Errors.NO_DEVICES_FOUND, new Error('Previous device no longer available - deviceId not found'));
44404
- case 33:
44523
+ case 34:
44405
44524
  privateEvents.emit('streamDestroy');
44406
44525
  if (!shouldHaveVideo) {
44407
- _context28.next = 64;
44526
+ _context28.next = 65;
44408
44527
  break;
44409
44528
  }
44410
44529
  if (!hasTrackFromDevice(currentDeviceId)) {
44411
- _context28.next = 37;
44530
+ _context28.next = 38;
44412
44531
  break;
44413
44532
  }
44414
44533
  return _context28.abrupt("return");
44415
- case 37:
44416
- _context28.prev = 37;
44417
- _context28.next = 40;
44534
+ case 38:
44535
+ _context28.prev = 38;
44536
+ _context28.next = 41;
44418
44537
  return getTrackFromDeviceId(currentDeviceId);
44419
- case 40:
44538
+ case 41:
44420
44539
  newTrack = _context28.sent;
44421
- _context28.next = 47;
44540
+ _context28.next = 48;
44422
44541
  break;
44423
- case 43:
44424
- _context28.prev = 43;
44425
- _context28.t1 = _context28["catch"](37);
44542
+ case 44:
44543
+ _context28.prev = 44;
44544
+ _context28.t1 = _context28["catch"](38);
44426
44545
  logging.error(`Error getting new track for current device(${currentDeviceId}): ${_context28.t1}`);
44427
44546
  throw _context28.t1;
44428
- case 47:
44547
+ case 48:
44429
44548
  if (newTrack) {
44430
- _context28.next = 50;
44549
+ _context28.next = 51;
44431
44550
  break;
44432
44551
  }
44433
44552
  logging.error('Failed to enable video. It was not possible to get a new track from the camera');
44434
44553
  return _context28.abrupt("return");
44435
- case 50:
44554
+ case 51:
44436
44555
  if (!currentVideoFilter) {
44437
- _context28.next = 59;
44556
+ _context28.next = 60;
44438
44557
  break;
44439
44558
  }
44440
44559
  originalVideoTrack = mediaProcessor.getOriginalVideoTrack();
44441
- _context28.next = 54;
44560
+ _context28.next = 55;
44442
44561
  return mediaProcessor.setVideoFilter(currentVideoFilter, true);
44443
- case 54:
44444
- _context28.next = 56;
44562
+ case 55:
44563
+ _context28.next = 57;
44445
44564
  return mediaProcessor.setMediaStream(webRTCStream);
44446
- case 56:
44447
- _context28.next = 58;
44565
+ case 57:
44566
+ _context28.next = 59;
44448
44567
  return mediaProcessor.setVideoTrack(newTrack);
44449
- case 58:
44450
- newTrack = _context28.sent;
44451
44568
  case 59:
44569
+ newTrack = _context28.sent;
44570
+ case 60:
44452
44571
  if (!_videoMediaProcessorConnector) {
44453
- _context28.next = 64;
44572
+ _context28.next = 65;
44454
44573
  break;
44455
44574
  }
44456
44575
  originalVideoTrack = _videoMediaProcessorConnector.originalTrack;
44457
- _context28.next = 63;
44576
+ _context28.next = 64;
44458
44577
  return _videoMediaProcessorConnector.setTrack(newTrack);
44459
- case 63:
44460
- newTrack = _context28.sent;
44461
44578
  case 64:
44462
- _context28.prev = 64;
44463
- _context28.next = 67;
44579
+ newTrack = _context28.sent;
44580
+ case 65:
44581
+ _context28.prev = 65;
44582
+ _context28.next = 68;
44464
44583
  return replaceTrackAndUpdate(oldTrack, newTrack);
44465
- case 67:
44584
+ case 68:
44466
44585
  // We stop the original track as a final step because whatever effects
44467
44586
  // were applied to it should remain in effect until the new track is
44468
44587
  // set
44469
44588
  (_originalVideoTrack = originalVideoTrack) == null ? void 0 : _originalVideoTrack.stop();
44470
- _context28.next = 73;
44589
+ _context28.next = 74;
44471
44590
  break;
44472
- case 70:
44473
- _context28.prev = 70;
44474
- _context28.t2 = _context28["catch"](64);
44591
+ case 71:
44592
+ _context28.prev = 71;
44593
+ _context28.t2 = _context28["catch"](65);
44475
44594
  throw _context28.t2;
44476
- case 73:
44595
+ case 74:
44477
44596
  case "end":
44478
44597
  return _context28.stop();
44479
44598
  }
44480
- }, _callee28, null, [[16, 20], [37, 43], [64, 70]]);
44599
+ }, _callee28, null, [[17, 21], [38, 44], [65, 71]]);
44481
44600
  }));
44482
44601
  return function (_x20, _x21) {
44483
44602
  return _ref40.apply(this, arguments);
@@ -44711,18 +44830,9 @@ function PublisherFactory(_ref) {
44711
44830
  // Save videoDimensions to not alter video size between mute states.
44712
44831
  videoDimensions = getVideoDimensions();
44713
44832
  properties.publishVideo = value;
44714
- if (properties.publisherAudioFallbackEnabled || getStatsCalled || networkConditionChangedListenersCount > 0) {
44715
- resetCongestionLevelEstimationOnPeerConnection(value);
44716
- if (value === false && audioFallbackCoordinator && audioFallbackCoordinator.getState() !== _audioFallbackVideoStates.default.ACTIVE_VIDEO) {
44717
- // We will reset audio fallback state now, but rumor doesn't expect the message until we re-enable the video
44718
- // so we flag the message as pending
44719
- pendingRumorAudioFallbackMessage = true;
44720
- resetAudioFallbackState();
44721
- }
44722
- }
44723
- _context32.next = 5;
44833
+ _context32.next = 4;
44724
44834
  return Promise.all([_this._toggleVideo(properties.publishVideo, videoDimensions), updateVideo()]);
44725
- case 5:
44835
+ case 4:
44726
44836
  case "end":
44727
44837
  return _context32.stop();
44728
44838
  }
@@ -45045,8 +45155,8 @@ function PublisherFactory(_ref) {
45045
45155
  break;
45046
45156
  default:
45047
45157
  if (!futurePeerConnection) {
45048
- var _this$session22, _this$session22$sessi;
45049
- if (!state.isMigrating() && (_this$session22 = this.session) != null && (_this$session22$sessi = _this$session22.sessionInfo) != null && _this$session22$sessi.isAdaptiveEnabled && getP2pPeerConnection()) {
45158
+ var _this$session23, _this$session23$sessi;
45159
+ if (!state.isMigrating() && (_this$session23 = this.session) != null && (_this$session23$sessi = _this$session23.sessionInfo) != null && _this$session23$sessi.isAdaptiveEnabled && getP2pPeerConnection()) {
45050
45160
  // In the case Rumor sends two generateOffers for the P2P leg,
45051
45161
  // we need to ignore the second one.
45052
45162
  return;
@@ -45587,7 +45697,7 @@ function PublisherFactory(_ref) {
45587
45697
  document.addEventListener('visibilitychange', visibilityHandler);
45588
45698
  };
45589
45699
  const handleBuggedUnMutedLocalAudioTrack = audioTrack => {
45590
- var _this$session23;
45700
+ var _this$session24;
45591
45701
  if (hasAudio()) {
45592
45702
  if (!hasVideo()) {
45593
45703
  // We only need to reset the audio source when the publisher is audio only.
@@ -45602,7 +45712,7 @@ function PublisherFactory(_ref) {
45602
45712
  this.videoElement().pause();
45603
45713
  }
45604
45714
  }
45605
- this == null ? void 0 : (_this$session23 = this.session) == null ? void 0 : _this$session23.trigger('gsmCallEnded');
45715
+ this == null ? void 0 : (_this$session24 = this.session) == null ? void 0 : _this$session24.trigger('gsmCallEnded');
45606
45716
  };
45607
45717
 
45608
45718
  /**
@@ -46415,7 +46525,7 @@ function PublisherFactory(_ref) {
46415
46525
  },
46416
46526
  startMigration: function () {
46417
46527
  var _startMigration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
46418
- var _publisherSenderStats6, _this$session24, _this$session24$sessi;
46528
+ var _publisherSenderStats6, _this$session25, _this$session25$sessi;
46419
46529
  var relayedPeerConnection, onCreateStreamError;
46420
46530
  return _regenerator.default.wrap(function _callee49$(_context49) {
46421
46531
  while (1) switch (_context49.prev = _context49.next) {
@@ -46437,7 +46547,7 @@ function PublisherFactory(_ref) {
46437
46547
  throw new Error(error);
46438
46548
  }
46439
46549
  };
46440
- if (!((_this$session24 = _this.session) != null && (_this$session24$sessi = _this$session24.sessionInfo) != null && _this$session24$sessi.p2pEnabled)) {
46550
+ if (!((_this$session25 = _this.session) != null && (_this$session25$sessi = _this$session25.sessionInfo) != null && _this$session25$sessi.p2pEnabled)) {
46441
46551
  _context49.next = 13;
46442
46552
  break;
46443
46553
  }
@@ -46462,7 +46572,7 @@ function PublisherFactory(_ref) {
46462
46572
  return startMigration;
46463
46573
  }(),
46464
46574
  finishMigration: () => {
46465
- var _this$session25, _this$session25$sessi;
46575
+ var _this$session26, _this$session26$sessi;
46466
46576
  clearTimeout(_migrationTimeoutId);
46467
46577
  const destroyPeerConnection = /*#__PURE__*/function () {
46468
46578
  var _ref61 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(pc) {
@@ -46497,7 +46607,7 @@ function PublisherFactory(_ref) {
46497
46607
  _previousPeerConnection = null;
46498
46608
 
46499
46609
  // In case we don't transition to P2P after migration, clear P2P leg.
46500
- if ((_this$session25 = this.session) != null && (_this$session25$sessi = _this$session25.sessionInfo) != null && _this$session25$sessi.isAdaptiveEnabled && activeSourceStreamId === 'MANTIS') {
46610
+ if ((_this$session26 = this.session) != null && (_this$session26$sessi = _this$session26.sessionInfo) != null && _this$session26$sessi.isAdaptiveEnabled && activeSourceStreamId === 'MANTIS') {
46501
46611
  var _getP2pPeerConnection;
46502
46612
  (_getP2pPeerConnection = getP2pPeerConnection()) == null ? void 0 : _getP2pPeerConnection.then(destroyPeerConnection);
46503
46613
  }
@@ -96047,14 +96157,16 @@ module.exports = assign;
96047
96157
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
96048
96158
 
96049
96159
  "use strict";
96160
+ /* provided dependency */ var Promise = __webpack_require__(86964);
96050
96161
 
96051
96162
 
96052
96163
  var _interopRequireDefault = __webpack_require__(95709);
96053
96164
  exports.__esModule = true;
96054
96165
  exports["default"] = blockCallsUntilComplete;
96166
+ exports.queueLatestCall = queueLatestCall;
96055
96167
  var _regenerator = _interopRequireDefault(__webpack_require__(92207));
96056
96168
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(79092));
96057
- // Block subsequent calls to an async function until the previous call has completed
96169
+ // Block subsequent calls to an async function until the previous call has completed.
96058
96170
  // Throws an error if you call the function too soon.
96059
96171
  function blockCallsUntilComplete(fn) {
96060
96172
  let blocked = false;
@@ -96098,6 +96210,87 @@ function blockCallsUntilComplete(fn) {
96098
96210
  return blocker;
96099
96211
  }();
96100
96212
  }
96213
+ function callSafely(fn, context, args) {
96214
+ try {
96215
+ return Promise.resolve(fn.apply(context, args));
96216
+ } catch (err) {
96217
+ return Promise.reject(err);
96218
+ }
96219
+ }
96220
+
96221
+ // Like blockCallsUntilComplete, but instead of throwing when called while busy,
96222
+ // it queues at most one pending call. Whether a call gets queued or skipped
96223
+ // is decided purely by its first (boolean) argument — if it matches the flag
96224
+ // of the call currently in flight, this call is redundant and just resolves
96225
+ // with that call's result. Any other arguments are only used once a call
96226
+ // actually runs; they play no part in the queue/skip decision.
96227
+ function queueLatestCall(fn) {
96228
+ let current = null; // promise of the call currently executing, or null when idle
96229
+ let runningFlag = null; // boolean flag of the call currently executing
96230
+ let queued = null; // the one call waiting its turn: { context, args, resolve, reject, promise }
96231
+
96232
+ function run(context, args) {
96233
+ runningFlag = args[0];
96234
+ // eslint-disable-next-line no-use-before-define
96235
+ current = callSafely(fn, context, args).finally(settle);
96236
+ return current;
96237
+ }
96238
+ function settle() {
96239
+ if (!queued) {
96240
+ current = null;
96241
+ runningFlag = null;
96242
+ return;
96243
+ }
96244
+ const _queued = queued,
96245
+ context = _queued.context,
96246
+ args = _queued.args,
96247
+ resolve = _queued.resolve,
96248
+ reject = _queued.reject;
96249
+ queued = null;
96250
+ run(context, args).then(resolve, reject);
96251
+ }
96252
+ return function (flag) {
96253
+ const context = this;
96254
+ for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
96255
+ rest[_key2 - 1] = arguments[_key2];
96256
+ }
96257
+ const args = [flag, ...rest];
96258
+ if (!current) {
96259
+ return run(context, args);
96260
+ }
96261
+ if (flag === runningFlag) {
96262
+ // Same flag as the call already in flight — anything queued behind
96263
+ // it is now moot, since we'd just end up back at this same state.
96264
+ if (queued) {
96265
+ current.then(queued.resolve, queued.reject);
96266
+ queued = null;
96267
+ }
96268
+ return current;
96269
+ }
96270
+
96271
+ // Only the most recent pending call matters, so replace whatever was
96272
+ // waiting before it — this is also what keeps its `rest` args current.
96273
+ if (queued) {
96274
+ queued.context = context;
96275
+ queued.args = args;
96276
+ return queued.promise;
96277
+ }
96278
+ let resolve;
96279
+ let reject;
96280
+ const promise = new Promise((res, rej) => {
96281
+ resolve = res;
96282
+ reject = rej;
96283
+ });
96284
+ queued = {
96285
+ context,
96286
+ args,
96287
+ resolve,
96288
+ reject,
96289
+ promise
96290
+ };
96291
+ return promise;
96292
+ };
96293
+ }
96101
96294
 
96102
96295
  /***/ }),
96103
96296