livekit-client 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) 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 +4 -4
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +29 -21
  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/room/Room.d.ts.map +1 -1
  10. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  11. package/dist/src/room/track/LocalAudioTrack.d.ts +8 -7
  12. package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
  13. package/dist/src/room/track/LocalTrack.d.ts +10 -9
  14. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  15. package/dist/src/room/track/LocalTrackPublication.d.ts +2 -2
  16. package/dist/src/room/track/LocalVideoTrack.d.ts +3 -3
  17. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  18. package/dist/src/room/track/RemoteAudioTrack.d.ts +2 -1
  19. package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
  20. package/dist/src/room/track/RemoteTrack.d.ts +2 -2
  21. package/dist/src/room/track/RemoteTrack.d.ts.map +1 -1
  22. package/dist/src/room/track/RemoteVideoTrack.d.ts +2 -1
  23. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  24. package/dist/src/room/track/Track.d.ts +3 -3
  25. package/dist/src/room/track/Track.d.ts.map +1 -1
  26. package/dist/src/room/track/processor/types.d.ts +4 -0
  27. package/dist/src/room/track/processor/types.d.ts.map +1 -1
  28. package/dist/ts4.2/src/room/track/LocalAudioTrack.d.ts +8 -7
  29. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +10 -9
  30. package/dist/ts4.2/src/room/track/LocalTrackPublication.d.ts +2 -2
  31. package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +3 -3
  32. package/dist/ts4.2/src/room/track/RemoteAudioTrack.d.ts +2 -1
  33. package/dist/ts4.2/src/room/track/RemoteTrack.d.ts +2 -2
  34. package/dist/ts4.2/src/room/track/RemoteVideoTrack.d.ts +2 -1
  35. package/dist/ts4.2/src/room/track/Track.d.ts +3 -3
  36. package/dist/ts4.2/src/room/track/processor/types.d.ts +4 -0
  37. package/package.json +1 -1
  38. package/src/api/SignalClient.ts +1 -1
  39. package/src/e2ee/worker/e2ee.worker.ts +8 -4
  40. package/src/room/Room.ts +3 -0
  41. package/src/room/participant/LocalParticipant.ts +0 -1
  42. package/src/room/track/LocalAudioTrack.ts +8 -11
  43. package/src/room/track/LocalTrack.ts +36 -23
  44. package/src/room/track/LocalVideoTrack.ts +3 -3
  45. package/src/room/track/RemoteAudioTrack.ts +1 -1
  46. package/src/room/track/RemoteTrack.ts +4 -2
  47. package/src/room/track/RemoteVideoTrack.ts +1 -1
  48. package/src/room/track/Track.ts +5 -3
  49. package/src/room/track/processor/types.ts +4 -0
@@ -10703,7 +10703,7 @@ function getMatch(exp, ua) {
10703
10703
  return match && match.length >= id && match[id] || '';
10704
10704
  }
10705
10705
 
10706
- var version$1 = "2.0.1";
10706
+ var version$1 = "2.0.2";
10707
10707
 
10708
10708
  const version = version$1;
10709
10709
  const protocolVersion = 12;
@@ -14270,20 +14270,27 @@ class LocalTrack extends Track {
14270
14270
  this._constraints = newTrack.getConstraints();
14271
14271
  }
14272
14272
  let processedTrack;
