livekit-client 2.5.8 → 2.5.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) 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 +543 -5128
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +104 -98
  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/api/SignalClient.d.ts.map +1 -1
  10. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  11. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +25 -5
  12. package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
  13. package/dist/src/index.d.ts +2 -1
  14. package/dist/src/index.d.ts.map +1 -1
  15. package/dist/src/room/PCTransportManager.d.ts.map +1 -1
  16. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  17. package/dist/src/room/Room.d.ts.map +1 -1
  18. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  19. package/dist/src/room/track/LocalTrack.d.ts +1 -1
  20. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  21. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  22. package/dist/src/room/utils.d.ts +0 -10
  23. package/dist/src/room/utils.d.ts.map +1 -1
  24. package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +25 -5
  25. package/dist/ts4.2/src/index.d.ts +2 -1
  26. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +1 -1
  27. package/dist/ts4.2/src/room/utils.d.ts +0 -10
  28. package/package.json +3 -2
  29. package/src/api/SignalClient.ts +2 -1
  30. package/src/e2ee/worker/FrameCryptor.test.ts +311 -113
  31. package/src/e2ee/worker/FrameCryptor.ts +10 -5
  32. package/src/e2ee/worker/ParticipantKeyHandler.test.ts +169 -5
  33. package/src/e2ee/worker/ParticipantKeyHandler.ts +50 -20
  34. package/src/e2ee/worker/__snapshots__/ParticipantKeyHandler.test.ts.snap +356 -0
  35. package/src/index.ts +1 -1
  36. package/src/room/PCTransportManager.ts +2 -1
  37. package/src/room/RTCEngine.ts +3 -1
  38. package/src/room/Room.ts +1 -1
  39. package/src/room/participant/LocalParticipant.ts +4 -1
  40. package/src/room/track/LocalTrack.ts +2 -1
  41. package/src/room/track/LocalVideoTrack.ts +2 -1
  42. package/src/room/track/options.ts +5 -5
  43. package/src/room/utils.ts +0 -38
  44. package/src/utils/AsyncQueue.test.ts +2 -2
  45. package/src/utils/AsyncQueue.ts +1 -1
@@ -1,16 +1,44 @@
1
1
  function _mergeNamespaces(n, m) {
2
- m.forEach(function (e) {
3
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
4
- if (k !== 'default' && !(k in n)) {
5
- var d = Object.getOwnPropertyDescriptor(e, k);
6
- Object.defineProperty(n, k, d.get ? d : {
7
- enumerable: true,
8
- get: function () { return e[k]; }
9
- });
10
- }
2
+ m.forEach(function (e) {
3
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
4
+ if (k !== 'default' && !(k in n)) {
5
+ var d = Object.getOwnPropertyDescriptor(e, k);
6
+ Object.defineProperty(n, k, d.get ? d : {
7
+ enumerable: true,
8
+ get: function () { return e[k]; }
11
9
  });
10
+ }
12
11
  });
13
- return Object.freeze(n);
12
+ });
13
+ return Object.freeze(n);
14
+ }
15
+
16
+ var k = Object.defineProperty;
17
+ var n = (s, o, c) => o in s ? k(s, o, {
18
+ enumerable: !0,
19
+ configurable: !0,
20
+ writable: !0,
21
+ value: c
22
+ }) : s[o] = c;
23
+ var l = (s, o, c) => n(s, typeof o != "symbol" ? o + "" : o, c);
24
+ class h {
25
+ constructor() {
26
+ l(this, "_locking");
27
+ l(this, "_locks");
28
+ this._locking = Promise.resolve(), this._locks = 0;
29
+ }
30
+ isLocked() {
31
+ return this._locks > 0;
32
+ }
33
+ lock() {
34
+ this._locks += 1;
35
+ let o;
36
+ const c = new Promise(i => o = () => {
37
+ this._locks -= 1, i();
38
+ }),
39
+ t = this._locking.then(() => o);
40
+ return this._locking = this._locking.then(() => c), t;
41
+ }
14
42
  }
15
43
 
16
44
  // Copyright 2021-2024 Buf Technologies, Inc.
@@ -8056,16 +8084,16 @@ function fixNegotiationNeeded(window, browserDetails) {
8056
8084
  }
8057
8085
 
