@opentok/client 2.33.0-alpha.25 → 2.33.0-alpha.27

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.33.0 69519fe8a
2
+ * @license OpenTok.js 2.33.0 ce572ca0e
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, 22 Dec 2025 15:21:49 GMT
8
+ * Date: Tue, 23 Dec 2025 14:23:25 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -8531,7 +8531,7 @@ function staticConfigFactory(_temp) {
8531
8531
  _ref$axios = _ref.axios,
8532
8532
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
8533
8533
  _ref$properties = _ref.properties,
8534
- properties = _ref$properties === void 0 ? {"version":"v2.33.0","buildHash":"69519fe8a","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;
8534
+ properties = _ref$properties === void 0 ? {"version":"v2.33.0","buildHash":"ce572ca0e","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;
8535
8535
  /** @type builtInConfig */
8536
8536
  const builtInConfig = (0, _cloneDeep.default)(properties);
8537
8537
  /**
@@ -72477,10 +72477,10 @@ function processPubOptionsFactory(deps) {
72477
72477
  properties
72478
72478
  };
72479
72479
  (0, _eventing.default)(processedOptions);
72480
- processedOptions.getUserMedia = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
72481
- var onAccessDialogOpened, onAccessDialogClosed, stream, devices, constraints, IOS_NEW_WINDOW_BUG, IOS_NOT_READABLE_ERROR_BUG, isNotReadableError, tryGetUserMedia;
72482
- return _regenerator.default.wrap(function _callee2$(_context2) {
72483
- while (1) switch (_context2.prev = _context2.next) {
72480
+ processedOptions.getUserMedia = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
72481
+ var onAccessDialogOpened, onAccessDialogClosed, applyAudioConstraints, stream, devices, constraints, IOS_NEW_WINDOW_BUG, IOS_NOT_READABLE_ERROR_BUG, isNotReadableError, tryGetUserMedia;
72482
+ return _regenerator.default.wrap(function _callee3$(_context3) {
72483
+ while (1) switch (_context3.prev = _context3.next) {
72484
72484
  case 0:
72485
72485
  onAccessDialogOpened = function onAccessDialogOpened() {
72486
72486
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -72494,51 +72494,103 @@ function processPubOptionsFactory(deps) {
72494
72494
  }
72495
72495
  return processedOptions.emit('accessDialogClosed', ...args);
72496
72496
  };
72497
+ applyAudioConstraints = /*#__PURE__*/function () {
72498
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
72499
+ var shouldApplyNewContraints, originalConstraints, newConstraints;
72500
+ return _regenerator.default.wrap(function _callee$(_context) {
72501
+ while (1) switch (_context.prev = _context.next) {
72502
+ case 0:
72503
+ if (!(typeof options.audioSource.applyConstraints !== 'function' || typeof options.audioSource.getSettings !== 'function')) {
72504
+ _context.next = 2;
72505
+ break;
72506
+ }
72507
+ return _context.abrupt("return");
72508
+ case 2:
72509
+ shouldApplyNewContraints = false;
72510
+ originalConstraints = options.audioSource.getSettings();
72511
+ newConstraints = {};
72512
+ ['echoCancellation', 'noiseSuppression', 'autoGainControl'].forEach(constraint => {
72513
+ const value = !properties.disableAudioProcessing && properties[constraint];
72514
+ newConstraints[constraint] = value;
72515
+ if (originalConstraints[constraint] !== value) shouldApplyNewContraints = true;
72516
+ });
72517
+ if (shouldApplyNewContraints) {
72518
+ _context.next = 8;
72519
+ break;
72520
+ }
72521
+ return _context.abrupt("return");
72522
+ case 8:
72523
+ _context.prev = 8;
72524
+ _context.next = 11;
72525
+ return options.audioSource.applyConstraints(newConstraints);
72526
+ case 11:
72527
+ _context.next = 16;
72528
+ break;
72529
+ case 13:
72530
+ _context.prev = 13;
72531
+ _context.t0 = _context["catch"](8);
72532
+ logging.warn(`${logPrefix}: Cannot apply contraints on the custom audio track.`);
72533
+ case 16:
72534
+ case "end":
72535
+ return _context.stop();
72536
+ }
72537
+ }, _callee, null, [[8, 13]]);
72538
+ }));
72539
+ return function applyAudioConstraints() {
72540
+ return _ref2.apply(this, arguments);
72541
+ };
72542
+ }();
72497
72543
  if (isGumRequired) {
72498
- _context2.next = 7;
72544
+ _context3.next = 11;
72499
72545
  break;
72500
72546
  }