14273
- if (this.processor && newTrack && this.processorElement) {
14274
- this.log.debug('restarting processor', this.logContext);
14275
- if (this.kind === 'unknown') {
14276
- throw TypeError('cannot set processor on track of unknown kind');
14273
+ if (this.processor && newTrack) {
14274
+ const unlock = yield this.processorLock.lock();
14275
+ try {
14276
+ this.log.debug('restarting processor', this.logContext);
14277
+ if (this.kind === 'unknown') {
14278
+ throw TypeError('cannot set processor on track of unknown kind');
14279
+ }
14280
+ if (this.processorElement) {
14281
+ attachToElement(newTrack, this.processorElement);
14282
+ // ensure the processorElement itself stays muted
14283
+ this.processorElement.muted = true;
14284
+ }
14285
+ yield this.processor.restart({
14286
+ track: newTrack,
14287
+ kind: this.kind,
14288
+ element: this.processorElement
14289
+ });
14290
+ processedTrack = this.processor.processedTrack;
14291
+ } finally {
14292
+ unlock();
14277
14293
  }
14278
- attachToElement(newTrack, this.processorElement);
14279
- // ensure the processorElement itself stays muted
14280
- this.processorElement.muted = true;
14281
- yield this.processor.restart({
14282
- track: newTrack,
14283
- kind: this.kind,
14284
- element: this.processorElement
14285
- });
14286
- processedTrack = this.processor.processedTrack;
14287
14294
  }
14288
14295
  if (this.sender) {
14289
14296
  yield this.sender.replaceTrack(processedTrack !== null && processedTrack !== void 0 ? processedTrack : newTrack);
@@ -14548,7 +14555,8 @@ class LocalTrack extends Track {
14548
14555
  const processorOptions = {
14549
14556
  kind: this.kind,
14550
14557
  track: this._mediaStreamTrack,
14551
- element: this.processorElement
14558
+ element: this.processorElement,
14559
+ audioContext: this.audioContext
14552
14560
  };
14553
14561
  yield processor.init(processorOptions);
14554
14562
  this.processor = processor;
@@ -15123,7 +15131,9 @@ class SignalClient {
15123
15131
  let resp;
15124
15132
  if (typeof ev.data === 'string') {
15125
15133
  const json = JSON.parse(ev.data);
15126
- resp = SignalResponse.fromJson(json);
15134
+ resp = SignalResponse.fromJson(json, {
15135
+ ignoreUnknownFields: true
15136
+ });
15127
15137
  } else if (ev.data instanceof ArrayBuffer) {
15128
15138
  resp = SignalResponse.fromBinary(new Uint8Array(ev.data));
15129
15139
  } else {
@@ -18420,9 +18430,6 @@ class LocalAudioTrack extends LocalTrack {
18420
18430
  if (this.processor) {
18421
18431
  yield this.stopProcessor();
18422
18432
  }
18423
- if (this.kind === 'unknown') {
18424
- throw TypeError('cannot set processor on track of unknown kind');
18425
- }
18426
18433
  const processorOptions = {
18427
18434
  kind: this.kind,
18428
18435
  track: this._mediaStreamTrack,
@@ -22477,7 +22484,8 @@ class Room extends eventsExports.EventEmitter {
22477
22484
  this.emit(RoomEvent.TrackUnmuted, pub, this.localParticipant);
22478
22485
  };
22479
22486
  this.onLocalTrackPublished = pub => __awaiter(this, void 0, void 0, function* () {
22480
- var _r;
22487
+ var _r, _s, _t, _u;
22488
+ (_t = (_s = (_r = pub.track) === null || _r === void 0 ? void 0 : _r.getProcessor()) === null || _s === void 0 ? void 0 : _s.onPublish) === null || _t === void 0 ? void 0 : _t.call(_s, this);
22481
22489
  this.emit(RoomEvent.LocalTrackPublished, pub, this.localParticipant);
22482
22490
  if (pub.track instanceof LocalAudioTrack) {
22483
22491
  const trackIsSilent = yield pub.track.checkForSilence();
@@ -22485,7 +22493,7 @@ class Room extends eventsExports.EventEmitter {
22485
22493
  this.emit(RoomEvent.LocalAudioSilenceDetected, pub);
22486
22494
  }
22487
22495
  }
22488
- const deviceId = yield (_r = pub.track) === null || _r === void 0 ? void 0 : _r.getDeviceId();
22496
+ const deviceId = yield (_u = pub.track) === null || _u === void 0 ? void 0 : _u.getDeviceId();
22489
22497
  const deviceKind = sourceToKind(pub.source);
22490
22498
  if (deviceKind && deviceId && deviceId !== this.localParticipant.activeDeviceMap.get(deviceKind)) {
22491
22499
  this.localParticipant.activeDeviceMap.set(deviceKind, deviceId);