@dtelecom/livekit-client 1.12.22 → 1.12.24

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.
@@ -14202,7 +14202,7 @@ function getMatch(exp, ua) {
14202
14202
  return match && match.length >= id && match[id] || '';
14203
14203
  }
14204
14204
 
14205
- var version$1 = "1.12.22";
14205
+ var version$1 = "1.12.24";
14206
14206
 
14207
14207
  const version = version$1;
14208
14208
  const protocolVersion = 9;
@@ -16589,6 +16589,7 @@ class LocalTrack extends Track {
16589
16589
  this.muteLock = new Mutex();
16590
16590
  this.pauseUpstreamLock = new Mutex();
16591
16591
  this.processorLock = new Mutex();
16592
+ this.manuallyStopped = false;
16592
16593
  this.setMediaStreamTrack(mediaTrack, true);
16593
16594
  // added to satisfy TS compiler, constraints are synced with MediaStreamTrack
16594
16595
  this._constraints = mediaTrack.getConstraints();
@@ -16711,6 +16712,9 @@ class LocalTrack extends Track {
16711
16712
  }
16712
16713
  unmute() {
16713
16714
  return __awaiter(this, void 0, void 0, function* () {
16715
+ if (this.manuallyStopped) {
16716
+ return this;
16717
+ }
16714
16718
  this.setTrackMuted(false);
16715
16719
  return this;
16716
16720
  });
@@ -16734,6 +16738,7 @@ class LocalTrack extends Track {
16734
16738
  }
16735
16739
  restart(constraints) {
16736
16740
  return __awaiter(this, void 0, void 0, function* () {
16741
+ this.manuallyStopped = false;
16737
16742
  if (!constraints) {
16738
16743
  constraints = this._constraints;
16739
16744
  }
@@ -16760,6 +16765,10 @@ class LocalTrack extends Track {
16760
16765
  // create new track and attach
16761
16766
  const mediaStream = yield navigator.mediaDevices.getUserMedia(streamConstraints);
16762
16767
  const newTrack = mediaStream.getTracks()[0];
16768
+ if (this.manuallyStopped) {
16769
+ newTrack.stop();
16770
+ return this;
16771
+ }
16763
16772
  newTrack.addEventListener('ended', this.handleEnded);
16764
16773
  livekitLogger.debug('re-acquired MediaStreamTrack');
16765
16774
  yield this.setMediaStreamTrack(newTrack);
@@ -16773,6 +16782,9 @@ class LocalTrack extends Track {
16773
16782
  });
16774
16783
  }
16775
16784
  this.emit(TrackEvent.Restarted, this);
16785
+ if (this.manuallyStopped) {
16786
+ this.stop();
16787
+ }
16776
16788
  return this;
16777
16789
  });
16778
16790
  }
@@ -16807,6 +16819,7 @@ class LocalTrack extends Track {
16807
16819
  }
16808
16820
  stop() {
16809
16821
  var _a;
16822
+ this.manuallyStopped = true;
16810
16823
  super.stop();
16811
16824
  this._mediaStreamTrack.removeEventListener('ended', this.handleEnded);
16812
16825
  this._mediaStreamTrack.removeEventListener('mute', this.pauseUpstream);
@@ -23138,12 +23151,14 @@ class Room extends EventEmitter {
23138
23151
  }
23139
23152
  // also hook unload event
23140
23153
  if (isWeb() && this.options.disconnectOnPageLeave) {
23141
- // capturing both 'pagehide' and 'beforeunload' to capture broadest set of browser behaviors
23154
+ // capture page leave across browser behaviors
23142
23155
  window.addEventListener('pagehide', this.onPageLeave);
23143
- window.addEventListener('beforeunload', this.onPageLeave);
23156
+ if (this.options.disconnectOnPageLeave !== 'pagehide') {
23157
+ window.addEventListener('beforeunload', this.onPageLeave);
23158
+ }
23144
23159
  }
23145
23160
  if (isWeb()) {
23146
- document.addEventListener('freeze', this.onPageLeave);
23161
+ window.addEventListener('freeze', this.onPageLeave);
23147
23162
  (_c = navigator.mediaDevices) === null || _c === void 0 ? void 0 : _c.addEventListener('devicechange', this.handleDeviceChange);
23148
23163
  }
23149
23164
  this.setAndEmitConnectionState(ConnectionState.Connected);