livekit-client 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) 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 +10 -8
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +77 -52
  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/worker/FrameCryptor.d.ts +1 -0
  12. package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
  13. package/dist/src/logger.d.ts +2 -2
  14. package/dist/src/logger.d.ts.map +1 -1
  15. package/dist/src/room/RTCEngine.d.ts +3 -2
  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/Participant.d.ts +1 -2
  19. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  20. package/dist/src/room/participant/RemoteParticipant.d.ts +4 -0
  21. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  22. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  23. package/dist/src/room/track/utils.d.ts.map +1 -1
  24. package/dist/src/room/utils.d.ts.map +1 -1
  25. package/dist/ts4.2/src/api/SignalClient.d.ts +1 -1
  26. package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +1 -0
  27. package/dist/ts4.2/src/logger.d.ts +2 -2
  28. package/dist/ts4.2/src/room/RTCEngine.d.ts +3 -2
  29. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -2
  30. package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +4 -0
  31. package/package.json +1 -1
  32. package/src/api/SignalClient.ts +9 -5
  33. package/src/e2ee/worker/FrameCryptor.ts +12 -6
  34. package/src/logger.ts +21 -18
  35. package/src/room/RTCEngine.ts +12 -8
  36. package/src/room/Room.ts +15 -2
  37. package/src/room/participant/Participant.ts +0 -2
  38. package/src/room/participant/RemoteParticipant.ts +8 -0
  39. package/src/room/track/LocalVideoTrack.ts +5 -1
  40. package/src/room/track/utils.ts +18 -11
  41. 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
  }