@opentok/client 2.35.0-alpha.62 → 2.35.0-alpha.64

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 8575265e3
2
+ * @license OpenTok.js 2.35.0 dbe63a129
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, 29 Jun 2026 06:01:57 GMT
8
+ * Date: Wed, 01 Jul 2026 15:48:18 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -23617,6 +23617,10 @@ function SubscriberFactory(_ref2) {
23617
23617
  _videoQualityWatcher.destroy();
23618
23618
  amrState.destroy();
23619
23619
  logSetAudioVolumeLimitedRunner.destroy();
23620
+ if (_audioLevelBehaviour) {
23621
+ _audioLevelBehaviour.destroy();
23622
+ _audioLevelBehaviour = undefined;
23623
+ }
23620
23624
  _preDisconnectStats = {
23621
23625
  sessionId: _session.sessionId,
23622
23626
  connectionId: (_session10 = _session) != null && _session10.isConnected() ? (_session11 = _session) == null ? void 0 : (_session11$connection = _session11.connection) == null ? void 0 : _session11$connection.connectionId : null,
@@ -37993,7 +37997,12 @@ let WebAudioAudioLevelSampler = /*#__PURE__*/function () {
37993
37997
  };
37994
37998
  _proto.destroy = function destroy() {
37995
37999
  if (this._sourceNode) {
37996
- this._sourceNode.disconnect(this._analyser);
38000
+ this._sourceNode.disconnect();
38001
+ this._sourceNode = null;
38002
+ }
38003
+ if (this._analyser) {
38004
+ this._analyser.disconnect();
38005
+ this._analyser = null;
37997
38006
  }
37998
38007
  this._timeDomainData = null;
37999
38008
  };
@@ -39542,7 +39551,7 @@ function staticConfigFactory(_temp) {
39542
39551
  _ref$axios = _ref.axios,
39543
39552
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
39544
39553
  _ref$properties = _ref.properties,
39545
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"8575265e3","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;
39554
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"dbe63a129","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;
39546
39555
  /** @type builtInConfig */
39547
39556
  const builtInConfig = (0, _cloneDeep.default)(properties);
39548
39557
  /**
@@ -43716,6 +43725,7 @@ function PublisherFactory(_ref) {
43716
43725
  * @see <a href="Stream.html#hasAudio">Stream.hasAudio</a>
43717
43726
  * @see StreamPropertyChangedEvent
43718
43727
  * @method #publishAudio
43728
+ * @return {Publisher}
43719
43729
  * @memberOf Publisher
43720
43730
  */
43721
43731
  this.publishAudio = value => {
@@ -43890,37 +43900,42 @@ function PublisherFactory(_ref) {
43890
43900
  refreshAudioVideoUI();
43891
43901
  };
43892
43902
  const destroyMediaProcessor = /*#__PURE__*/function () {
43893
- var _ref38 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
43894
- var videoTrack;
43903
+ var _ref38 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(_temp) {
43904
+ var _ref39, _ref39$keepOriginalTr, keepOriginalTrack, videoTrack;
43895
43905
  return _regenerator.default.wrap(function _callee27$(_context27) {
43896
43906
  while (1) switch (_context27.prev = _context27.next) {
43897
43907
  case 0:
43908
+ _ref39 = _temp === void 0 ? {} : _temp, _ref39$keepOriginalTr = _ref39.keepOriginalTrack, keepOriginalTrack = _ref39$keepOriginalTr === void 0 ? false : _ref39$keepOriginalTr;
43898
43909
  // We need to cache this since calling the method below will
43899
43910
  // clear this value.
43900
43911
  videoTrack = mediaProcessor.getOriginalVideoTrack(); // Note: this needs to be called before the `stop` method below. Reversing
43901
43912
  // the order may cause race conditions with the MP worker.
43902
- _context27.prev = 1;
43903
- _context27.next = 4;
43913
+ _context27.prev = 2;
43914
+ _context27.next = 5;
43904
43915
  return mediaProcessor.destroy();
43905
- case 4:
43906
- _context27.next = 9;
43916
+ case 5:
43917
+ _context27.next = 10;
43907
43918
  break;
43908
- case 6:
43909
- _context27.prev = 6;
43910
- _context27.t0 = _context27["catch"](1);
43919
+ case 7:
43920
+ _context27.prev = 7;
43921
+ _context27.t0 = _context27["catch"](2);
43911
43922
  logging.warn(`Error cleaning up mediaProcessor: ${_context27.t0}`);
43912
- case 9:
43923
+ case 10:
43913
43924
  // Since no filtering is being applied, we perform some cleanup. We
43914
43925
  // stop the original video track here since it's not being used
43915
- // anymore -- this also turns off the camera LED
43916
- videoTrack.stop();
43917
- case 10:
43926
+ // anymore -- this also turns off the camera LED.
43927
+ // When keepOriginalTrack is true the caller is reusing this track, so
43928
+ // we must not stop it.
43929
+ if (!keepOriginalTrack && videoTrack) {
43930
+ videoTrack.stop();
43931
+ }
43932
+ case 11:
43918
43933
  case "end":
43919
43934
  return _context27.stop();
43920
43935
  }
43921
- }, _callee27, null, [[1, 6]]);
43936
+ }, _callee27, null, [[2, 7]]);
43922
43937
  }));
43923
- return function destroyMediaProcessor() {
43938
+ return function destroyMediaProcessor(_x19) {
43924
43939
  return _ref38.apply(this, arguments);
43925
43940
  };
43926
43941
  }();
@@ -43949,7 +43964,7 @@ function PublisherFactory(_ref) {
43949
43964
  let currentVideoFilter;
43950
43965
  let currentAudioFilter;
43951
43966
  this._toggleVideo = (0, _blockCallsUntilComplete.default)( /*#__PURE__*/function () {
43952
- var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(shouldHaveVideo, videoDimensions) {
43967
+ var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(shouldHaveVideo, videoDimensions) {
43953
43968
  var _vidDevices$find;
43954
43969
  var vidDevices, oldTrack, oldTrackDeviceId, newTrack, videoFilter, originalVideoTrack, _originalVideoTrack;
43955
43970
  return _regenerator.default.wrap(function _callee28$(_context28) {
@@ -44110,12 +44125,12 @@ function PublisherFactory(_ref) {
44110
44125
  }
44111
44126
  }, _callee28, null, [[16, 20], [37, 43], [64, 70]]);
44112
44127
  }));
44113
- return function (_x19, _x20) {
44114
- return _ref39.apply(this, arguments);
44128
+ return function (_x20, _x21) {
44129
+ return _ref40.apply(this, arguments);
44115
44130
  };
44116
44131
  }());
44117
44132
  const resetCongestionLevelEstimationOnPeerConnection = (0, _cancellation.callWithCancellation)( /*#__PURE__*/function () {
44118
- var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(isActive, cancellation) {
44133
+ var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(isActive, cancellation) {
44119
44134
  var peerConnections;
44120
44135
  return _regenerator.default.wrap(function _callee29$(_context29) {
44121
44136
  while (1) switch (_context29.prev = _context29.next) {
@@ -44139,8 +44154,8 @@ function PublisherFactory(_ref) {
44139
44154
  }
44140
44155
  }, _callee29);
44141
44156
  }));
44142
- return function (_x21, _x22) {
44143
- return _ref40.apply(this, arguments);
44157
+ return function (_x22, _x23) {
44158
+ return _ref41.apply(this, arguments);
44144
44159
  };
44145
44160
  }());
44146
44161
  const resetAudioFallbackState = () => {
@@ -44150,7 +44165,7 @@ function PublisherFactory(_ref) {
44150
44165
  (_chromeMixin2 = chromeMixin) == null ? void 0 : _chromeMixin2.videoDisabledIndicator.setWarning(false);
44151
44166
  };
44152
44167
  const onAudioFallbackActiveVideo = /*#__PURE__*/function () {
44153
- var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(previousState) {
44168
+ var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(previousState) {
44154
44169
  var _chromeMixin3, _chromeMixin4;
44155
44170
  return _regenerator.default.wrap(function _callee30$(_context30) {
44156
44171
  while (1) switch (_context30.prev = _context30.next) {
@@ -44171,8 +44186,8 @@ function PublisherFactory(_ref) {
44171
44186
  }
44172
44187
  }, _callee30);
44173
44188
  }));
44174
- return function onAudioFallbackActiveVideo(_x23) {
44175
- return _ref41.apply(this, arguments);
44189
+ return function onAudioFallbackActiveVideo(_x24) {
44190
+ return _ref42.apply(this, arguments);
44176
44191
  };
44177
44192
  }();
44178
44193
  const onAudioFallbackActiveVideoWithWarning = () => {
@@ -44183,7 +44198,7 @@ function PublisherFactory(_ref) {
44183
44198
  this.trigger('videoDisableWarning');
44184
44199
  };
44185
44200
  const onAudioFallbackSuspendedVideo = /*#__PURE__*/function () {
44186
- var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
44201
+ var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
44187
44202
  var _chromeMixin6;
44188
44203
  return _regenerator.default.wrap(function _callee31$(_context31) {
44189
44204
  while (1) switch (_context31.prev = _context31.next) {
@@ -44201,7 +44216,7 @@ function PublisherFactory(_ref) {
44201
44216
  }, _callee31);
44202
44217
  }));
44203
44218
  return function onAudioFallbackSuspendedVideo() {
44204
- return _ref42.apply(this, arguments);
44219
+ return _ref43.apply(this, arguments);
44205
44220
  };
44206
44221
  }();
44207
44222
  let audioFallbackCoordinator;
@@ -44214,9 +44229,9 @@ function PublisherFactory(_ref) {
44214
44229
  [_audioFallbackVideoStates.default.ACTIVE_VIDEO_WITH_WARNING]: onAudioFallbackActiveVideoWithWarning,
44215
44230
  [_audioFallbackVideoStates.default.SUSPENDED_VIDEO]: onAudioFallbackSuspendedVideo
44216
44231
  };
44217
- audioFallbackCoordinator.on('stateChange', _ref43 => {
44218
- let previousState = _ref43.previousState,
44219
- audioFallbackVideoState = _ref43.state;
44232
+ audioFallbackCoordinator.on('stateChange', _ref44 => {
44233
+ let previousState = _ref44.previousState,
44234
+ audioFallbackVideoState = _ref44.state;
44220
44235
  try {
44221
44236
  audioFallbackStateHandlers[audioFallbackVideoState](previousState);
44222
44237
  } catch (err) {
@@ -44270,6 +44285,7 @@ function PublisherFactory(_ref) {
44270
44285
  * @see <a href="Stream.html#hasVideo">Stream.hasVideo</a>
44271
44286
  * @see StreamPropertyChangedEvent
44272
44287
  * @method #publishVideo
44288
+ * @return {Publisher}
44273
44289
  * @memberOf Publisher
44274
44290
  */
44275
44291
  this.publishVideo = (value, completionHandler) => {
@@ -44333,7 +44349,7 @@ function PublisherFactory(_ref) {
44333
44349
  });
44334
44350
  });
44335
44351
  this._publishVideo = /*#__PURE__*/function () {
44336
- var _ref44 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(value) {
44352
+ var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(value) {
44337
44353
  var videoDimensions;
44338
44354
  return _regenerator.default.wrap(function _callee32$(_context32) {
44339
44355
  while (1) switch (_context32.prev = _context32.next) {
@@ -44358,8 +44374,8 @@ function PublisherFactory(_ref) {
44358
44374
  }
44359
44375
  }, _callee32);
44360
44376
  }));
44361
- return function (_x24) {
44362
- return _ref44.apply(this, arguments);
44377
+ return function (_x25) {
44378
+ return _ref45.apply(this, arguments);
44363
44379
  };
44364
44380
  }();
44365
44381
 
@@ -44744,7 +44760,7 @@ function PublisherFactory(_ref) {
44744
44760
  {
44745
44761
  let videoIndex = 0;
44746
44762
  const cycleVideo = /*#__PURE__*/function () {
44747
- var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33() {
44763
+ var _ref46 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33() {
44748
44764
  var oldTrack, vidDevices, hasOtherVideoDevices, newVideoDevice, deviceId;
44749
44765
  return _regenerator.default.wrap(function _callee33$(_context33) {
44750
44766
  while (1) switch (_context33.prev = _context33.next) {
@@ -44798,7 +44814,7 @@ function PublisherFactory(_ref) {
44798
44814
  }, _callee33);
44799
44815
  }));
44800
44816
  return function cycleVideo() {
44801
- return _ref45.apply(this, arguments);
44817
+ return _ref46.apply(this, arguments);
44802
44818
  };
44803
44819
  }();
44804
44820
 
@@ -44872,7 +44888,7 @@ function PublisherFactory(_ref) {
44872
44888
  })));
44873
44889
  }
44874
44890
  const replaceTrackAndUpdate = /*#__PURE__*/function () {
44875
- var _ref47 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(oldTrack, newTrack) {
44891
+ var _ref48 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(oldTrack, newTrack) {
44876
44892
  var pcs, video;
44877
44893
  return _regenerator.default.wrap(function _callee36$(_context36) {
44878
44894
  while (1) switch (_context36.prev = _context36.next) {
@@ -44883,7 +44899,7 @@ function PublisherFactory(_ref) {
44883
44899
  pcs = _context36.sent;
44884
44900
  _context36.next = 5;
44885
44901
  return Promise.all(pcs.map( /*#__PURE__*/function () {
44886
- var _ref48 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(pc) {
44902
+ var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(pc) {
44887
44903
  return _regenerator.default.wrap(function _callee35$(_context35) {
44888
44904
  while (1) switch (_context35.prev = _context35.next) {
44889
44905
  case 0:
@@ -44897,8 +44913,8 @@ function PublisherFactory(_ref) {
44897
44913
  }
44898
44914
  }, _callee35);
44899
44915
  }));
44900
- return function (_x27) {
44901
- return _ref48.apply(this, arguments);
44916
+ return function (_x28) {
44917
+ return _ref49.apply(this, arguments);
44902
44918
  };
44903
44919
  }()));
44904
44920
  case 5:
@@ -44934,12 +44950,12 @@ function PublisherFactory(_ref) {
44934
44950
  }
44935
44951
  }, _callee36);
44936
44952
  }));
44937
- return function replaceTrackAndUpdate(_x25, _x26) {
44938
- return _ref47.apply(this, arguments);
44953
+ return function replaceTrackAndUpdate(_x26, _x27) {
44954
+ return _ref48.apply(this, arguments);
44939
44955
  };
44940
44956
  }();
44941
44957
  const getTrackFromDeviceId = /*#__PURE__*/function () {
44942
- var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37(deviceId) {
44958
+ var _ref50 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37(deviceId) {
44943
44959
  var _newVideoStream;
44944
44960
  var oldTrackDeviceId, newOptions, _processedOptions2, getUserMediaHelper, newVideoStream, _newVideoStream$getVi, track;
44945
44961
  return _regenerator.default.wrap(function _callee37$(_context37) {
@@ -44980,8 +44996,8 @@ function PublisherFactory(_ref) {
44980
44996
  }
44981
44997
  }, _callee37, null, [[8, 14]]);
44982
44998
  }));
44983
- return function getTrackFromDeviceId(_x28) {
44984
- return _ref49.apply(this, arguments);
44999
+ return function getTrackFromDeviceId(_x29) {
45000
+ return _ref50.apply(this, arguments);
44985
45001
  };
44986
45002
  }();
44987
45003
  const getCurrentTrack = () => {
@@ -44998,7 +45014,7 @@ function PublisherFactory(_ref) {
44998
45014
  _currentTrackDeviceId = deviceId;
44999
45015
  };
45000
45016
  const getVideoDevices = /*#__PURE__*/function () {
45001
- var _ref50 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38() {
45017
+ var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38() {
45002
45018
  var devices, vidDevices;
45003
45019
  return _regenerator.default.wrap(function _callee38$(_context38) {
45004
45020
  while (1) switch (_context38.prev = _context38.next) {
@@ -45022,11 +45038,11 @@ function PublisherFactory(_ref) {
45022
45038
  }, _callee38);
45023
45039
  }));
45024
45040
  return function getVideoDevices() {
45025
- return _ref50.apply(this, arguments);
45041
+ return _ref51.apply(this, arguments);
45026
45042
  };
45027
45043
  }();
45028
45044
  const replaceAudioTrackInPeerConnections = /*#__PURE__*/function () {
45029
- var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39(oldTrack, newTrack) {
45045
+ var _ref52 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39(oldTrack, newTrack) {
45030
45046
  var _this$session$session2;
45031
45047
  var activePeerConnection, inactivePeerConnection, pcs;
45032
45048
  return _regenerator.default.wrap(function _callee39$(_context39) {
@@ -45071,12 +45087,12 @@ function PublisherFactory(_ref) {
45071
45087
  }
45072
45088
  }, _callee39);
45073
45089
  }));
45074
- return function replaceAudioTrackInPeerConnections(_x29, _x30) {
45075
- return _ref51.apply(this, arguments);
45090
+ return function replaceAudioTrackInPeerConnections(_x30, _x31) {
45091
+ return _ref52.apply(this, arguments);
45076
45092
  };
45077
45093
  }();
45078
45094
  const replaceAudioTrack = /*#__PURE__*/function () {
45079
- var _ref52 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(oldTrack, newTrack) {
45095
+ var _ref53 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(oldTrack, newTrack) {
45080
45096
  var video, isFilteredTrack;
45081
45097
  return _regenerator.default.wrap(function _callee40$(_context40) {
45082
45098
  while (1) switch (_context40.prev = _context40.next) {
@@ -45133,12 +45149,12 @@ function PublisherFactory(_ref) {
45133
45149
  }
45134
45150
  }, _callee40);
45135
45151
  }));
45136
- return function replaceAudioTrack(_x31, _x32) {
45137
- return _ref52.apply(this, arguments);
45152
+ return function replaceAudioTrack(_x32, _x33) {
45153
+ return _ref53.apply(this, arguments);
45138
45154
  };
45139
45155
  }();
45140
45156
  const resetAudioSource = /*#__PURE__*/function () {
45141
- var _ref53 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41(audioTrack) {
45157
+ var _ref54 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41(audioTrack) {
45142
45158
  var audioDeviceId, newAudioTrack;
45143
45159
  return _regenerator.default.wrap(function _callee41$(_context41) {
45144
45160
  while (1) switch (_context41.prev = _context41.next) {
@@ -45166,8 +45182,8 @@ function PublisherFactory(_ref) {
45166
45182
  }
45167
45183
  }, _callee41, null, [[1, 8]]);
45168
45184
  }));
45169
- return function resetAudioSource(_x33) {
45170
- return _ref53.apply(this, arguments);
45185
+ return function resetAudioSource(_x34) {
45186
+ return _ref54.apply(this, arguments);
45171
45187
  };
45172
45188
  }();
45173
45189
 
@@ -45181,7 +45197,7 @@ function PublisherFactory(_ref) {
45181
45197
  }
45182
45198
  // trigger the handler onVisibilityChange
45183
45199
  const visibilityHandler = /*#__PURE__*/function () {
45184
- var _ref54 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42() {
45200
+ var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42() {
45185
45201
  return _regenerator.default.wrap(function _callee42$(_context42) {
45186
45202
  while (1) switch (_context42.prev = _context42.next) {
45187
45203
  case 0:
@@ -45203,7 +45219,7 @@ function PublisherFactory(_ref) {
45203
45219
  }, _callee42);
45204
45220
  }));
45205
45221
  return function visibilityHandler() {
45206
- return _ref54.apply(this, arguments);
45222
+ return _ref55.apply(this, arguments);
45207
45223
  };
45208
45224
  }();
45209
45225
  document.addEventListener('visibilitychange', visibilityHandler);
@@ -45284,7 +45300,7 @@ function PublisherFactory(_ref) {
45284
45300
  };
45285
45301
  const isMediaStreamTrack = track => track instanceof MediaStreamTrack || track && typeof track === 'object' && Object.getPrototypeOf(track).toString().includes('MediaStreamTrack');
45286
45302
  const setAudioSource = /*#__PURE__*/function () {
45287
- var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(audioSource) {
45303
+ var _ref56 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(audioSource) {
45288
45304
  var currentCancelSentinel, setStreamIfNotCancelled, prevAudioSource, newTrack, newOptions, prevLabel, prevDeviceId, _processedOptions3, getUserMediaHelper, prevOptions, previousDevice, stream;
45289
45305
  return _regenerator.default.wrap(function _callee44$(_context44) {
45290
45306
  while (1) switch (_context44.prev = _context44.next) {
@@ -45297,7 +45313,7 @@ function PublisherFactory(_ref) {
45297
45313
  case 2:
45298
45314
  currentCancelSentinel = getSetAudioSourceCancellationSentinel();
45299
45315
  setStreamIfNotCancelled = /*#__PURE__*/function () {
45300
- var _ref56 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43(stream) {
45316
+ var _ref57 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43(stream) {
45301
45317
  return _regenerator.default.wrap(function _callee43$(_context43) {
45302
45318
  while (1) switch (_context43.prev = _context43.next) {
45303
45319
  case 0:
@@ -45315,8 +45331,8 @@ function PublisherFactory(_ref) {
45315
45331
  }
45316
45332
  }, _callee43);
45317
45333
  }));
45318
- return function setStreamIfNotCancelled(_x35) {
45319
- return _ref56.apply(this, arguments);
45334
+ return function setStreamIfNotCancelled(_x36) {
45335
+ return _ref57.apply(this, arguments);
45320
45336
  };
45321
45337
  }();
45322
45338
  prevAudioSource = _this._getAudioSource();
@@ -45451,8 +45467,8 @@ function PublisherFactory(_ref) {
45451
45467
  }
45452
45468
  }, _callee44, null, [[11, 20], [37, 47]]);
45453
45469
  }));
45454
- return function setAudioSource(_x34) {
45455
- return _ref55.apply(this, arguments);
45470
+ return function setAudioSource(_x35) {
45471
+ return _ref56.apply(this, arguments);
45456
45472
  };
45457
45473
  }();
45458
45474
  this.setAudioSource = setAudioSource;
@@ -45561,14 +45577,14 @@ function PublisherFactory(_ref) {
45561
45577
  }
45562
45578
  }, _callee45);
45563
45579
  }));
45564
- function setVideoSource(_x36) {
45580
+ function setVideoSource(_x37) {
45565
45581
  return _setVideoSource.apply(this, arguments);
45566
45582
  }
45567
45583
  return setVideoSource;
45568
45584
  }();
45569
45585
  this.setVideoSource = setVideoSource;
45570
45586
  const attemptToSetVideoTrack = /*#__PURE__*/function () {
45571
- var _ref57 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(newVideoDeviceId, action) {
45587
+ var _ref58 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(newVideoDeviceId, action) {
45572
45588
  var _originalVideoTrack2;
45573
45589
  var oldDeviceID, oldTrack, supportedBrowsers, videoFilterToReapplyOnAndroid, newVideoTrack, originalVideoTrack;
45574
45590
  return _regenerator.default.wrap(function _callee46$(_context46) {
@@ -45688,8 +45704,8 @@ function PublisherFactory(_ref) {
45688
45704
  }
45689
45705
  }, _callee46, null, [[16, 22]]);
45690
45706
  }));
45691
- return function attemptToSetVideoTrack(_x37, _x38) {
45692
- return _ref57.apply(this, arguments);
45707
+ return function attemptToSetVideoTrack(_x38, _x39) {
45708
+ return _ref58.apply(this, arguments);
45693
45709
  };
45694
45710
  }();
45695
45711
 
@@ -45789,8 +45805,8 @@ function PublisherFactory(_ref) {
45789
45805
  return;
45790
45806
  }
45791
45807
  this.once('initSuccess', resolve);
45792
- this.once('destroyed', _ref58 => {
45793
- let reason = _ref58.reason;
45808
+ this.once('destroyed', _ref59 => {
45809
+ let reason = _ref59.reason;
45794
45810
  let reasonDescription = '';
45795
45811
  if (reason) {
45796
45812
  reasonDescription = ` Reason: ${reason}`;
@@ -45961,7 +45977,7 @@ function PublisherFactory(_ref) {
45961
45977
  throw err;
45962
45978
  });
45963
45979
  return Promise.all([streamCreatedPromise, completedPromise]).catch( /*#__PURE__*/function () {
45964
- var _ref59 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(err) {
45980
+ var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(err) {
45965
45981
  return _regenerator.default.wrap(function _callee48$(_context48) {
45966
45982
  while (1) switch (_context48.prev = _context48.next) {
45967
45983
  case 0:
@@ -45977,8 +45993,8 @@ function PublisherFactory(_ref) {
45977
45993
  }
45978
45994
  }, _callee48);
45979
45995
  }));
45980
- return function (_x39) {
45981
- return _ref59.apply(this, arguments);
45996
+ return function (_x40) {
45997
+ return _ref60.apply(this, arguments);
45982
45998
  };
45983
45999
  }());
45984
46000
  },
@@ -46082,7 +46098,7 @@ function PublisherFactory(_ref) {
46082
46098
  var _this$session24, _this$session24$sessi;
46083
46099
  clearTimeout(_migrationTimeoutId);
46084
46100
  const destroyPeerConnection = /*#__PURE__*/function () {
46085
- var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(pc) {
46101
+ var _ref61 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(pc) {
46086
46102
  var _getPeerConnectionMet8, peerConnectionId;
46087
46103
  return _regenerator.default.wrap(function _callee50$(_context50) {
46088
46104
  while (1) switch (_context50.prev = _context50.next) {
@@ -46104,8 +46120,8 @@ function PublisherFactory(_ref) {
46104
46120
  }
46105
46121
  }, _callee50);
46106
46122
  }));
46107
- return function destroyPeerConnection(_x40) {
46108
- return _ref60.apply(this, arguments);
46123
+ return function destroyPeerConnection(_x41) {
46124
+ return _ref61.apply(this, arguments);
46109
46125
  };
46110
46126
  }();
46111
46127
 
@@ -46314,7 +46330,7 @@ function PublisherFactory(_ref) {
46314
46330
  }
46315
46331
  }, _callee53);
46316
46332
  }));
46317
- function setCongestionLevel(_x41, _x42) {
46333
+ function setCongestionLevel(_x42, _x43) {
46318
46334
  return _setCongestionLevel.apply(this, arguments);
46319
46335
  }
46320
46336
  return setCongestionLevel;
@@ -46714,7 +46730,7 @@ function PublisherFactory(_ref) {
46714
46730
  * If there is an error, the promise is rejected and no new video filter is set.
46715
46731
  */
46716
46732
  this.applyVideoFilter = /*#__PURE__*/function () {
46717
- var _ref61 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(videoFilter, avoidOriginalTrackLeak) {
46733
+ var _ref62 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(videoFilter, avoidOriginalTrackLeak) {
46718
46734
  var sanitizedVideoFilter, isSupported, message, _webRTCStream$getVide2, originalVideoTrack, filteredVideoTrack;
46719
46735
  return _regenerator.default.wrap(function _callee54$(_context54) {
46720
46736
  while (1) switch (_context54.prev = _context54.next) {
@@ -46847,8 +46863,8 @@ function PublisherFactory(_ref) {
46847
46863
  }
46848
46864
  }, _callee54, null, [[3, 55], [25, 33]]);
46849
46865
  }));
46850
- return function (_x43, _x44) {
46851
- return _ref61.apply(this, arguments);
46866
+ return function (_x44, _x45) {
46867
+ return _ref62.apply(this, arguments);
46852
46868
  };
46853
46869
  }();
46854
46870
 
@@ -46955,7 +46971,7 @@ function PublisherFactory(_ref) {
46955
46971
  * If there is an error, the promise is rejected and no new video filter is set.
46956
46972
  */
46957
46973
  this.applyAudioFilter = /*#__PURE__*/function () {
46958
- var _ref62 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55(audioFilter) {
46974
+ var _ref63 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55(audioFilter) {
46959
46975
  var isSupported, message, _getNoiseSuppressionC, assetsDirBaseUrl, vonageNoiseSuppression, noiseSuppressionConnector;
46960
46976
  return _regenerator.default.wrap(function _callee55$(_context55) {
46961
46977
  while (1) switch (_context55.prev = _context55.next) {
@@ -47051,8 +47067,8 @@ function PublisherFactory(_ref) {
47051
47067
  }
47052
47068
  }, _callee55, null, [[20, 34]]);
47053
47069
  }));
47054
- return function (_x45) {
47055
- return _ref62.apply(this, arguments);
47070
+ return function (_x46) {
47071
+ return _ref63.apply(this, arguments);
47056
47072
  };
47057
47073
  }();
47058
47074
 
@@ -47235,7 +47251,7 @@ function PublisherFactory(_ref) {
47235
47251
  * If there is an error, the promise is rejected and no connector is set.
47236
47252
  */
47237
47253
  this.setVideoMediaProcessorConnector = /*#__PURE__*/function () {
47238
- var _ref64 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(mediaProcessorConnector) {
47254
+ var _ref65 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(mediaProcessorConnector) {
47239
47255
  var _webRTCStream$getVide3, filteredVideoTrack, videoTrack, _webRTCStream$getVide4, originalVideoTrack, message;
47240
47256
  return _regenerator.default.wrap(function _callee57$(_context57) {
47241
47257
  while (1) switch (_context57.prev = _context57.next) {
@@ -47329,8 +47345,8 @@ function PublisherFactory(_ref) {
47329
47345
  }
47330
47346
  }, _callee57, null, [[29, 38]]);
47331
47347
  }));
47332
- return function (_x46) {
47333
- return _ref64.apply(this, arguments);
47348
+ return function (_x47) {
47349
+ return _ref65.apply(this, arguments);
47334
47350
  };
47335
47351
  }();
47336
47352
 
@@ -47394,7 +47410,7 @@ function PublisherFactory(_ref) {
47394
47410
  * If there is an error, the promise is rejected and no connector is set.
47395
47411
  */
47396
47412
  this.setAudioMediaProcessorConnector = /*#__PURE__*/function () {
47397
- var _ref65 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(mediaProcessorConnector) {
47413
+ var _ref66 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(mediaProcessorConnector) {
47398
47414
  return _regenerator.default.wrap(function _callee58$(_context58) {
47399
47415
  while (1) switch (_context58.prev = _context58.next) {
47400
47416
  case 0:
@@ -47423,12 +47439,12 @@ function PublisherFactory(_ref) {
47423
47439
  }
47424
47440
  }, _callee58, null, [[1, 7]]);
47425
47441
  }));
47426
- return function (_x47) {
47427
- return _ref65.apply(this, arguments);
47442
+ return function (_x48) {
47443
+ return _ref66.apply(this, arguments);
47428
47444
  };
47429
47445
  }();
47430
47446
  const _setAudioMediaProcessorConnector = /*#__PURE__*/function () {
47431
- var _ref66 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(mediaProcessorConnector) {
47447
+ var _ref67 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(mediaProcessorConnector) {
47432
47448
  var message, _webRTCStream$getAudi, filteredAudioTrack, _webRTCStream$getAudi2, originalAudioTrack;
47433
47449
  return _regenerator.default.wrap(function _callee59$(_context59) {
47434
47450
  while (1) switch (_context59.prev = _context59.next) {
@@ -47497,8 +47513,8 @@ function PublisherFactory(_ref) {
47497
47513
  }
47498
47514
  }, _callee59, null, [[21, 29]]);
47499
47515
  }));
47500
- return function _setAudioMediaProcessorConnector(_x48) {
47501
- return _ref66.apply(this, arguments);
47516
+ return function _setAudioMediaProcessorConnector(_x49) {
47517
+ return _ref67.apply(this, arguments);
47502
47518
  };
47503
47519
  }();
47504
47520
 
@@ -47520,7 +47536,7 @@ function PublisherFactory(_ref) {
47520
47536
  * If there is an error, the promise is rejected.
47521
47537
  */
47522
47538
  this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
47523
- var message, oldVideoFilter, _webRTCStream$getVide5, filteredVideoTrack, videoTrack;
47539
+ var message, oldVideoFilter, _webRTCStream$getVide5, filteredVideoTrack, originalVideoTrack, videoTrack, _properties$videoDime3, _properties$videoDime4;
47524
47540
  return _regenerator.default.wrap(function _callee60$(_context60) {
47525
47541
  while (1) switch (_context60.prev = _context60.next) {
47526
47542
  case 0:
@@ -47568,53 +47584,79 @@ function PublisherFactory(_ref) {
47568
47584
  case 20:
47569
47585
  oldVideoFilter = currentVideoFilter;
47570
47586
  currentVideoFilter = null;
47571
- _webRTCStream$getVide5 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide5[0];
47572
- _context60.prev = 23;
47573
- _context60.next = 26;
47587
+ _webRTCStream$getVide5 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide5[0]; // Prefer the original pre-filter track from the MediaProcessor. It is already at
47588
+ // the correct resolution — including any setPreferredResolution constraints applied
47589
+ // before the filter was set — so reusing it avoids the visual zoom that would occur
47590
+ // if the camera were reacquired at its initial/default resolution.
47591
+ originalVideoTrack = typeof (mediaProcessor == null ? void 0 : mediaProcessor.getOriginalVideoTrack) === 'function' ? mediaProcessor.getOriginalVideoTrack() : null;
47592
+ videoTrack = originalVideoTrack;
47593
+ if (videoTrack) {
47594
+ _context60.next = 44;
47595
+ break;
47596
+ }
47597
+ _context60.prev = 26;
47598
+ _context60.next = 29;
47574
47599
  return getTrackFromDeviceId(currentDeviceId);
47575
- case 26:
47600
+ case 29:
47576
47601
  videoTrack = _context60.sent;
47577
- _context60.next = 33;
47602
+ _context60.next = 36;
47578
47603
  break;
47579
- case 29:
47580
- _context60.prev = 29;
47581
- _context60.t0 = _context60["catch"](23);
47604
+ case 32:
47605
+ _context60.prev = 32;
47606
+ _context60.t0 = _context60["catch"](26);
47582
47607
  logging.error(_context60.t0);
47583
47608
  return _context60.abrupt("return");
47584
- case 33:
47609
+ case 36:
47610
+ _context60.prev = 36;
47611
+ _context60.next = 39;
47612
+ return applyVideoConstraintsTo(videoTrack, {
47613
+ width: (_properties$videoDime3 = properties.videoDimensions) == null ? void 0 : _properties$videoDime3.width,
47614
+ height: (_properties$videoDime4 = properties.videoDimensions) == null ? void 0 : _properties$videoDime4.height,
47615
+ frameRate: properties.frameRate
47616
+ });
47617
+ case 39:
47618
+ _context60.next = 44;
47619
+ break;
47620
+ case 41:
47621
+ _context60.prev = 41;
47622
+ _context60.t1 = _context60["catch"](36);
47623
+ logging.warn(`clearVideoFilter: could not pre-apply constraints to restored track: ${_context60.t1}`);
47624
+ case 44:
47585
47625
  if (videoTrack) {
47586
- _context60.next = 36;
47626
+ _context60.next = 47;
47587
47627
  break;
47588
47628
  }
47589
47629
  logging.warn('Failed to clear filter because there is no video track.');
47590
47630
  return _context60.abrupt("return");
47591
- case 36:
47631
+ case 47:
47592
47632
  filteredVideoTrackId = null;
47593
- _context60.prev = 37;
47594
- _context60.next = 40;
47633
+ _context60.prev = 48;
47634
+ _context60.next = 51;
47595
47635
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
47596
- case 40:
47597
- _context60.next = 42;
47598
- return destroyMediaProcessor();
47599
- case 42:
47600
- _context60.next = 47;
47636
+ case 51:
47637
+ _context60.next = 53;
47638
+ return destroyMediaProcessor({
47639
+ keepOriginalTrack: !!originalVideoTrack
47640
+ });
47641
+ case 53:
47642
+ _context60.next = 58;
47601
47643
  break;
47602
- case 44:
47603
- _context60.prev = 44;
47604
- _context60.t1 = _context60["catch"](37);
47644
+ case 55:
47645
+ _context60.prev = 55;
47646
+ _context60.t2 = _context60["catch"](48);
47605
47647
  // Restore the previous filter since this call has failed. This way, this function can be
47606
47648
  // called again if needed.
47607
47649
  currentVideoFilter = oldVideoFilter;
47608
- case 47:
47650
+ case 58:
47609
47651
  logAnalyticsEvent('clearVideoFilter', 'Success');
47610
- case 48:
47652
+ case 59:
47611
47653
  case "end":
47612
47654
  return _context60.stop();
47613
47655
  }
47614
- }, _callee60, null, [[23, 29], [37, 44]]);
47656
+ }, _callee60, null, [[26, 32], [36, 41], [48, 55]]);
47615
47657
  }));
47616
47658
  const applySetMaxBitrateToPeerConnection = /*#__PURE__*/function () {
47617
- var _ref68 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61(peerConnection) {
47659
+ var _ref69 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61(peerConnection) {
47618
47660
  var maxBitrateHasChanged, isPreset;
47619
47661
  return _regenerator.default.wrap(function _callee61$(_context61) {
47620
47662
  while (1) switch (_context61.prev = _context61.next) {
@@ -47647,8 +47689,8 @@ function PublisherFactory(_ref) {
47647
47689
  }
47648
47690
  }, _callee61);
47649
47691
  }));
47650
- return function applySetMaxBitrateToPeerConnection(_x49) {
47651
- return _ref68.apply(this, arguments);
47692
+ return function applySetMaxBitrateToPeerConnection(_x50) {
47693
+ return _ref69.apply(this, arguments);
47652
47694
  };
47653
47695
  }();
47654
47696
 
@@ -47676,7 +47718,7 @@ function PublisherFactory(_ref) {
47676
47718
  */
47677
47719
  this.getVideoBitratePreset = () => properties.videoBitratePreset;
47678
47720
  const setMaxVideoBitrateToPublisher = /*#__PURE__*/function () {
47679
- var _ref69 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63(peerConnection) {
47721
+ var _ref70 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63(peerConnection) {
47680
47722
  var logOptions, applyMaxBitrate, peerConnections;
47681
47723
  return _regenerator.default.wrap(function _callee63$(_context63) {
47682
47724
  while (1) switch (_context63.prev = _context63.next) {
@@ -47701,7 +47743,7 @@ function PublisherFactory(_ref) {
47701
47743
  logOptions.NearestResolution = (0, _getSpatialResolution.default)(_this.videoWidth(), _this.videoHeight());
47702
47744
  logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Attempt', {}, logOptions);
47703
47745
  applyMaxBitrate = /*#__PURE__*/function () {
47704
- var _ref70 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62(pc) {
47746
+ var _ref71 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62(pc) {
47705
47747
  return _regenerator.default.wrap(function _callee62$(_context62) {
47706
47748
  while (1) switch (_context62.prev = _context62.next) {
47707
47749
  case 0:
@@ -47724,8 +47766,8 @@ function PublisherFactory(_ref) {
47724
47766
  }
47725
47767
  }, _callee62, null, [[0, 6]]);
47726
47768
  }));
47727
- return function applyMaxBitrate(_x51) {
47728
- return _ref70.apply(this, arguments);
47769
+ return function applyMaxBitrate(_x52) {
47770
+ return _ref71.apply(this, arguments);
47729
47771
  };
47730
47772
  }();
47731
47773
  if (!peerConnection) {
@@ -47750,23 +47792,29 @@ function PublisherFactory(_ref) {
47750
47792
  }
47751
47793
  }, _callee63);
47752
47794
  }));
47753
- return function setMaxVideoBitrateToPublisher(_x50) {
47754
- return _ref69.apply(this, arguments);
47795
+ return function setMaxVideoBitrateToPublisher(_x51) {
47796
+ return _ref70.apply(this, arguments);
47755
47797
  };
47756
47798
  }();
47757
- const applyVideoConstraintsTo = track => {
47758
- if (!_preferredWidth && !_preferredHeight && !_preferredFrameRate) {
47799
+ const applyVideoConstraintsTo = function applyVideoConstraintsTo(track, fallbackVideoTrackSettings) {
47800
+ if (fallbackVideoTrackSettings === void 0) {
47801
+ fallbackVideoTrackSettings = {};
47802
+ }
47803
+ const width = _preferredWidth || fallbackVideoTrackSettings.width;
47804
+ const height = _preferredHeight || fallbackVideoTrackSettings.height;
47805
+ const frameRate = _preferredFrameRate || fallbackVideoTrackSettings.frameRate;
47806
+ if (!width && !height && !frameRate) {
47759
47807
  return Promise.resolve();
47760
47808
  }
47761
47809
  const constraints = {
47762
47810
  width: {
47763
- ideal: _preferredWidth
47811
+ ideal: width
47764
47812
  },
47765
47813
  height: {
47766
- ideal: _preferredHeight
47814
+ ideal: height
47767
47815
  },
47768
47816
  frameRate: {
47769
- ideal: _preferredFrameRate
47817
+ ideal: frameRate
47770
47818
  }
47771
47819
  };
47772
47820
  return (0, _videoConstraints.default)(track, constraints);
@@ -47792,7 +47840,7 @@ function PublisherFactory(_ref) {
47792
47840
  }()) || track.id !== filteredVideoTrackId);
47793
47841
  });
47794
47842
  if (!videoTracks || videoTracks.length === 0) return Promise.resolve();
47795
- return Promise.all(videoTracks.map(applyVideoConstraintsTo));
47843
+ return Promise.all(videoTracks.map(track => applyVideoConstraintsTo(track)));
47796
47844
  };
47797
47845
 
47798
47846
  /**
@@ -47815,8 +47863,8 @@ function PublisherFactory(_ref) {
47815
47863
  * @memberOf Publisher
47816
47864
  */
47817
47865
  this.setPreferredResolution = /*#__PURE__*/function () {
47818
- var _ref71 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64(preferredResolution) {
47819
- var _webRTCStream3, _webRTCStream3$getVid, _properties$videoDime3, _properties$videoDime4;
47866
+ var _ref72 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64(preferredResolution) {
47867
+ var _webRTCStream3, _webRTCStream3$getVid, _properties$videoDime5, _properties$videoDime6;
47820
47868
  var message, startingWidth, startingHeight, startingArea, preferredArea, result, _getPreferredVideoTra2, width, height;
47821
47869
  return _regenerator.default.wrap(function _callee64$(_context64) {
47822
47870
  while (1) switch (_context64.prev = _context64.next) {
@@ -47846,8 +47894,8 @@ function PublisherFactory(_ref) {
47846
47894
  });
47847
47895
  throw new Error(message);
47848
47896
  case 9:
47849
- startingWidth = ((_properties$videoDime3 = properties.videoDimensions) == null ? void 0 : _properties$videoDime3.width) || publisherDefaultResolution.width;
47850
- startingHeight = ((_properties$videoDime4 = properties.videoDimensions) == null ? void 0 : _properties$videoDime4.height) || publisherDefaultResolution.height;
47897
+ startingWidth = ((_properties$videoDime5 = properties.videoDimensions) == null ? void 0 : _properties$videoDime5.width) || publisherDefaultResolution.width;
47898
+ startingHeight = ((_properties$videoDime6 = properties.videoDimensions) == null ? void 0 : _properties$videoDime6.height) || publisherDefaultResolution.height;
47851
47899
  startingArea = startingWidth * startingHeight;
47852
47900
  preferredArea = preferredResolution.width * preferredResolution.height;
47853
47901
  if (!(preferredArea > startingArea)) {
@@ -47904,8 +47952,8 @@ function PublisherFactory(_ref) {
47904
47952
  }
47905
47953
  }, _callee64, null, [[20, 33], [21,, 28, 31]]);
47906
47954
  }));
47907
- return function (_x52) {
47908
- return _ref71.apply(this, arguments);
47955
+ return function (_x53) {
47956
+ return _ref72.apply(this, arguments);
47909
47957
  };
47910
47958
  }();
47911
47959
 
@@ -47926,7 +47974,7 @@ function PublisherFactory(_ref) {
47926
47974
  * @memberOf Publisher
47927
47975
  */
47928
47976
  this.setPreferredFrameRate = /*#__PURE__*/function () {
47929
- var _ref72 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65(frameRate) {
47977
+ var _ref73 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65(frameRate) {
47930
47978
  var _webRTCStream4, _webRTCStream4$getVid;
47931
47979
  var message, result, _getPreferredVideoTra3, actualFrameRate;
47932
47980
  return _regenerator.default.wrap(function _callee65$(_context65) {
@@ -47987,8 +48035,8 @@ function PublisherFactory(_ref) {
47987
48035
  }
47988
48036
  }, _callee65, null, [[10, 19]]);
47989
48037
  }));
47990
- return function (_x53) {
47991
- return _ref72.apply(this, arguments);
48038
+ return function (_x54) {
48039
+ return _ref73.apply(this, arguments);
47992
48040
  };
47993
48041
  }();
47994
48042
 
@@ -48012,7 +48060,7 @@ function PublisherFactory(_ref) {
48012
48060
  * @memberOf Publisher
48013
48061
  */
48014
48062
  this.setMaxVideoBitrate = /*#__PURE__*/function () {
48015
- var _ref73 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee66(bitrateBps) {
48063
+ var _ref74 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee66(bitrateBps) {
48016
48064
  var bitrate;
48017
48065
  return _regenerator.default.wrap(function _callee66$(_context66) {
48018
48066
  while (1) switch (_context66.prev = _context66.next) {
@@ -48048,8 +48096,8 @@ function PublisherFactory(_ref) {
48048
48096
  }
48049
48097
  }, _callee66);
48050
48098
  }));
48051
- return function (_x54) {
48052
- return _ref73.apply(this, arguments);
48099
+ return function (_x55) {
48100
+ return _ref74.apply(this, arguments);
48053
48101
  };
48054
48102
  }();
48055
48103
 
@@ -48071,7 +48119,7 @@ function PublisherFactory(_ref) {
48071
48119
  * @memberOf Publisher
48072
48120
  */
48073
48121
  this.setVideoBitratePreset = /*#__PURE__*/function () {
48074
- var _ref74 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee67(preset) {
48122
+ var _ref75 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee67(preset) {
48075
48123
  var filteredPreset;
48076
48124
  return _regenerator.default.wrap(function _callee67$(_context67) {
48077
48125
  while (1) switch (_context67.prev = _context67.next) {
@@ -48107,8 +48155,8 @@ function PublisherFactory(_ref) {
48107
48155
  }
48108
48156
  }, _callee67);
48109
48157
  }));
48110
- return function (_x55) {
48111
- return _ref74.apply(this, arguments);
48158
+ return function (_x56) {
48159
+ return _ref75.apply(this, arguments);
48112
48160
  };
48113
48161
  }();
48114
48162
 
@@ -60577,6 +60625,9 @@ function NativeVideoElementWrapperFactory(deps) {
60577
60625
  };
60578
60626
  _proto._removeAudioLevelSampler = function _removeAudioLevelSampler() {
60579
60627
  if (this._audioContext) {
60628
+ if (this._audioLevelSampler) {
60629
+ this._audioLevelSampler.destroy();
60630
+ }
60580
60631
  delete this._audioContext;
60581
60632
  delete this._audioLevelSampler;
60582
60633
  }