livekit-client 2.0.3 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) 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 +11 -8
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +166 -77
  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 +1 -1
  10. package/dist/src/api/SignalClient.d.ts.map +1 -1
  11. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
  12. package/dist/src/e2ee/types.d.ts +2 -0
  13. package/dist/src/e2ee/types.d.ts.map +1 -1
  14. package/dist/src/e2ee/worker/FrameCryptor.d.ts +1 -0
  15. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  16. package/dist/src/index.d.ts +2 -2
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/logger.d.ts +4 -2
  19. package/dist/src/logger.d.ts.map +1 -1
  20. package/dist/src/room/DeviceManager.d.ts.map +1 -1
  21. package/dist/src/room/RTCEngine.d.ts +4 -2
  22. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  23. package/dist/src/room/Room.d.ts.map +1 -1
  24. package/dist/src/room/events.d.ts +2 -1
  25. package/dist/src/room/events.d.ts.map +1 -1
  26. package/dist/src/room/participant/Participant.d.ts +1 -2
  27. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  28. package/dist/src/room/participant/RemoteParticipant.d.ts +4 -0
  29. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  30. package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
  31. package/dist/src/room/track/LocalTrack.d.ts +3 -1
  32. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  33. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  34. package/dist/src/room/track/options.d.ts +10 -0
  35. package/dist/src/room/track/options.d.ts.map +1 -1
  36. package/dist/src/room/track/types.d.ts +4 -0
  37. package/dist/src/room/track/types.d.ts.map +1 -1
  38. package/dist/src/room/track/utils.d.ts.map +1 -1
  39. package/dist/src/room/utils.d.ts.map +1 -1
  40. package/dist/ts4.2/src/api/SignalClient.d.ts +1 -1
  41. package/dist/ts4.2/src/e2ee/types.d.ts +2 -0
  42. package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +1 -0
  43. package/dist/ts4.2/src/index.d.ts +2 -2
  44. package/dist/ts4.2/src/logger.d.ts +4 -2
  45. package/dist/ts4.2/src/room/RTCEngine.d.ts +4 -2
  46. package/dist/ts4.2/src/room/events.d.ts +2 -1
  47. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -2
  48. package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +4 -0
  49. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +3 -1
  50. package/dist/ts4.2/src/room/track/options.d.ts +10 -0
  51. package/dist/ts4.2/src/room/track/types.d.ts +4 -0
  52. package/package.json +1 -1
  53. package/src/api/SignalClient.ts +10 -5
  54. package/src/e2ee/E2eeManager.ts +2 -1
  55. package/src/e2ee/types.ts +2 -0
  56. package/src/e2ee/worker/FrameCryptor.ts +12 -6
  57. package/src/e2ee/worker/e2ee.worker.ts +1 -0
  58. package/src/index.ts +2 -1
  59. package/src/logger.ts +23 -18
  60. package/src/room/DeviceManager.ts +10 -1
  61. package/src/room/RTCEngine.ts +26 -8
  62. package/src/room/Room.ts +26 -2
  63. package/src/room/events.ts +1 -0
  64. package/src/room/participant/LocalParticipant.ts +4 -4
  65. package/src/room/participant/Participant.ts +0 -2
  66. package/src/room/participant/RemoteParticipant.ts +8 -0
  67. package/src/room/track/LocalAudioTrack.ts +10 -0
  68. package/src/room/track/LocalTrack.ts +20 -3
  69. package/src/room/track/LocalVideoTrack.ts +15 -1
  70. package/src/room/track/options.ts +41 -8
  71. package/src/room/track/types.ts +5 -0
  72. package/src/room/track/utils.ts +18 -11
  73. package/src/room/utils.ts +3 -0
@@ -322,6 +322,7 @@ var LoggerNames;
322
322
  LoggerNames["E2EE"] = "lk-e2ee";
323
323
  })(LoggerNames || (LoggerNames = {}));
324
324
  let livekitLogger = loglevelExports.getLogger('livekit');
325
+ Object.values(LoggerNames).map(name => loglevelExports.getLogger(name));
325
326
  livekitLogger.setDefaultLevel(LogLevel.info);
326
327
  const workerLogger = loglevelExports.getLogger('lk-e2ee');
327
328
 
