livekit-client 1.14.3 → 1.15.0

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.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  3. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  4. package/dist/livekit-client.esm.mjs +25 -10
  5. package/dist/livekit-client.esm.mjs.map +1 -1
  6. package/dist/livekit-client.umd.js +1 -1
  7. package/dist/livekit-client.umd.js.map +1 -1
  8. package/dist/src/api/SignalClient.d.ts.map +1 -1
  9. package/dist/src/room/PCTransport.d.ts +1 -0
  10. package/dist/src/room/PCTransport.d.ts.map +1 -1
  11. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  12. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  13. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  14. package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
  15. package/dist/src/room/track/options.d.ts +12 -4
  16. package/dist/src/room/track/options.d.ts.map +1 -1
  17. package/dist/src/room/utils.d.ts.map +1 -1
  18. package/dist/src/test/mocks.d.ts +1 -1
  19. package/dist/src/test/mocks.d.ts.map +1 -1
  20. package/dist/ts4.2/src/room/PCTransport.d.ts +1 -0
  21. package/dist/ts4.2/src/room/track/options.d.ts +12 -4
  22. package/dist/ts4.2/src/test/mocks.d.ts +1 -1
  23. package/package.json +20 -19
  24. package/src/api/SignalClient.ts +7 -1
  25. package/src/room/PCTransport.ts +4 -0
  26. package/src/room/defaults.ts +1 -1
  27. package/src/room/participant/LocalParticipant.ts +4 -0
  28. package/src/room/participant/publishUtils.ts +6 -1
  29. package/src/room/track/LocalTrack.ts +2 -0
  30. package/src/room/track/RemoteAudioTrack.ts +7 -3
  31. package/src/room/track/options.ts +10 -2
  32. package/src/room/utils.ts +2 -1
  33. package/src/test/mocks.ts +5 -1
@@ -12045,7 +12045,7 @@ function getMatch(exp, ua) {
12045
12045
  return match && match.length >= id && match[id] || '';
12046
12046
  }
12047
12047
 
12048
- var version$1 = "1.14.3";
12048
+ var version$1 = "1.15.0";
12049
12049
 
12050
12050
  const version = version$1;
12051
12051
  const protocolVersion = 10;
@@ -13133,7 +13133,7 @@ function unpackStreamId(packed) {
13133
13133
  }
13134
13134
  function sleep(duration) {
13135
13135
  return __awaiter(this, void 0, void 0, function* () {
13136
- return new Promise(resolve => setTimeout(resolve, duration));
13136
+ return new Promise(resolve => CriticalTimers.setTimeout(resolve, duration));
13137
13137
  });
13138
13138
  }
13139
13139
  /** @internal */
@@ -13922,6 +13922,7 @@ class SignalClient {
13922
13922
  livekitLogger.debug('received unsupported message');
13923
13923
  return;
13924
13924
  }
