livekit-client 2.5.5 → 2.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/dist/livekit-client.e2ee.worker.js +1 -1
  2. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  3. package/dist/livekit-client.e2ee.worker.mjs +5443 -736
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +2129 -1954
  6. package/dist/livekit-client.esm.mjs.map +1 -1
  7. package/dist/livekit-client.umd.js +1 -1
  8. package/dist/livekit-client.umd.js.map +1 -1
  9. package/dist/src/e2ee/worker/FrameCryptor.d.ts +2 -2
  10. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  11. package/dist/src/index.d.ts +2 -2
  12. package/dist/src/index.d.ts.map +1 -1
  13. package/dist/src/room/Room.d.ts +2 -1
  14. package/dist/src/room/Room.d.ts.map +1 -1
  15. package/dist/src/room/events.d.ts +2 -2
  16. package/dist/src/room/participant/Participant.d.ts +1 -1
  17. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  18. package/dist/src/room/track/Track.d.ts +1 -1
  19. package/dist/src/room/track/Track.d.ts.map +1 -1
  20. package/dist/src/room/utils.d.ts +1 -1
  21. package/dist/src/room/utils.d.ts.map +1 -1
  22. package/dist/src/test/mocks.d.ts +1 -1
  23. package/dist/src/test/mocks.d.ts.map +1 -1
  24. package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +2 -2
  25. package/dist/ts4.2/src/index.d.ts +2 -2
  26. package/dist/ts4.2/src/room/Room.d.ts +2 -1
  27. package/dist/ts4.2/src/room/events.d.ts +2 -2
  28. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -1
  29. package/dist/ts4.2/src/room/track/Track.d.ts +1 -1
  30. package/dist/ts4.2/src/room/utils.d.ts +1 -1
  31. package/dist/ts4.2/src/test/mocks.d.ts +1 -1
  32. package/package.json +10 -11
  33. package/src/e2ee/E2eeManager.ts +8 -8
  34. package/src/e2ee/worker/FrameCryptor.test.ts +249 -2
  35. package/src/e2ee/worker/FrameCryptor.ts +13 -7
  36. package/src/e2ee/worker/ParticipantKeyHandler.test.ts +122 -0
  37. package/src/e2ee/worker/ParticipantKeyHandler.ts +1 -1
  38. package/src/e2ee/worker/e2ee.worker.ts +82 -78
  39. package/src/index.ts +2 -0
  40. package/src/room/Room.ts +16 -10
  41. package/src/room/events.ts +2 -2
  42. package/src/room/participant/Participant.ts +3 -2
  43. package/src/room/track/Track.ts +1 -1
  44. package/src/room/track/utils.ts +1 -1
  45. package/src/room/utils.ts +1 -1
  46. package/src/test/mocks.ts +1 -1
package/src/room/Room.ts CHANGED
@@ -135,6 +135,8 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
135
135
  /** reflects the sender encryption status of the local participant */
136
136
  isE2EEEnabled: boolean = false;
137
137
 
138
+ serverInfo?: Partial<ServerInfo>;
139
+
138
140
  private roomInfo?: RoomModel;
139
141
 
140
142
  private sidToIdentity: Map<string, string>;
@@ -609,6 +611,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
609
611
  if (!serverInfo) {
610
612
  serverInfo = { version: joinResponse.serverVersion, region: joinResponse.serverRegion };
611
613
  }
614
+ this.serverInfo = serverInfo;
612
615
 
