@opentok/client 2.35.0-alpha.16 → 2.35.0-alpha.18

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 ddc5de1ff
2
+ * @license OpenTok.js 2.35.0 cda9e8c5d
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: Sat, 09 May 2026 12:51:10 GMT
8
+ * Date: Mon, 11 May 2026 17:21:30 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -25251,8 +25251,17 @@ function SubscriberFactory(_ref2) {
25251
25251
  if (_chrome) {
25252
25252
  _chrome.videoDisabledIndicator.setWarning(event.newValue);
25253
25253
  }
25254
- this.dispatchEvent(new Events.VideoDisableWarningEvent(event.newValue ? 'videoDisableWarning' : 'videoDisableWarningLifted'));
25255
- updateCongestionLevel(event.newValue ? 1 : null);
25254
+ if (event.oldValue !== event.newValue) {
25255
+ if (event.newValue) {
25256
+ this.dispatchEvent(new Events.VideoDisableWarningEvent('videoDisableWarning'));
25257
+ logAnalyticsEvent('videoDisableWarning', 'Event');
25258
+ updateCongestionLevel(1);
25259
+ } else if (event.oldValue) {
25260
+ this.dispatchEvent(new Events.VideoDisableWarningEvent('videoDisableWarningLifted'));
25261
+ logAnalyticsEvent('videoDisableWarningLifted', 'Event');
25262
+ updateCongestionLevel(null);
25263
+ }
25264
+ }
25256
25265
  break;
25257
25266
  case 'hasVideo':
25258
25267
  // @todo setAudioOnly affects peer connections, what happens with new ones?
@@ -41640,7 +41649,7 @@ function staticConfigFactory(_temp) {
41640
41649
  _ref$axios = _ref.axios,
41641
41650
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
41642
41651
  _ref$properties = _ref.properties,
41643
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"ddc5de1ff","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":"cda9e8c5d","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;
41644
41653
  /** @type builtInConfig */
41645
41654
  const builtInConfig = (0, _cloneDeep.default)(properties);
41646
41655
  /**
@@ -43455,6 +43464,7 @@ function PublisherFactory(_ref) {
43455
43464
  let networkConditionChangedListenersCount = 0;
43456
43465
  let networkCondition = _networkConditionConstants.NETWORK_CONDITION.GOOD;
43457
43466
  let getStatsCalled = false;
43467
+ let filteredVideoTrackId;
43458
43468
 
43459
43469
  /** @type IntervalRunnerDefault | undefined */
43460
43470
  let connectivityAttemptPinger;
@@ -46597,7 +46607,7 @@ function PublisherFactory(_ref) {
46597
46607
  }
46598
46608
  const replaceTrackAndUpdate = /*#__PURE__*/function () {
46599
46609
  var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(oldTrack, newTrack) {
46600
- var pcs, isNewTrackFiltered, video;
46610
+ var pcs, video;
46601
46611
  return _regenerator.default.wrap(function _callee34$(_context34) {
46602
46612
  while (1) switch (_context34.prev = _context34.next) {
46603
46613
  case 0:
@@ -46628,32 +46638,16 @@ function PublisherFactory(_ref) {
46628
46638
  case 5:
46629
46639
  webRTCStream.removeTrack(oldTrack);
46630
46640
  webRTCStream.addTrack(newTrack);
46631
- if (!(oldTrack && oldTrack.stop)) {
46632
- _context34.next = 16;
46641
+ if (!(newTrack.id !== filteredVideoTrackId)) {
46642
+ _context34.next = 11;
46633
46643
  break;
46634
46644
  }
46635
- isNewTrackFiltered = newTrack.writable; // The oldTrack is being used as input by the MediaProcessor, so stopping
46636
- // it will stop the newTrack as well. We do have to remove the constraints and re-apply
46637
- // them.
46638
- if (!isNewTrackFiltered) {
46639
- _context34.next = 15;
46640
- break;
46641
- }
46642
- if (!(OTHelpers.env.name !== 'Firefox')) {
46643
- _context34.next = 13;
46644
- break;
46645
+ if (oldTrack && oldTrack.stop) {
46646
+ oldTrack.stop();
46645
46647
  }
46646
- _context34.next = 13;
46647
- return removeVideoConstraintsFrom(oldTrack);
46648
- case 13:
46649
- _context34.next = 16;
46650
- break;
46651
- case 15:
46652
- oldTrack.stop();
46653
- case 16:
46654
- _context34.next = 18;
46648
+ _context34.next = 11;
46655
46649
  return applyVideoConstraintsTo(newTrack);
46656
- case 18:
46650
+ case 11:
46657
46651
  if (OTHelpers.env.name === 'Firefox' || OTHelpers.env.name === 'Safari') {
46658
46652
  // eslint-disable-next-line no-undef
46659
46653
  if (webRTCStream instanceof MediaStream && _this.videoElement()) {
@@ -46668,7 +46662,7 @@ function PublisherFactory(_ref) {
46668
46662
  }
46669
46663
  privateEvents.emit('streamChange');
46670
46664
  updateVideo();
46671
- case 23:
46665
+ case 16:
46672
46666
  case "end":
46673
46667
  return _context34.stop();
46674
46668
  }
@@ -48553,32 +48547,33 @@ function PublisherFactory(_ref) {
48553
48547
  case 48:
48554
48548
  filteredVideoTrack = _context52.sent;
48555
48549
  if (!filteredVideoTrack) {
48556
- _context52.next = 52;
48550
+ _context52.next = 53;
48557
48551
  break;
48558
48552
  }
48559
- _context52.next = 52;
48553
+ filteredVideoTrackId = filteredVideoTrack.id;
48554
+ _context52.next = 53;
48560
48555
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
48561
- case 52:
48562
- _context52.next = 59;
48556
+ case 53:
48557
+ _context52.next = 60;
48563
48558
  break;
48564
- case 54:
48565
- _context52.prev = 54;
48559
+ case 55:
48560
+ _context52.prev = 55;
48566
48561
  _context52.t1 = _context52["catch"](3);
48567
48562
  logging.error(`Error applying video filter: ${_context52.t1}`);
48568
48563
  logAnalyticsEvent('applyVideoFilter', 'Failure', {
48569
48564
  message: _context52.t1.message
48570
48565
  });
48571
48566
  throw _context52.t1;
48572
- case 59:
48567
+ case 60:
48573
48568
  currentVideoFilter = videoFilter;
48574
48569
  logAnalyticsEvent('applyVideoFilter', 'Success', {
48575
48570
  videoFilter: sanitizedVideoFilter
48576
48571
  });
48577
- case 61:
48572
+ case 62:
48578
48573
  case "end":
48579
48574
  return _context52.stop();
48580
48575
  }
48581
- }, _callee52, null, [[3, 54], [25, 33]]);
48576
+ }, _callee52, null, [[3, 55], [25, 33]]);
48582
48577
  }));
48583
48578
  return function (_x40, _x41) {
48584
48579
  return _ref59.apply(this, arguments);
@@ -48986,7 +48981,7 @@ function PublisherFactory(_ref) {
48986
48981
  throw otError(Errors.NOT_SUPPORTED, new Error('setVideoMediaProcessorConnector: Cannot use this method when videoFilter is set.'));
48987
48982
  case 4:
48988
48983
  if (!_videoMediaProcessorConnector) {
48989
- _context55.next = 14;
48984
+ _context55.next = 15;
48990
48985
  break;
48991
48986
  }
48992
48987
  _webRTCStream$getVide3 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide3[0];
@@ -48994,35 +48989,36 @@ function PublisherFactory(_ref) {
48994
48989
  return getTrackFromDeviceId(currentDeviceId);
48995
48990
  case 8:
48996
48991
  videoTrack = _context55.sent;
48997
- _context55.next = 11;
48992
+ filteredVideoTrackId = null;
48993
+ _context55.next = 12;
48998
48994
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
48999
- case 11:
48995
+ case 12:
49000
48996
  _videoMediaProcessorConnector.destroy();
49001
48997
  _videoMediaProcessorConnector.stopOriginalTrack();
49002
48998
  _videoMediaProcessorConnector = null;
49003
- case 14:
48999
+ case 15:
49004
49000
  if (mediaProcessorConnector) {
49005
- _context55.next = 17;
49001
+ _context55.next = 18;
49006
49002
  break;
49007
49003
  }
49008
49004
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success', {
49009
49005
  message: 'clearing the connector'
49010
49006
  });
49011
49007
  return _context55.abrupt("return");
49012
- case 17:
49008
+ case 18:
49013
49009
  if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
49014
- _context55.next = 20;
49010
+ _context55.next = 21;
49015
49011
  break;
49016
49012
  }
49017
49013
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
49018
49014
  message: 'Invalid MediaProcessorConnector'
49019
49015
  });
49020
49016
  throw otError(Errors.INVALID_PARAMETER, new Error('setVideoMediaProcessorConnector: Tried to set invalid MediaProcessorConnector'));
49021
- case 20:
49017
+ case 21:
49022
49018
  _videoMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
49023
49019
  _webRTCStream$getVide4 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide4[0];
49024
49020
  if (originalVideoTrack) {
49025
- _context55.next = 28;
49021
+ _context55.next = 29;
49026
49022
  break;
49027
49023
  }
49028
49024
  message = 'Connector not set as no video track is present.';
@@ -49032,33 +49028,34 @@ function PublisherFactory(_ref) {
49032
49028
  logging.warn(`setVideoMediaProcessorConnector: ${message}`);
49033
49029
  _videoMediaProcessorConnector = null;
49034
49030
  return _context55.abrupt("return");
49035
- case 28:
49036
- _context55.prev = 28;
49037
- _context55.next = 31;
49031
+ case 29:
49032
+ _context55.prev = 29;
49033
+ _context55.next = 32;
49038
49034
  return _videoMediaProcessorConnector.setTrack(originalVideoTrack);
49039
- case 31:
49035
+ case 32:
49040
49036
  filteredVideoTrack = _context55.sent;
49041
- _context55.next = 34;
49037
+ filteredVideoTrackId = filteredVideoTrack.id;
49038
+ _context55.next = 36;
49042
49039
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
49043
- case 34:
49044
- _context55.next = 42;
49045
- break;
49046
49040
  case 36:
49047
- _context55.prev = 36;
49048
- _context55.t0 = _context55["catch"](28);
49041
+ _context55.next = 44;
49042
+ break;
49043
+ case 38:
49044
+ _context55.prev = 38;
49045
+ _context55.t0 = _context55["catch"](29);
49049
49046
  _videoMediaProcessorConnector = null;
49050
49047
  logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context55.t0}`);
49051
49048
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
49052
49049
  message: _context55.t0.message
49053
49050
  });
49054
49051
  throw _context55.t0;
49055
- case 42:
49052
+ case 44:
49056
49053
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success');
49057
- case 43:
49054
+ case 45:
49058
49055
  case "end":
49059
49056
  return _context55.stop();
49060
49057
  }
49061
- }, _callee55, null, [[28, 36]]);
49058
+ }, _callee55, null, [[29, 38]]);
49062
49059
  }));
49063
49060
  return function (_x43) {
49064
49061
  return _ref62.apply(this, arguments);
@@ -49320,28 +49317,29 @@ function PublisherFactory(_ref) {
49320
49317
  logging.warn('Failed to clear filter because there is no video track.');
49321
49318
  return _context58.abrupt("return");
49322
49319
  case 36:
49323
- _context58.prev = 36;
49324
- _context58.next = 39;
49320
+ filteredVideoTrackId = null;
49321
+ _context58.prev = 37;
49322
+ _context58.next = 40;
49325
49323
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
49326
- case 39:
49327
- _context58.next = 41;
49324
+ case 40:
49325
+ _context58.next = 42;
49328
49326
  return destroyMediaProcessor();
49329
- case 41:
49330
- _context58.next = 46;
49327
+ case 42:
49328
+ _context58.next = 47;
49331
49329
  break;
49332
- case 43:
49333
- _context58.prev = 43;
49334
- _context58.t1 = _context58["catch"](36);
49330
+ case 44:
49331
+ _context58.prev = 44;
49332
+ _context58.t1 = _context58["catch"](37);
49335
49333
  // Restore the previous filter since this call has failed. This way, this function can be
49336
49334
  // called again if needed.
49337
49335
  currentVideoFilter = oldVideoFilter;
49338
- case 46:
49339
- logAnalyticsEvent('clearVideoFilter', 'Success');
49340
49336
  case 47:
49337
+ logAnalyticsEvent('clearVideoFilter', 'Success');
49338
+ case 48:
49341
49339
  case "end":
49342
49340
  return _context58.stop();
49343
49341
  }
49344
- }, _callee58, null, [[23, 29], [36, 43]]);
49342
+ }, _callee58, null, [[23, 29], [37, 44]]);
49345
49343
  }));
49346
49344
  const applySetMaxBitrateToPeerConnection = /*#__PURE__*/function () {
49347
49345
  var _ref66 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(peerConnection) {
@@ -49501,16 +49499,18 @@ function PublisherFactory(_ref) {
49501
49499
  };
49502
49500
  return (0, _videoConstraints.default)(track, constraints);
49503
49501
  };
49504
- const removeVideoConstraintsFrom = track => {
49505
- const constraints = {
49506
- width: {},
49507
- height: {},
49508
- frameRate: {}
49509
- };
49510
- return (0, _videoConstraints.default)(track, constraints);
49511
- };
49512
49502
  const applyVideoConstraints = () => {
49513
- 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
+ });
49514
49514
  if (!videoTracks || videoTracks.length === 0) return Promise.resolve();
49515
49515
  return Promise.all(videoTracks.map(applyVideoConstraintsTo));
49516
49516
  };