72501
72547
  stream = new windowMock.MediaStream();
72502
- if (isCustomAudioTrack) {
72503
- stream.addTrack(options.audioSource);
72548
+ if (!isCustomAudioTrack) {
72549
+ _context3.next = 9;
72550
+ break;
72504
72551
  }
72552
+ _context3.next = 8;
72553
+ return applyAudioConstraints();
72554
+ case 8:
72555
+ stream.addTrack(options.audioSource);
72556
+ case 9:
72505
72557
  if (isCustomVideoTrack) {
72506
72558
  stream.addTrack(options.videoSource);
72507
72559
  }
72508
- return _context2.abrupt("return", stream);
72509
- case 7:
72560
+ return _context3.abrupt("return", stream);
72561
+ case 11:
72510
72562
  if (!isScreenSharing) {
72511
- _context2.next = 15;
72563
+ _context3.next = 19;
72512
72564
  break;
72513
72565
  }
72514
- _context2.next = 10;
72566
+ _context3.next = 14;
72515
72567
  return screenSharing.getConstraints({
72516
72568
  onAccessDialogOpened,
72517
72569
  onAccessDialogClosed,
72518
72570
  videoSource: options.videoSource,
72519
72571
  constraints: properties.constraints
72520
72572
  });
72521
- case 10:
72522
- properties.constraints = _context2.sent;
72573
+ case 14:
72574
+ properties.constraints = _context3.sent;
72523
72575
  if (!shouldStop()) {
72524
- _context2.next = 13;
72576
+ _context3.next = 17;
72525
72577
  break;
72526
72578
  }
72527
72579
  throw otError(_Errors.default.CANCEL, new Error(GET_USER_ABORT_ERROR_MSG));
72528
- case 13:
72529
- _context2.next = 25;
72580
+ case 17:
72581
+ _context3.next = 29;
72530
72582
  break;
72531
- case 15:
72532
- _context2.next = 17;
72583
+ case 19:
72584
+ _context3.next = 21;
72533
72585
  return deviceHelpers.shouldAskForDevices();
72534
- case 17:
72535
- devices = _context2.sent;
72586
+ case 21:
72587
+ devices = _context3.sent;
72536
72588
  if (!shouldStop()) {
72537
- _context2.next = 20;
72589
+ _context3.next = 24;
72538
72590
  break;
72539
72591
  }
72540
72592
  throw otError(_Errors.default.CANCEL, new Error(GET_USER_ABORT_ERROR_MSG));
72541
- case 20:
72593
+ case 24:
72542
72594
  logging.debug(`${logPrefix}: shouldAskForDevices:`, devices);
72543
72595
  if (!devices.video) {
72544
72596
  logging.warn(`${logPrefix}: Setting video constraint to false, there are no video sources`);
@@ -72552,53 +72604,53 @@ function processPubOptionsFactory(deps) {
72552
72604
  // @todo this side effect needs to go...
72553
72605
  processedOptions.videoDevices = devices.videoDevices;
72554
72606
  processedOptions.audioDevices = devices.audioDevices;
72555
- case 25:
72607
+ case 29:
72556
72608
  constraints = properties.constraints;
72557
72609
  logging.debug(`${logPrefix}: onConstraintsFound`, constraints);
72558
72610
  if (!shouldStop()) {
72559
- _context2.next = 29;
72611
+ _context3.next = 33;
72560
72612
  break;
72561
72613
  }
72562
72614
  throw otError(_Errors.default.CANCEL, new Error(GET_USER_ABORT_ERROR_MSG));
72563
- case 29:
72615
+ case 33:
72564
72616
  IOS_NEW_WINDOW_BUG = 'Failed to acquire functional stream, this might be caused by ' + 'the following iOS bug: https://bugs.webkit.org/show_bug.cgi?id=188088';
72565
72617
  IOS_NOT_READABLE_ERROR_BUG = 'Failed to acquire functional stream, this might ' + 'be caused by the following iOS bug: https://bugs.webkit.org/show_bug.cgi?id=204106';
72566
72618
  isNotReadableError = err => err.originalName === 'NotReadableError' && err.originalMessage === 'Failed starting capture of a video track';
72567
72619
  tryGetUserMedia = /*#__PURE__*/function () {
72568
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
72620
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
72569
72621
  var gumRequest, stream, error, gumAudioRequest, audioStream;
72570
- return _regenerator.default.wrap(function _callee$(_context) {
72571
- while (1) switch (_context.prev = _context.next) {
72622
+ return _regenerator.default.wrap(function _callee2$(_context2) {
72623
+ while (1) switch (_context2.prev = _context2.next) {
72572
72624
  case 0:
72573
72625
  gumRequest = getUserMediaHelper(constraints, isScreenSharing);
72574
72626
  gumRequest.on('accessDialogOpened', onAccessDialogOpened);
72575
72627
  gumRequest.on('accessDialogClosed', onAccessDialogClosed);
72576
- _context.prev = 3;
72577
- _context.next = 6;
72628
+ _context2.prev = 3;
72629
+ _context2.next = 6;
72578
72630
  return gumRequest;
72579
72631
  case 6:
72580
- stream = _context.sent;
72632
+ stream = _context2.sent;
72581
72633
  if (!(env.isiOS && properties.publishVideo && stream.getVideoTracks().length && stream.getVideoTracks()[0].readyState === 'ended')) {
72582
- _context.next = 11;
72634
+ _context2.next = 11;
72583
72635
  break;
72584
72636
  }
72585
72637
  stream.getTracks().forEach(track => track.stop());
72586
72638
  error = new Error(IOS_NEW_WINDOW_BUG);
72587
72639
  throw error;
72588
72640
  case 11:
72589
- return _context.abrupt("return", stream);
72641
+ return _context2.abrupt("return", stream);
72590
72642
  case 14:
72591
- _context.prev = 14;
72592
- _context.t0 = _context["catch"](3);
72643
+ _context2.prev = 14;
72644
+ _context2.t0 = _context2["catch"](3);
72593
72645
  if (!env.isiOS) {
72594
- _context.next = 34;
72646
+ _context2.next = 34;
72595
72647
  break;
72596
72648
  }
72597
- if (!(isNotReadableError(_context.t0) && env.iOSVersion >= 13 && env.iOSVersion < 13.4)) {
72598
- _context.next = 32;
72649
+ if (!(isNotReadableError(_context2.t0) && env.iOSVersion >= 13 && env.iOSVersion < 13.4)) {
72650
+ _context2.next = 32;
72599
72651
  break;
72600
72652
  }
72601
- _context.prev = 18;
72653
+ _context2.prev = 18;
72602
72654
  // As a workaround, we stop the remaining audio track to dispose hardware resources.
72603
72655
  // Then promiseEndeavour will retry to invoke tryGetUserMedia.
72604
72656
  // This bug might be related to https://bugs.webkit.org/show_bug.cgi?id=202405
@@ -72606,47 +72658,47 @@ function processPubOptionsFactory(deps) {
72606
72658
  audio: true,
72607
72659
  video: false
72608
72660
  }, false);
72609
- _context.next = 22;
72661
+ _context2.next = 22;
72610
72662
  return gumAudioRequest;
72611
72663
  case 22:
72612
- audioStream = _context.sent;
72664
+ audioStream = _context2.sent;
72613
72665
  audioStream.getTracks().forEach(track => track.stop());
72614
- _context.next = 29;
72666
+ _context2.next = 29;
72615
72667
  break;
72616
72668
  case 26:
72617
- _context.prev = 26;
72618
- _context.t1 = _context["catch"](18);
72619
- logging.debug(`${logPrefix}: error disposing audio track`, _context.t1);
72669
+ _context2.prev = 26;
72670
+ _context2.t1 = _context2["catch"](18);
72671
+ logging.debug(`${logPrefix}: error disposing audio track`, _context2.t1);
72620
72672
  case 29:
72621
72673
  throw new Error(IOS_NOT_READABLE_ERROR_BUG);
72622
72674
  case 32:
72623
- if (!(_context.t0.name === _Errors.default.HARDWARE_UNAVAILABLE)) {
72624
- _context.next = 34;
72675
+ if (!(_context2.t0.name === _Errors.default.HARDWARE_UNAVAILABLE)) {
72676
+ _context2.next = 34;
72625
72677
  break;
72626
72678
  }
72627
72679
  throw new Error(IOS_NEW_WINDOW_BUG);
72628
72680
  case 34:
72629
- throw _context.t0;
72681
+ throw _context2.t0;
72630
72682
  case 35:
72631
- _context.prev = 35;
72683
+ _context2.prev = 35;
72632
72684
  // Wait a little bit before we clean up the event handlers
72633
72685
  // to give 'accessDialogClosed' a chance to fire
72634
72686
  setTimeout(() => {
72635
72687
  gumRequest.off('accessDialogOpened', onAccessDialogOpened);
72636
72688
  gumRequest.off('accessDialogClosed', onAccessDialogClosed);
72637
72689
  });
72638
- return _context.finish(35);
72690
+ return _context2.finish(35);
72639
72691
  case 38:
72640
72692
  case "end":
72641
- return _context.stop();
72693
+ return _context2.stop();
72642
72694
  }
72643
- }, _callee, null, [[3, 14, 35, 38], [18, 26]]);
72695
+ }, _callee2, null, [[3, 14, 35, 38], [18, 26]]);
72644
72696
  }));
72645
72697
  return function tryGetUserMedia() {
72646
- return _ref2.apply(this, arguments);
72698
+ return _ref3.apply(this, arguments);
72647
72699
  };
72648
72700
  }();
72649
- _context2.next = 35;
72701
+ _context3.next = 39;
72650
72702
  return (0, _promiseEndeavour.default)(tryGetUserMedia, (err, attempt) => {
72651
72703
  const errors = [
72652
72704
  // Detected the iOS new window bug. Need try again.
@@ -72661,29 +72713,35 @@ function processPubOptionsFactory(deps) {
72661
72713
  }
72662
72714
  return false;
72663
72715
  })();
72664
- case 35:
72665
- stream = _context2.sent;
72716
+ case 39:
72717
+ stream = _context3.sent;
72666
72718
  if (!shouldStop()) {
72667
- _context2.next = 39;
72719
+ _context3.next = 43;
72668
72720
  break;
72669
72721
  }
72670
72722
  stream.getTracks().forEach(track => {
72671
72723
  track.stop();
72672
72724
  });
72673
72725
  throw otError(_Errors.default.CANCEL, new Error(GET_USER_ABORT_ERROR_MSG));
72674
- case 39:
72675
- if (isCustomAudioTrack) {
72676
- stream.addTrack(options.audioSource);
72726
+ case 43:
72727
+ if (!isCustomAudioTrack) {
72728
+ _context3.next = 47;
72729
+ break;
72677
72730
  }
72731
+ _context3.next = 46;
72732
+ return applyAudioConstraints();
72733
+ case 46:
72734
+ stream.addTrack(options.audioSource);
72735
+ case 47:
72678
72736
  if (isCustomVideoTrack) {
72679
72737
  stream.addTrack(options.videoSource);
72680
72738
  }
72681
- return _context2.abrupt("return", stream);
72682
- case 42:
72739
+ return _context3.abrupt("return", stream);
72740
+ case 49:
72683
72741
  case "end":
72684
- return _context2.stop();
72742
+ return _context3.stop();
72685
72743
  }
72686
- }, _callee2);
72744
+ }, _callee3);
72687
72745
  }));
72688
72746
  return processedOptions;
72689
72747
  };