613
616
  this.log.debug(
614
617
  `connected to Livekit Server ${Object.entries(serverInfo)
@@ -621,11 +624,11 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
621
624
  },
622
625
  );
623
626
 
624
- if (!joinResponse.serverVersion) {
627
+ if (!serverInfo.version) {
625
628
  throw new UnsupportedServer('unknown server version');
626
629
  }
627
630
 
628
- if (joinResponse.serverVersion === '0.15.1' && this.options.dynacast) {
631
+ if (serverInfo.version === '0.15.1' && this.options.dynacast) {
629
632
  this.log.debug('disabling dynacast due to server version', this.logContext);
630
633
  // dynacast has a bug in 0.15.1, so we cannot use it then
631
634
  roomOptions.dynacast = false;
@@ -1490,14 +1493,17 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
1490
1493
  if (!pub || !pub.track) {
1491
1494
  return;
1492
1495
  }
1493
- pub.track.streamState = Track.streamStateFromProto(streamState.state);
1494
- participant.emit(ParticipantEvent.TrackStreamStateChanged, pub, pub.track.streamState);
1495
- this.emitWhenConnected(
1496
- RoomEvent.TrackStreamStateChanged,
1497
- pub,
1498
- pub.track.streamState,
1499
- participant,
1500
- );
1496
+ const newStreamState = Track.streamStateFromProto(streamState.state);
1497
+ if (newStreamState !== pub.track.streamState) {
1498
+ pub.track.streamState = newStreamState;
1499
+ participant.emit(ParticipantEvent.TrackStreamStateChanged, pub, pub.track.streamState);
1500
+ this.emitWhenConnected(
1501
+ RoomEvent.TrackStreamStateChanged,
1502
+ pub,
1503
+ pub.track.streamState,
1504
+ participant,
1505
+ );
1506
+ }
1501
1507
  });
1502
1508
  };
1503
1509
 
@@ -294,7 +294,7 @@ export enum RoomEvent {
294
294
  MediaDevicesError = 'mediaDevicesError',
295
295
 
296
296
  /**
297
- * A participant's permission has changed. Currently only fired on LocalParticipant.
297
+ * A participant's permission has changed.
298
298
  * args: (prevPermissions: [[ParticipantPermission]], participant: [[Participant]])
299
299
  */
300
300
  ParticipantPermissionsChanged = 'participantPermissionsChanged',
@@ -502,7 +502,7 @@ export enum ParticipantEvent {
502
502
  AudioStreamAcquired = 'audioStreamAcquired',
503
503
 
504
504
  /**
505
- * A participant's permission has changed. Currently only fired on LocalParticipant.
505
+ * A participant's permission has changed.
506
506
  * args: (prevPermissions: [[ParticipantPermission]])
507
507
  */
508
508
  ParticipantPermissionsChanged = 'participantPermissionsChanged',
@@ -9,7 +9,7 @@ import {
9
9
  } from '@livekit/protocol';
10
10
  import { EventEmitter } from 'events';
11
11
  import type TypedEmitter from 'typed-emitter';
12
- import log, { LoggerNames, StructuredLogger, getLogger } from '../../logger';
12
+ import log, { LoggerNames, type StructuredLogger, getLogger } from '../../logger';
13
13
  import { ParticipantEvent, TrackEvent } from '../events';
14
14
  import LocalAudioTrack from '../track/LocalAudioTrack';
15
15
  import type LocalTrackPublication from '../track/LocalTrackPublication';
@@ -279,7 +279,8 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
279
279
  permissions.canPublishSources.length !== this.permissions.canPublishSources.length ||
280
280
  permissions.canPublishSources.some(
281
281
  (value, index) => value !== this.permissions?.canPublishSources[index],
282
- );
282
+ ) ||
283
+ permissions.canSubscribeMetrics !== this.permissions?.canSubscribeMetrics;
283
284
  this.permissions = permissions;
284
285
 
285
286
  if (changed) {
@@ -8,7 +8,7 @@ import {
8
8
  import { EventEmitter } from 'events';
9
9
  import type TypedEventEmitter from 'typed-emitter';
10
10
  import type { SignalClient } from '../../api/SignalClient';
11
- import log, { LoggerNames, StructuredLogger, getLogger } from '../../logger';
11
+ import log, { LoggerNames, type StructuredLogger, getLogger } from '../../logger';
12
12
  import { TrackEvent } from '../events';
13
13
  import type { LoggerOptions } from '../types';
14
14
  import { isFireFox, isSafari, isWeb } from '../utils';
@@ -8,7 +8,7 @@ import {
8
8
  type CreateLocalTracksOptions,
9
9
  type ScreenShareCaptureOptions,
10
10
  type VideoCaptureOptions,
11
- VideoCodec,
11
+ type VideoCodec,
12
12
  videoCodecs,
13
13
  } from './options';
14
14
  import type { AudioTrack } from './types';
package/src/room/utils.ts CHANGED
@@ -9,7 +9,7 @@ import { protocolVersion, version } from '../version';
9
9
  import CriticalTimers from './timers';
10
10
  import type LocalAudioTrack from './track/LocalAudioTrack';
11
11
  import type RemoteAudioTrack from './track/RemoteAudioTrack';
12
- import { VideoCodec, videoCodecs } from './track/options';
12
+ import { type VideoCodec, videoCodecs } from './track/options';
13
13
  import { getNewAudioContext } from './track/utils';
14
14
  import type { ChatMessage, LiveKitReactNativeInfo, TranscriptionSegment } from './types';
15
15
 
package/src/test/mocks.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line import/no-extraneous-dependencies
2
- import { MockedClass, vi } from 'vitest';
2
+ import { type MockedClass, vi } from 'vitest';
3
3
  import { SignalClient } from '../api/SignalClient';
4
4
  import RTCEngine from '../room/RTCEngine';
5
5