8058
8086
  var chromeShim = /*#__PURE__*/Object.freeze({
8059
- __proto__: null,
8060
- fixNegotiationNeeded: fixNegotiationNeeded,
8061
- shimAddTrackRemoveTrack: shimAddTrackRemoveTrack,
8062
- shimAddTrackRemoveTrackWithNative: shimAddTrackRemoveTrackWithNative,
8063
- shimGetSendersWithDtmf: shimGetSendersWithDtmf,
8064
- shimGetUserMedia: shimGetUserMedia$2,
8065
- shimMediaStream: shimMediaStream,
8066
- shimOnTrack: shimOnTrack$1,
8067
- shimPeerConnection: shimPeerConnection$1,
8068
- shimSenderReceiverGetStats: shimSenderReceiverGetStats
8087
+ __proto__: null,
8088
+ fixNegotiationNeeded: fixNegotiationNeeded,
8089
+ shimAddTrackRemoveTrack: shimAddTrackRemoveTrack,
8090
+ shimAddTrackRemoveTrackWithNative: shimAddTrackRemoveTrackWithNative,
8091
+ shimGetSendersWithDtmf: shimGetSendersWithDtmf,
8092
+ shimGetUserMedia: shimGetUserMedia$2,
8093
+ shimMediaStream: shimMediaStream,
8094
+ shimOnTrack: shimOnTrack$1,
8095
+ shimPeerConnection: shimPeerConnection$1,
8096
+ shimSenderReceiverGetStats: shimSenderReceiverGetStats
8069
8097
  });
8070
8098
 
8071
8099
  /*
@@ -8425,19 +8453,19 @@ function shimCreateAnswer(window) {
8425
8453
  }
8426
8454
 
8427
8455
  var firefoxShim = /*#__PURE__*/Object.freeze({
8428
- __proto__: null,
8429
- shimAddTransceiver: shimAddTransceiver,
8430
- shimCreateAnswer: shimCreateAnswer,
8431
- shimCreateOffer: shimCreateOffer,
8432
- shimGetDisplayMedia: shimGetDisplayMedia,
8433
- shimGetParameters: shimGetParameters,
8434
- shimGetUserMedia: shimGetUserMedia$1,
8435
- shimOnTrack: shimOnTrack,
8436
- shimPeerConnection: shimPeerConnection,
8437
- shimRTCDataChannel: shimRTCDataChannel,
8438
- shimReceiverGetStats: shimReceiverGetStats,
8439
- shimRemoveStream: shimRemoveStream,
8440
- shimSenderGetStats: shimSenderGetStats
8456
+ __proto__: null,
8457
+ shimAddTransceiver: shimAddTransceiver,
8458
+ shimCreateAnswer: shimCreateAnswer,
8459
+ shimCreateOffer: shimCreateOffer,
8460
+ shimGetDisplayMedia: shimGetDisplayMedia,
8461
+ shimGetParameters: shimGetParameters,
8462
+ shimGetUserMedia: shimGetUserMedia$1,
8463
+ shimOnTrack: shimOnTrack,
8464
+ shimPeerConnection: shimPeerConnection,
8465
+ shimRTCDataChannel: shimRTCDataChannel,
8466
+ shimReceiverGetStats: shimReceiverGetStats,
8467
+ shimRemoveStream: shimRemoveStream,
8468
+ shimSenderGetStats: shimSenderGetStats
8441
8469
  });
8442
8470
 
8443
8471
  /*
@@ -8758,16 +8786,16 @@ function shimAudioContext(window) {
8758
8786
  }
8759
8787
 
8760
8788
  var safariShim = /*#__PURE__*/Object.freeze({
8761
- __proto__: null,
8762
- shimAudioContext: shimAudioContext,
8763
- shimCallbacksAPI: shimCallbacksAPI,
8764
- shimConstraints: shimConstraints,
8765
- shimCreateOfferLegacy: shimCreateOfferLegacy,
8766
- shimGetUserMedia: shimGetUserMedia,
8767
- shimLocalStreamsAPI: shimLocalStreamsAPI,
8768
- shimRTCIceServerUrls: shimRTCIceServerUrls,
8769
- shimRemoteStreamsAPI: shimRemoteStreamsAPI,
8770
- shimTrackEventTransceiver: shimTrackEventTransceiver
8789
+ __proto__: null,
8790
+ shimAudioContext: shimAudioContext,
8791
+ shimCallbacksAPI: shimCallbacksAPI,
8792
+ shimConstraints: shimConstraints,
8793
+ shimCreateOfferLegacy: shimCreateOfferLegacy,
8794
+ shimGetUserMedia: shimGetUserMedia,
8795
+ shimLocalStreamsAPI: shimLocalStreamsAPI,
8796
+ shimRTCIceServerUrls: shimRTCIceServerUrls,
8797
+ shimRemoteStreamsAPI: shimRemoteStreamsAPI,
8798
+ shimTrackEventTransceiver: shimTrackEventTransceiver
8771
8799
  });