13925
+ let pingHandled = false;
13925
13926
  if (msg.case === 'answer') {
13926
13927
  const sd = fromProtoSessionDescription(msg.value);
13927
13928
  if (this.onAnswer) {
@@ -13989,14 +13990,16 @@ class SignalClient {
13989
13990
  if (this.onSubscriptionError) {
13990
13991
  this.onSubscriptionError(msg.value);
13991
13992
  }
13992
- } else if (msg.case === 'pong') {
13993
- this.resetPingTimeout();
13994
- } else if (msg.case === 'pongResp') {
13993
+ } else if (msg.case === 'pong') ; else if (msg.case === 'pongResp') {
13995
13994
  this.rtt = Date.now() - Number.parseInt(msg.value.lastPingTimestamp.toString());
13996
13995
  this.resetPingTimeout();
13996
+ pingHandled = true;
13997
13997
  } else {
13998
13998
  livekitLogger.debug('unsupported message', msg);
13999
13999
  }
14000
+ if (!pingHandled) {
14001
+ this.resetPingTimeout();
14002
+ }
14000
14003
  }
14001
14004
  setReconnected() {
14002
14005
  while (this.queuedRequests.length > 0) {
@@ -14590,6 +14593,7 @@ class LocalTrack extends Track {
14590
14593
  this.attachedElements.forEach(el => {
14591
14594
  detachTrack(this._mediaStreamTrack, el);
14592
14595
  });
14596
+ this.debouncedTrackMuteHandler.cancel('new-track');
14593
14597
  this._mediaStreamTrack.removeEventListener('ended', this.handleEnded);
14594
14598
  this._mediaStreamTrack.removeEventListener('mute', this.handleTrackMuteEvent);
14595
14599
  this._mediaStreamTrack.removeEventListener('unmute', this.handleTrackUnmuteEvent);
@@ -16223,6 +16227,9 @@ class PCTransport extends eventsExports.EventEmitter {
16223
16227
  getRemoteDescription() {
16224
16228
  return this.pc.remoteDescription;
16225
16229
  }
16230
+ getStats() {
16231
+ return this.pc.getStats();
16232
+ }
16226
16233
  getConnectedAddress() {
16227
16234
  var _a;
16228
16235
  return __awaiter(this, void 0, void 0, function* () {
@@ -16434,7 +16441,7 @@ const publishDefaults = {
16434
16441
  screenShareEncoding: ScreenSharePresets.h1080fps15.encoding,
16435
16442
  stopMicTrackOnMute: false,
16436
16443
  videoCodec: defaultVideoCodec,
16437
- backupCodec: false
16444
+ backupCodec: true
16438
16445
  };
16439
16446
  const audioDefaults = {
16440
16447
  autoGainControl: true,
@@ -17963,7 +17970,8 @@ function computeVideoEncodings(isScreenShare, width, height, options) {
17963
17970
  }
17964
17971
  function computeTrackBackupEncodings(track, videoCodec, opts) {
17965
17972
  var _a, _b, _c, _d;
17966
- if (!opts.backupCodec || opts.backupCodec.codec === opts.videoCodec) {
17973
+ // backupCodec should not be true anymore, default codec is set in LocalParticipant.publish
17974
+ if (!opts.backupCodec || opts.backupCodec === true || opts.backupCodec.codec === opts.videoCodec) {
17967
17975
  // backup codec publishing is disabled
17968
17976
  return;
17969
17977
  }
@@ -18831,9 +18839,6 @@ class RemoteAudioTrack extends RemoteTrack {
18831
18839
  } else {
18832
18840
  super.attach(element);
18833
18841
  }
18834
- if (this.elementVolume) {
18835
- element.volume = this.elementVolume;
18836
- }
18837
18842
  if (this.sinkId && supportsSetSinkId(element)) {
18838
18843
  /* @ts-ignore */
18839
18844
  element.setSinkId(this.sinkId);
@@ -18844,6 +18849,10 @@ class RemoteAudioTrack extends RemoteTrack {
18844
18849
  element.volume = 0;
18845
18850
  element.muted = true;
18846
18851
  }
18852
+ if (this.elementVolume) {
18853
+ // make sure volume setting is being applied to the newly attached element
18854
+ this.setVolume(this.elementVolume);
18855
+ }
18847
18856
  return element;
18848
18857
  }
18849
18858
  detach(element) {
@@ -20783,7 +20792,13 @@ class LocalParticipant extends Participant {
20783
20792
  cid: track.mediaStreamTrack.id
20784
20793
  })];
20785
20794
  // set up backup
20795
+ if (opts.backupCodec === true) {
20796
+ opts.backupCodec = {
20797
+ codec: defaultVideoCodec
20798
+ };
20799
+ }
20786
20800
  if (opts.backupCodec && videoCodec !== opts.backupCodec.codec) {
20801
+ // multi-codec simulcast requires dynacast
20787
20802
  if (!this.roomOptions.dynacast) {
20788
20803
  this.roomOptions.dynacast = true;
20789
20804
  }