livekit-client 2.11.3 → 2.11.4

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.
@@ -10156,8 +10156,7 @@ const KEY_PROVIDER_DEFAULTS = {
10156
10156
  ratchetSalt: SALT,
10157
10157
  ratchetWindowSize: 8,
10158
10158
  failureTolerance: DECRYPTION_FAILURE_TOLERANCE,
10159
- keyringSize: 16,
10160
- allowKeyExtraction: false
10159
+ keyringSize: 16
10161
10160
  };
10162
10161
 
10163
10162
  var KeyProviderEvent;
@@ -10201,10 +10200,9 @@ function importKey(keyBytes_1) {
10201
10200
  name: ENCRYPTION_ALGORITHM
10202
10201
  };
10203
10202
  let usage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'encrypt';
10204
- let extractable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
10205
10203
  return function* () {
10206
10204
  // https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
10207
- return crypto.subtle.importKey('raw', keyBytes, algorithm, extractable, usage === 'derive' ? ['deriveBits', 'deriveKey'] : ['encrypt', 'decrypt']);
10205
+ return crypto.subtle.importKey('raw', keyBytes, algorithm, false, usage === 'derive' ? ['deriveBits', 'deriveKey'] : ['encrypt', 'decrypt']);
10208
10206
  }();
10209
10207
  });
10210
10208
  }
@@ -11188,7 +11186,7 @@ function getOSVersion(ua) {
11188
11186
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
11189
11187
  }
11190
11188
 
11191
- var version$1 = "2.11.3";
11189
+ var version$1 = "2.11.4";
11192
11190
 
11193
11191
  const version = version$1;
11194
11192
  const protocolVersion = 15;
@@ -12342,6 +12340,18 @@ function getNewAudioContext() {
12342
12340
  return audioContext;
12343
12341
  }
12344
12342
  }
12343
+ /**
12344
+ * @internal
12345
+ */
12346
+ function kindToSource(kind) {
12347
+ if (kind === 'audioinput') {
12348
+ return Track.Source.Microphone;
12349
+ } else if (kind === 'videoinput') {
12350
+ return Track.Source.Camera;
12351
+ } else {
12352
+ return Track.Source.Unknown;
12353
+ }
12354
+ }
12345
12355
  /**
12346
12356
  * @internal
12347
12357
  */
@@ -12636,9 +12646,9 @@ class E2EEManager extends eventsExports.EventEmitter {
12636
12646
  room.localParticipant.on(ParticipantEvent.LocalTrackPublished, publication => __awaiter(this, void 0, void 0, function* () {
12637
12647
  this.setupE2EESender(publication.track, publication.track.sender);
12638
12648
  }));
12639
- keyProvider.on(KeyProviderEvent.SetKey, keyInfo => this.postKey(keyInfo)).on(KeyProviderEvent.RatchetRequest, (participantId, keyIndex) => this.postRatchetRequest(participantId, keyIndex, keyProvider.getOptions().allowKeyExtraction));
12649
+ keyProvider.on(KeyProviderEvent.SetKey, keyInfo => this.postKey(keyInfo)).on(KeyProviderEvent.RatchetRequest, (participantId, keyIndex) => this.postRatchetRequest(participantId, keyIndex));
12640
12650
  }
12641
- postRatchetRequest(participantIdentity, keyIndex, extractable) {
12651
+ postRatchetRequest(participantIdentity, keyIndex) {
12642
12652
  if (!this.worker) {
12643
12653
  throw Error('could not ratchet key, worker is missing');
12644
12654
  }
@@ -12646,8 +12656,7 @@ class E2EEManager extends eventsExports.EventEmitter {
12646
12656
  kind: 'ratchetRequest',
12647
12657
  data: {
12648
12658
  participantIdentity: participantIdentity,
12649
- keyIndex,
12650
- extractable
12659
+ keyIndex
12651
12660
  }
12652
12661
  };
12653
12662
  this.worker.postMessage(msg);
@@ -22810,7 +22819,7 @@ class Room extends eventsExports.EventEmitter {
22810
22819
  }
22811
22820
  };
22812
22821
  this.handleDeviceChange = () => __awaiter(this, void 0, void 0, function* () {
22813
- var _a, _b;
22822
+ var _a, _b, _c;
22814
22823
  const previousDevices = DeviceManager.getInstance().previousDevices;
22815
22824
  // check for available devices, but don't request permissions in order to avoid prompts for kinds that haven't been used before
22816
22825
  const availableDevices = yield DeviceManager.getInstance().getDevices(undefined, false);
@@ -22827,15 +22836,20 @@ class Room extends eventsExports.EventEmitter {
22827
22836
  }
22828
22837
  }
22829
22838
  }
22830
- // inputs are automatically handled via TrackEvent.Ended causing a TrackEvent.Restarted. Here we only need to worry about audiooutputs changing
22831
22839
  const kinds = ['audiooutput', 'audioinput', 'videoinput'];
22832
22840
  for (let kind of kinds) {
22841
+ const targetSource = kindToSource(kind);
22842
+ const targetPublication = this.localParticipant.getTrackPublication(targetSource);
22843
+ if (targetPublication && ((_a = targetPublication.track) === null || _a === void 0 ? void 0 : _a.isUserProvided)) {
22844
+ // if the track is user provided, we don't want to switch devices on behalf of the user
22845
+ continue;
22846
+ }
22833
22847
  const devicesOfKind = availableDevices.filter(d => d.kind === kind);
22834
22848
  const activeDevice = this.getActiveDevice(kind);
22835
- if (activeDevice === ((_a = previousDevices.filter(info => info.kind === kind)[0]) === null || _a === void 0 ? void 0 : _a.deviceId)) {
22849
+ if (activeDevice === ((_b = previousDevices.filter(info => info.kind === kind)[0]) === null || _b === void 0 ? void 0 : _b.deviceId)) {
22836
22850
  // in Safari the first device is always the default, so we assume a user on the default device would like to switch to the default once it changes
22837
22851
  // FF doesn't emit an event when the default device changes, so we perform the same best effort and switch to the new device once connected and if it's the first in the array
22838
- if (devicesOfKind.length > 0 && ((_b = devicesOfKind[0]) === null || _b === void 0 ? void 0 : _b.deviceId) !== activeDevice) {
22852
+ if (devicesOfKind.length > 0 && ((_c = devicesOfKind[0]) === null || _c === void 0 ? void 0 : _c.deviceId) !== activeDevice) {
22839
22853
  yield this.switchActiveDevice(kind, devicesOfKind[0].deviceId);
22840
22854
  continue;
22841
22855
  }