8772
8800
 
8773
8801
  var sdp$1 = {exports: {}};
@@ -9523,8 +9551,8 @@ var sdpExports = requireSdp();
9523
9551
  var SDPUtils = /*@__PURE__*/getDefaultExportFromCjs(sdpExports);
9524
9552
 
9525
9553
  var sdp = /*#__PURE__*/_mergeNamespaces({
9526
- __proto__: null,
9527
- default: SDPUtils
9554
+ __proto__: null,
9555
+ default: SDPUtils
9528
9556
  }, [sdpExports]);
9529
9557
 
9530
9558
  /*
@@ -9944,15 +9972,15 @@ function shimParameterlessSetLocalDescription(window, browserDetails) {
9944
9972
  }
9945
9973
 
9946
9974
  var commonShim = /*#__PURE__*/Object.freeze({
9947
- __proto__: null,
9948
- removeExtmapAllowMixed: removeExtmapAllowMixed,
9949
- shimAddIceCandidateNullOrEmpty: shimAddIceCandidateNullOrEmpty,
9950
- shimConnectionState: shimConnectionState,
9951
- shimMaxMessageSize: shimMaxMessageSize,
9952
- shimParameterlessSetLocalDescription: shimParameterlessSetLocalDescription,
9953
- shimRTCIceCandidate: shimRTCIceCandidate,
9954
- shimRTCIceCandidateRelayProtocol: shimRTCIceCandidateRelayProtocol,
9955
- shimSendThrowTypeError: shimSendThrowTypeError
9975
+ __proto__: null,
9976
+ removeExtmapAllowMixed: removeExtmapAllowMixed,
9977
+ shimAddIceCandidateNullOrEmpty: shimAddIceCandidateNullOrEmpty,
9978
+ shimConnectionState: shimConnectionState,
9979
+ shimMaxMessageSize: shimMaxMessageSize,
9980
+ shimParameterlessSetLocalDescription: shimParameterlessSetLocalDescription,
9981
+ shimRTCIceCandidate: shimRTCIceCandidate,
9982
+ shimRTCIceCandidateRelayProtocol: shimRTCIceCandidateRelayProtocol,
9983
+ shimSendThrowTypeError: shimSendThrowTypeError
9956
9984
  });
9957
9985
 
9958
9986
  /*
@@ -11148,7 +11176,7 @@ function getOSVersion(ua) {
11148
11176
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
11149
11177
  }
11150
11178
 
11151
- var version$1 = "2.5.8";
11179
+ var version$1 = "2.5.10";
11152
11180
 
11153
11181
  const version = version$1;
11154
11182
  const protocolVersion = 15;
@@ -11218,19 +11246,19 @@ var AudioPresets;
11218
11246
  maxBitrate: 12000
11219
11247
  };
11220
11248
  AudioPresets.speech = {
11221
- maxBitrate: 20000
11249
+ maxBitrate: 24000
11222
11250
  };
11223
11251
  AudioPresets.music = {
11224
- maxBitrate: 32000
11252
+ maxBitrate: 48000
11225
11253
  };
11226
11254
  AudioPresets.musicStereo = {
11227
- maxBitrate: 48000
11255
+ maxBitrate: 64000
11228
11256
  };
11229
11257
  AudioPresets.musicHighQuality = {
11230
- maxBitrate: 64000
11258
+ maxBitrate: 96000
11231
11259
  };
11232
11260
  AudioPresets.musicHighQualityStereo = {
11233
- maxBitrate: 96000
11261
+ maxBitrate: 128000
11234
11262
  };
11235
11263
  })(AudioPresets || (AudioPresets = {}));
11236
11264
  /**
@@ -12217,29 +12245,6 @@ function createAudioAnalyser(track, options) {
12217
12245
  cleanup
12218
12246
  };
12219
12247
  }
12220
- /**
12221
- * @internal
12222
- */
12223
- class Mutex {
12224
- constructor() {
12225
- this._locking = Promise.resolve();
12226
- this._locks = 0;
12227
- }
12228
- isLocked() {
12229
- return this._locks > 0;
12230
- }
12231
- lock() {
12232
- this._locks += 1;
12233
- let unlockNext;
12234
- const willLock = new Promise(resolve => unlockNext = () => {
12235
- this._locks -= 1;
12236
- resolve();
12237
- });
12238
- const willUnlock = this._locking.then(() => unlockNext);
12239
- this._locking = this._locking.then(() => willLock);
12240
- return willUnlock;
12241
- }
12242
- }
12243
12248
  function isVideoCodec(maybeCodec) {
12244
12249
  return videoCodecs.includes(maybeCodec);
12245
12250
  }