@@ -989,8 +990,8 @@ class FrameCryptor extends BaseFrameCryptor {
989
990
  }
990
991
  get logContext() {
991
992
  return {
992
- identity: this.participantIdentity,
993
- trackId: this.trackId,
993
+ participant: this.participantIdentity,
994
+ mediaTrackId: this.trackId,
994
995
  fallbackCodec: this.videoCodec
995
996
  };
996
997
  }
@@ -1105,7 +1106,6 @@ class FrameCryptor extends BaseFrameCryptor {
1105
1106
  if (encryptionKey) {
1106
1107
  const iv = this.makeIV((_a = encodedFrame.getMetadata().synchronizationSource) !== null && _a !== void 0 ? _a : -1, encodedFrame.timestamp);
1107
1108
  let frameInfo = this.getUnencryptedBytes(encodedFrame);
1108
- workerLogger.debug('frameInfo for encoded frame', Object.assign(Object.assign({}, frameInfo), this.logContext));
1109
1109
  // Thіs is not encrypted and contains the VP8 payload descriptor or the Opus TOC byte.
1110
1110
  const frameHeader = new Uint8Array(encodedFrame.data, 0, frameInfo.unencryptedBytes);
1111
1111
  // Frame trailer contains the R|IV_LENGTH and key index
@@ -1182,7 +1182,6 @@ class FrameCryptor extends BaseFrameCryptor {
1182
1182
  const decodedFrame = yield this.decryptFrame(encodedFrame, keyIndex);
1183
1183
  this.keys.decryptionSuccess();
1184
1184
  if (decodedFrame) {
1185
- workerLogger.debug('enqueue decrypted frame', this.logContext);
1186
1185
  return controller.enqueue(decodedFrame);
1187
1186
  }
1188
1187
  } catch (error) {
@@ -1220,7 +1219,6 @@ class FrameCryptor extends BaseFrameCryptor {
1220
1219
  throw new TypeError("no encryption key found for decryption of ".concat(this.participantIdentity));
1221
1220
  }
1222
1221
  let frameInfo = this.getUnencryptedBytes(encodedFrame);
1223
- workerLogger.debug('frameInfo for decoded frame', Object.assign(Object.assign({}, frameInfo), this.logContext));
1224
1222
  // Construct frame trailer. Similar to the frame header described in
1225
1223
  // https://tools.ietf.org/html/draft-omara-sframe-00#section-4.2
1226
1224
  // but we put it at the end.
@@ -1337,6 +1335,13 @@ class FrameCryptor extends BaseFrameCryptor {
1337
1335
  };
1338
1336
  if (isVideoFrame(frame)) {
1339
1337
  let detectedCodec = (_a = this.getVideoCodec(frame)) !== null && _a !== void 0 ? _a : this.videoCodec;
1338
+ if (detectedCodec !== this.detectedCodec) {
1339
+ workerLogger.debug('detected different codec', Object.assign({
1340
+ detectedCodec,
1341
+ oldCodec: this.detectedCodec
1342
+ }, this.logContext));
1343
+ this.detectedCodec = detectedCodec;
1344
+ }
1340
1345
  if (detectedCodec === 'av1' || detectedCodec === 'vp9') {
1341
1346
  throw new Error("".concat(detectedCodec, " is not yet supported for end to end encryption"));
1342
1347
  }
@@ -1383,9 +1388,6 @@ class FrameCryptor extends BaseFrameCryptor {
1383
1388
  // @ts-expect-error payloadType is not yet part of the typescript definition and currently not supported in Safari
1384
1389
  const payloadType = frame.getMetadata().payloadType;
1385
1390
  const codec = payloadType ? this.rtpMap.get(payloadType) : undefined;
1386
- workerLogger.debug('reading codec from frame', Object.assign({
1387
- codec
1388
- }, this.logContext));
1389
1391
  return codec;
1390
1392
  }
1391
1393
  }
@@ -1632,6 +1634,7 @@ onmessage = ev => {
1632
1634
  } = ev.data;
1633
1635
  switch (kind) {
1634
1636
  case 'init':
1637
+ workerLogger.setLevel(data.loglevel);
1635
1638
  workerLogger.info('worker initialized');
1636
1639
  keyProviderOptions = data.keyProviderOptions;
1637
1640
  useSharedKey = !!data.keyProviderOptions.sharedKey;