livekit-client 1.1.7 → 1.1.8

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.
@@ -10070,7 +10070,7 @@ function computeBitrate(currentStats, prevStats) {
10070
10070
  return (bytesNow - bytesPrev) * 8 * 1000 / (currentStats.timestamp - prevStats.timestamp);
10071
10071
  }
10072
10072
 
10073
- var version$1 = "1.1.7";
10073
+ var version$1 = "1.1.8";
10074
10074
 
10075
10075
  const version = version$1;
10076
10076
  const protocolVersion = 8;
@@ -10742,6 +10742,7 @@ class Track extends events.exports.EventEmitter {
10742
10742
 
10743
10743
  this.kind = kind;
10744
10744
  this._mediaStreamTrack = mediaTrack;
10745
+ this._mediaStreamID = mediaTrack.id;
10745
10746
  this.source = Track.Source.Unknown;
10746
10747
 
10747
10748
  if (isWeb()) {
@@ -10761,6 +10762,16 @@ class Track extends events.exports.EventEmitter {
10761
10762
  get mediaStreamTrack() {
10762
10763
  return this._mediaStreamTrack;
10763
10764
  }
10765
+ /**
10766
+ * @internal
10767
+ * used for keep mediaStream's first id, since it's id might change
10768
+ * if we disable/enable a track
10769
+ */
10770
+
10771
+
10772
+ get mediaStreamID() {
10773
+ return this._mediaStreamID;
10774
+ }
10764
10775
 
10765
10776
  attach(element) {
10766
10777
  let elementType = 'audio';
@@ -12553,6 +12564,9 @@ class TrackPublication extends events.exports.EventEmitter {
12553
12564
  }
12554
12565
 
12555
12566
  this.trackInfo = info;
12567
+ livekitLogger.trace('update publication info', {
12568
+ info
12569
+ });
12556
12570
  }
12557
12571
 
12558
12572
  }
@@ -12875,6 +12889,9 @@ class Participant extends events.exports.EventEmitter {
12875
12889
 
12876
12890
 
12877
12891
  this.participantInfo = info;
12892
+ livekitLogger.trace('update participant info', {
12893
+ info
12894
+ });
12878
12895
  }
12879
12896
  /** @internal */
12880
12897
 
@@ -13619,6 +13636,10 @@ class RemoteParticipant extends Participant {
13619
13636
 
13620
13637
  this.tracks.forEach(publication => {
13621
13638
  if (!validTracks.has(publication.trackSid)) {
13639
+ livekitLogger.trace('detected removed track on remote participant, unpublishing', {
13640
+ publication,
13641
+ participantSid: this.sid
13642
+ });
13622
13643
  this.unpublishTrack(publication.trackSid, true);
13623
13644
  }
13624
13645
  });
@@ -14603,7 +14624,7 @@ class LocalParticipant extends Participant {
14603
14624
  this.tracks.forEach(track => {
14604
14625
  if (track.track !== undefined) {
14605
14626
  infos.push({
14606
- cid: track.track.mediaStreamTrack.id,
14627
+ cid: track.track.mediaStreamID,
14607
14628
  track: track.trackInfo
14608
14629
  });
14609
14630
  }
@@ -19155,6 +19176,10 @@ class RTCEngine extends events.exports.EventEmitter {
19155
19176
  this.emit(EngineEvent.Disconnected);
19156
19177
  this.close();
19157
19178
  }
19179
+
19180
+ livekitLogger.trace('leave request', {
19181
+ leave
19182
+ });
19158
19183
  };
19159
19184
  }
19160
19185
 
@@ -19537,7 +19562,14 @@ class Room extends events.exports.EventEmitter {
19537
19562
  }); // populate remote participants, these should not trigger new events
19538
19563
 
19539
19564
  joinResponse.otherParticipants.forEach(info => {
19540
- this.getOrCreateParticipant(info.sid, info);
19565
+ if (info.sid !== this.localParticipant.sid && info.identity !== this.localParticipant.identity) {
19566
+ this.getOrCreateParticipant(info.sid, info);
19567
+ } else {
19568
+ livekitLogger.warn('received info to create local participant as remote participant', {
19569
+ info,
19570
+ localParticipant: this.localParticipant
19571
+ });
19572
+ }
19541
19573
  });
19542
19574
  this.name = joinResponse.room.name;
19543
19575
  this.sid = joinResponse.room.sid;
@@ -19894,7 +19926,7 @@ class Room extends events.exports.EventEmitter {
19894
19926
  this.engine.on(EngineEvent.MediaTrackAdded, (mediaTrack, stream, receiver) => {
19895
19927
  this.onTrackAdded(mediaTrack, stream, receiver);
19896
19928
  }).on(EngineEvent.Disconnected, () => {
19897
- this.handleDisconnect();
19929
+ this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
19898
19930
  }).on(EngineEvent.ActiveSpeakersUpdate, this.handleActiveSpeakersUpdate).on(EngineEvent.DataPacketReceived, this.handleDataPacket).on(EngineEvent.Resuming, () => {
19899
19931
  if (this.setAndEmitConnectionState(ConnectionState.Reconnecting)) {
19900
19932
  this.emit(RoomEvent.Reconnecting);
@@ -20129,6 +20161,12 @@ class Room extends events.exports.EventEmitter {
20129
20161
  const participantId = parts[0];
20130
20162
  let trackId = parts[1];
20131
20163
  if (!trackId || trackId === '') trackId = mediaTrack.id;
20164
+
20165
+ if (participantId === this.localParticipant.sid) {
20166
+ livekitLogger.warn('tried to create RemoteParticipant for local participant');
20167
+ return;
20168
+ }
20169
+
20132
20170
  const participant = this.getOrCreateParticipant(participantId);
20133
20171
  let adaptiveStreamSettings;
20134
20172