@@ -12447,10 +12452,10 @@ class LocalTrack extends Track {
12447
12452
  };
12448
12453
  this.reacquireTrack = false;
12449
12454
  this.providedByUser = userProvidedTrack;
12450
- this.muteLock = new Mutex();
12451
- this.pauseUpstreamLock = new Mutex();
12452
- this.processorLock = new Mutex();
12453
- this.restartLock = new Mutex();
12455
+ this.muteLock = new h();
12456
+ this.pauseUpstreamLock = new h();
12457
+ this.processorLock = new h();
12458
+ this.restartLock = new h();
12454
12459
  this.setMediaStreamTrack(mediaTrack, true);
12455
12460
  // added to satisfy TS compiler, constraints are synced with MediaStreamTrack
12456
12461
  this._constraints = mediaTrack.getConstraints();
@@ -13237,7 +13242,7 @@ var QueueTaskStatus;
13237
13242
  class AsyncQueue {
13238
13243
  constructor() {
13239
13244
  this.pendingTasks = new Map();
13240
- this.taskMutex = new Mutex();
13245
+ this.taskMutex = new h();
13241
13246
  this.nextTaskIndex = 0;
13242
13247
  }
13243
13248
  run(task) {
@@ -13330,8 +13335,8 @@ class SignalClient {
13330
13335
  this.useJSON = useJSON;
13331
13336
  this.requestQueue = new AsyncQueue();
13332
13337
  this.queuedRequests = [];
13333
- this.closingLock = new Mutex();
13334
- this.connectionLock = new Mutex();
13338
+ this.closingLock = new h();
13339
+ this.connectionLock = new h();
13335
13340
  this.state = SignalConnectionState.DISCONNECTED;
13336
13341
  }
13337
13342
  get logContext() {
@@ -15280,8 +15285,8 @@ class PCTransportManager {
15280
15285
  (_a = this.onPublisherOffer) === null || _a === void 0 ? void 0 : _a.call(this, offer);
15281
15286
  };
15282
15287
  this.state = PCTransportState.NEW;
15283
- this.connectionLock = new Mutex();
15284
- this.remoteOfferLock = new Mutex();
15288
+ this.connectionLock = new h();
15289
+ this.remoteOfferLock = new h();
15285
15290
  }
15286
15291
  get logContext() {
15287
15292
  var _a, _b;
@@ -16120,7 +16125,7 @@ class LocalVideoTrack extends LocalTrack {
16120
16125
  }
16121
16126
  this.prevStats = statsMap;
16122
16127
  });
16123
- this.senderLock = new Mutex();
16128
+ this.senderLock = new h();
16124
16129
  }
