@opentok/client 2.35.0-alpha.17 → 2.35.0-alpha.19

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 45974b7d5
2
+ * @license OpenTok.js 2.35.0 41713c339
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, 11 May 2026 09:30:22 GMT
8
+ * Date: Tue, 12 May 2026 05:01:28 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -41649,7 +41649,7 @@ function staticConfigFactory(_temp) {
41649
41649
  _ref$axios = _ref.axios,
41650
41650
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
41651
41651
  _ref$properties = _ref.properties,
41652
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"45974b7d5","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;
41652
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"41713c339","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;
41653
41653
  /** @type builtInConfig */
41654
41654
  const builtInConfig = (0, _cloneDeep.default)(properties);
41655
41655
  /**
@@ -43464,6 +43464,7 @@ function PublisherFactory(_ref) {
43464
43464
  let networkConditionChangedListenersCount = 0;
43465
43465
  let networkCondition = _networkConditionConstants.NETWORK_CONDITION.GOOD;
43466
43466
  let getStatsCalled = false;
43467
+ let filteredVideoTrackId;
43467
43468
 
43468
43469
  /** @type IntervalRunnerDefault | undefined */
43469
43470
  let connectivityAttemptPinger;
@@ -46606,7 +46607,7 @@ function PublisherFactory(_ref) {
46606
46607
  }
46607
46608
  const replaceTrackAndUpdate = /*#__PURE__*/function () {
46608
46609
  var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(oldTrack, newTrack) {
46609
- var pcs, isNewTrackFiltered, video;
46610
+ var pcs, video;
46610
46611
  return _regenerator.default.wrap(function _callee34$(_context34) {
46611
46612
  while (1) switch (_context34.prev = _context34.next) {
46612
46613
  case 0:
@@ -46637,32 +46638,16 @@ function PublisherFactory(_ref) {
46637
46638
  case 5:
46638
46639
  webRTCStream.removeTrack(oldTrack);
46639
46640
  webRTCStream.addTrack(newTrack);
46640
- if (!(oldTrack && oldTrack.stop)) {
46641
- _context34.next = 16;
46642
- break;
46643
- }
46644
- isNewTrackFiltered = newTrack.writable; // The oldTrack is being used as input by the MediaProcessor, so stopping
46645
- // it will stop the newTrack as well. We do have to remove the constraints and re-apply
46646
- // them.
46647
- if (!isNewTrackFiltered) {
46648
- _context34.next = 15;
46641
+ if (!(newTrack.id !== filteredVideoTrackId)) {
46642
+ _context34.next = 11;
46649
46643
  break;
46650
46644
  }
46651
- if (!(OTHelpers.env.name !== 'Firefox')) {
46652
- _context34.next = 13;
46653
- break;
46645
+ if (oldTrack && oldTrack.stop) {
46646
+ oldTrack.stop();
46654
46647
  }
46655
- _context34.next = 13;
46656
- return removeVideoConstraintsFrom(oldTrack);
46657
- case 13:
46658
- _context34.next = 16;
46659
- break;
46660
- case 15:
46661
- oldTrack.stop();
46662
- case 16:
46663
- _context34.next = 18;
46648
+ _context34.next = 11;
46664
46649
  return applyVideoConstraintsTo(newTrack);
46665
- case 18:
46650
+ case 11:
46666
46651
  if (OTHelpers.env.name === 'Firefox' || OTHelpers.env.name === 'Safari') {
46667
46652
  // eslint-disable-next-line no-undef
46668
46653
  if (webRTCStream instanceof MediaStream && _this.videoElement()) {
@@ -46677,7 +46662,7 @@ function PublisherFactory(_ref) {
46677
46662
  }
46678
46663
  privateEvents.emit('streamChange');
46679
46664
  updateVideo();
46680
- case 23:
46665
+ case 16:
46681
46666
  case "end":
46682
46667
  return _context34.stop();
46683
46668
  }
@@ -48562,32 +48547,33 @@ function PublisherFactory(_ref) {
48562
48547
  case 48:
48563
48548
  filteredVideoTrack = _context52.sent;
48564
48549
  if (!filteredVideoTrack) {
48565
- _context52.next = 52;
48550
+ _context52.next = 53;
48566
48551
  break;
48567
48552
  }
48568
- _context52.next = 52;
48553
+ filteredVideoTrackId = filteredVideoTrack.id;
48554
+ _context52.next = 53;
48569
48555
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
48570
- case 52:
48571
- _context52.next = 59;
48556
+ case 53:
48557
+ _context52.next = 60;
48572
48558
  break;
48573
- case 54:
48574
- _context52.prev = 54;
48559
+ case 55:
48560
+ _context52.prev = 55;
48575
48561
  _context52.t1 = _context52["catch"](3);
48576
48562
  logging.error(`Error applying video filter: ${_context52.t1}`);
48577
48563
  logAnalyticsEvent('applyVideoFilter', 'Failure', {
48578
48564
  message: _context52.t1.message
48579
48565
  });
48580
48566
  throw _context52.t1;
48581
- case 59:
48567
+ case 60:
48582
48568
  currentVideoFilter = videoFilter;
48583
48569
  logAnalyticsEvent('applyVideoFilter', 'Success', {
48584
48570
  videoFilter: sanitizedVideoFilter
48585
48571
  });
48586
- case 61:
48572
+ case 62:
48587
48573
  case "end":
48588
48574
  return _context52.stop();
48589
48575
  }
48590
- }, _callee52, null, [[3, 54], [25, 33]]);
48576
+ }, _callee52, null, [[3, 55], [25, 33]]);
48591
48577
  }));
48592
48578
  return function (_x40, _x41) {
48593
48579
  return _ref59.apply(this, arguments);
@@ -48995,7 +48981,7 @@ function PublisherFactory(_ref) {
48995
48981
  throw otError(Errors.NOT_SUPPORTED, new Error('setVideoMediaProcessorConnector: Cannot use this method when videoFilter is set.'));
48996
48982
  case 4:
48997
48983
  if (!_videoMediaProcessorConnector) {
48998
- _context55.next = 14;
48984
+ _context55.next = 15;
48999
48985
  break;
49000
48986
  }
49001
48987
  _webRTCStream$getVide3 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide3[0];
@@ -49003,35 +48989,36 @@ function PublisherFactory(_ref) {
49003
48989
  return getTrackFromDeviceId(currentDeviceId);
49004
48990
  case 8:
49005
48991
  videoTrack = _context55.sent;
49006
- _context55.next = 11;
48992
+ filteredVideoTrackId = null;
48993
+ _context55.next = 12;
49007
48994
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
49008
- case 11:
48995
+ case 12:
49009
48996
  _videoMediaProcessorConnector.destroy();
49010
48997
  _videoMediaProcessorConnector.stopOriginalTrack();
49011
48998
  _videoMediaProcessorConnector = null;
49012
- case 14:
48999
+ case 15:
49013
49000
  if (mediaProcessorConnector) {
49014
- _context55.next = 17;
49001
+ _context55.next = 18;
49015
49002
  break;
49016
49003
  }
49017
49004
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success', {
49018
49005
  message: 'clearing the connector'
49019
49006
  });
49020
49007
  return _context55.abrupt("return");
49021
- case 17:
49008
+ case 18:
49022
49009
  if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
49023
- _context55.next = 20;
49010
+ _context55.next = 21;
49024
49011
  break;
49025
49012
  }
49026
49013
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
49027
49014
  message: 'Invalid MediaProcessorConnector'
49028
49015
  });
49029
49016
  throw otError(Errors.INVALID_PARAMETER, new Error('setVideoMediaProcessorConnector: Tried to set invalid MediaProcessorConnector'));
49030
- case 20:
49017
+ case 21:
49031
49018
  _videoMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
49032
49019
  _webRTCStream$getVide4 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide4[0];
49033
49020
  if (originalVideoTrack) {
49034
- _context55.next = 28;
49021
+ _context55.next = 29;
49035
49022
  break;
49036
49023
  }
49037
49024
  message = 'Connector not set as no video track is present.';
@@ -49041,33 +49028,34 @@ function PublisherFactory(_ref) {
49041
49028
  logging.warn(`setVideoMediaProcessorConnector: ${message}`);
49042
49029
  _videoMediaProcessorConnector = null;
49043
49030
  return _context55.abrupt("return");
49044
- case 28:
49045
- _context55.prev = 28;
49046
- _context55.next = 31;
49031
+ case 29:
49032
+ _context55.prev = 29;
49033
+ _context55.next = 32;
49047
49034
  return _videoMediaProcessorConnector.setTrack(originalVideoTrack);
49048
- case 31:
49035
+ case 32:
49049
49036
  filteredVideoTrack = _context55.sent;
49050
- _context55.next = 34;
49037
+ filteredVideoTrackId = filteredVideoTrack.id;
49038
+ _context55.next = 36;
49051
49039
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
49052
- case 34:
49053
- _context55.next = 42;
49054
- break;
49055
49040
  case 36:
49056
- _context55.prev = 36;
49057
- _context55.t0 = _context55["catch"](28);
49041
+ _context55.next = 44;
49042
+ break;
49043
+ case 38:
49044
+ _context55.prev = 38;
49045
+ _context55.t0 = _context55["catch"](29);
49058
49046
  _videoMediaProcessorConnector = null;
49059
49047
  logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context55.t0}`);
49060
49048
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
49061
49049
  message: _context55.t0.message
49062
49050
  });
49063
49051
  throw _context55.t0;
49064
- case 42:
49052
+ case 44:
49065
49053
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success');
49066
- case 43:
49054
+ case 45:
49067
49055
  case "end":
49068
49056
  return _context55.stop();
49069
49057
  }
49070
- }, _callee55, null, [[28, 36]]);
49058
+ }, _callee55, null, [[29, 38]]);
49071
49059
  }));
49072
49060
  return function (_x43) {
49073
49061
  return _ref62.apply(this, arguments);
@@ -49329,28 +49317,29 @@ function PublisherFactory(_ref) {
49329
49317
  logging.warn('Failed to clear filter because there is no video track.');
49330
49318
  return _context58.abrupt("return");
49331
49319
  case 36:
49332
- _context58.prev = 36;
49333
- _context58.next = 39;
49320
+ filteredVideoTrackId = null;
49321
+ _context58.prev = 37;
49322
+ _context58.next = 40;
49334
49323
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
49335
- case 39:
49336
- _context58.next = 41;
49324
+ case 40:
49325
+ _context58.next = 42;
49337
49326
  return destroyMediaProcessor();
49338
- case 41:
49339
- _context58.next = 46;
49327
+ case 42:
49328
+ _context58.next = 47;
49340
49329
  break;
49341
- case 43:
49342
- _context58.prev = 43;
49343
- _context58.t1 = _context58["catch"](36);
49330
+ case 44:
49331
+ _context58.prev = 44;
49332
+ _context58.t1 = _context58["catch"](37);
49344
49333
  // Restore the previous filter since this call has failed. This way, this function can be
49345
49334
  // called again if needed.
49346
49335
  currentVideoFilter = oldVideoFilter;
49347
- case 46:
49348
- logAnalyticsEvent('clearVideoFilter', 'Success');
49349
49336
  case 47:
49337
+ logAnalyticsEvent('clearVideoFilter', 'Success');
49338
+ case 48:
49350
49339
  case "end":
49351
49340
  return _context58.stop();
49352
49341
  }
49353
- }, _callee58, null, [[23, 29], [36, 43]]);
49342
+ }, _callee58, null, [[23, 29], [37, 44]]);
49354
49343
  }));
49355
49344
  const applySetMaxBitrateToPeerConnection = /*#__PURE__*/function () {
49356
49345
  var _ref66 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(peerConnection) {
@@ -49510,16 +49499,18 @@ function PublisherFactory(_ref) {
49510
49499
  };
49511
49500
  return (0, _videoConstraints.default)(track, constraints);
49512
49501
  };
49513
- const removeVideoConstraintsFrom = track => {
49514
- const constraints = {
49515
- width: {},
49516
- height: {},
49517
- frameRate: {}
49518
- };
49519
- return (0, _videoConstraints.default)(track, constraints);
49520
- };
49521
49502
  const applyVideoConstraints = () => {
49522
- const videoTracks = webRTCStream.getVideoTracks();
49503
+ var _videoMediaProcessorC;
49504
+ const videoTracks = [mediaProcessor == null ? void 0 : mediaProcessor.getOriginalVideoTrack(), (_videoMediaProcessorC = _videoMediaProcessorConnector) == null ? void 0 : _videoMediaProcessorC.originalTrack, ...webRTCStream.getVideoTracks()].filter(track => {
49505
+ var _window$MediaStreamTr;
49506
+ return track && (
49507
+ // On Chrome both original and filtered track (instance of MediaStreamTrackGenerator) need to
49508
+ // get constraints applied. In Firefox and Safari only the original track.
49509
+ track instanceof ((_window$MediaStreamTr = window.MediaStreamTrackGenerator) != null ? _window$MediaStreamTr : /*#__PURE__*/function () {
49510
+ function _class() {}
49511
+ return _class;
49512
+ }()) || track.id !== filteredVideoTrackId);
49513
+ });
49523
49514
  if (!videoTracks || videoTracks.length === 0) return Promise.resolve();
49524
49515
  return Promise.all(videoTracks.map(applyVideoConstraintsTo));
49525
49516
  };