16125
16130
  get isSimulcast() {
16126
16131
  if (this.sender && this.sender.getParameters().encodings.length > 1) {
@@ -16880,8 +16885,8 @@ class RTCEngine extends eventsExports.EventEmitter {
16880
16885
  this.client.signalLatency = this.options.expSignalLatency;
16881
16886
  this.reconnectPolicy = this.options.reconnectPolicy;
16882
16887
  this.registerOnLineListener();
16883
- this.closingLock = new Mutex();
16884
- this.dataProcessLock = new Mutex();
16888
+ this.closingLock = new h();
16889
+ this.dataProcessLock = new h();
16885
16890
  this.dcBufferStatus = new Map([[DataPacket_Kind.LOSSY, true], [DataPacket_Kind.RELIABLE, true]]);
16886
16891
  this.client.onParticipantUpdate = updates => this.emit(EngineEvent.ParticipantUpdate, updates);
16887
16892
  this.client.onConnectionQuality = update => this.emit(EngineEvent.ConnectionQualityUpdate, update);
@@ -16946,6 +16951,7 @@ class RTCEngine extends eventsExports.EventEmitter {
16946
16951
  }
16947
16952
  try {
16948
16953
  this._isClosed = true;
16954
+ this.joinAttempts = 0;
16949
16955
  this.emit(EngineEvent.Closing);
16950
16956
  this.removeAllListeners();
16951
16957
  this.deregisterOnLineListener();
@@ -19385,7 +19391,7 @@ class LocalParticipant extends Participant {
19385
19391
  while (performance.now() - startTime < 5000 && !isRejected) {
19386
19392
  if ((!name || this.name === name) && (!metadata || this.metadata === metadata) && (!attributes || Object.entries(attributes).every(_ref2 => {
19387
19393
  let [key, value] = _ref2;
19388
- return this.attributes[key] === value;
19394
+ return this.attributes[key] === value || value === '' && !this.attributes[key];
19389
19395
  }))) {
19390
19396
  this.pendingSignalRequests.delete(requestId);
19391
19397
  resolve();
@@ -21638,7 +21644,7 @@ class Room extends eventsExports.EventEmitter {
21638
21644
  this.options.videoCaptureDefaults = Object.assign(Object.assign({}, videoDefaults), options === null || options === void 0 ? void 0 : options.videoCaptureDefaults);
21639
21645
  this.options.publishDefaults = Object.assign(Object.assign({}, publishDefaults), options === null || options === void 0 ? void 0 : options.publishDefaults);
21640
21646
  this.maybeCreateEngine();
21641
- this.disconnectLock = new Mutex();
21647
+ this.disconnectLock = new h();
21642
21648
  this.localParticipant = new LocalParticipant('', '', this.engine, this.options);
21643
21649
  if (this.options.videoCaptureDefaults.deviceId) {
21644
21650
  this.localParticipant.activeDeviceMap.set('videoinput', unwrapConstraint(this.options.videoCaptureDefaults.deviceId));
@@ -23090,5 +23096,5 @@ function isFacingModeValue(item) {
23090
23096
  return item === undefined || allowedValues.includes(item);
23091
23097
  }
23092
23098
 
23093
- export { AudioPresets, BaseKeyProvider, CheckStatus, Checker, ConnectionCheck, ConnectionError, ConnectionErrorReason, ConnectionQuality, ConnectionState, CriticalTimers, CryptorError, CryptorErrorReason, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, KeyHandlerEvent, KeyProviderEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, LoggerNames, MediaDeviceFailure, Mutex, NegotiationError, Participant, ParticipantEvent, ParticipantInfo_Kind as ParticipantKind, PublishDataError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, ScreenSharePresets, SignalRequestError, SubscriptionError, Track, TrackEvent, TrackInvalidError, TrackPublication, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, compareVersions, createAudioAnalyser, createE2EEKey, createKeyMaterialFromBuffer, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, extractProcessorsFromOptions, facingModeFromDeviceLabel, facingModeFromLocalTrack, getBrowser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, getLogger, importKey, isBackupCodec, isBrowserSupported, isE2EESupported, isInsertableStreamSupported, isScriptTransformSupported, isVideoFrame, needsRbspUnescaping, parseRbsp, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs, writeRbsp };
23099
+ export { AudioPresets, BaseKeyProvider, CheckStatus, Checker, ConnectionCheck, ConnectionError, ConnectionErrorReason, ConnectionQuality, ConnectionState, CriticalTimers, CryptorError, CryptorErrorReason, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, KeyHandlerEvent, KeyProviderEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, LoggerNames, MediaDeviceFailure, h as Mutex, NegotiationError, Participant, ParticipantEvent, ParticipantInfo_Kind as ParticipantKind, PublishDataError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, ScreenSharePresets, SignalRequestError, SubscriptionError, Track, TrackEvent, TrackInvalidError, TrackPublication, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, compareVersions, createAudioAnalyser, createE2EEKey, createKeyMaterialFromBuffer, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, extractProcessorsFromOptions, facingModeFromDeviceLabel, facingModeFromLocalTrack, getBrowser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, getLogger, importKey, isBackupCodec, isBrowserSupported, isE2EESupported, isInsertableStreamSupported, isScriptTransformSupported, isVideoFrame, needsRbspUnescaping, parseRbsp, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs, writeRbsp };
23094
23100
  //# sourceMappingURL=livekit-client.esm.mjs.map