livekit-client 2.5.9 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/README.md +54 -0
  2. package/dist/livekit-client.e2ee.worker.js +1 -1
  3. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  4. package/dist/livekit-client.e2ee.worker.mjs +500 -5114
  5. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  6. package/dist/livekit-client.esm.mjs +519 -127
  7. package/dist/livekit-client.esm.mjs.map +1 -1
  8. package/dist/livekit-client.umd.js +1 -1
  9. package/dist/livekit-client.umd.js.map +1 -1
  10. package/dist/src/api/SignalClient.d.ts.map +1 -1
  11. package/dist/src/index.d.ts +3 -1
  12. package/dist/src/index.d.ts.map +1 -1
  13. package/dist/src/room/PCTransport.d.ts +2 -0
  14. package/dist/src/room/PCTransport.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 +56 -0
  19. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  20. package/dist/src/room/rpc.d.ts +96 -0
  21. package/dist/src/room/rpc.d.ts.map +1 -0
  22. package/dist/src/room/track/LocalTrack.d.ts +1 -1
  23. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  24. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  25. package/dist/src/room/track/utils.d.ts +2 -2
  26. package/dist/src/room/track/utils.d.ts.map +1 -1
  27. package/dist/src/room/utils.d.ts +0 -10
  28. package/dist/src/room/utils.d.ts.map +1 -1
  29. package/dist/ts4.2/src/index.d.ts +4 -1
  30. package/dist/ts4.2/src/room/PCTransport.d.ts +2 -0
  31. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +56 -0
  32. package/dist/ts4.2/src/room/rpc.d.ts +96 -0
  33. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +1 -1
  34. package/dist/ts4.2/src/room/track/utils.d.ts +2 -2
  35. package/dist/ts4.2/src/room/utils.d.ts +0 -10
  36. package/package.json +3 -2
  37. package/src/api/SignalClient.ts +2 -1
  38. package/src/index.ts +3 -1
  39. package/src/room/PCTransport.ts +42 -29
  40. package/src/room/PCTransportManager.ts +2 -1
  41. package/src/room/RTCEngine.ts +3 -1
  42. package/src/room/Room.ts +2 -1
  43. package/src/room/participant/LocalParticipant.test.ts +304 -0
  44. package/src/room/participant/LocalParticipant.ts +340 -1
  45. package/src/room/rpc.ts +172 -0
  46. package/src/room/track/LocalTrack.ts +2 -1
  47. package/src/room/track/LocalVideoTrack.ts +2 -1
  48. package/src/room/track/options.ts +5 -5
  49. package/src/room/track/utils.ts +1 -6
  50. package/src/room/utils.ts +0 -38
  51. package/src/utils/AsyncQueue.test.ts +2 -2
  52. 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.
@@ -4718,14 +4746,14 @@ const RpcResponse = /*@__PURE__*/proto3.makeMessageType("livekit.RpcResponse", (
4718
4746
  no: 3,
4719
4747
  name: "error",
4720
4748
  kind: "message",
4721
- T: RpcError,
4749
+ T: RpcError$1,
4722
4750
  oneof: "value"
4723
4751
  }]);
4724
4752
 
4725
4753
  /**
4726
4754
  * @generated from message livekit.RpcError
4727
4755
  */
4728
- const RpcError = /*@__PURE__*/proto3.makeMessageType("livekit.RpcError", () => [{
4756
+ const RpcError$1 = /*@__PURE__*/proto3.makeMessageType("livekit.RpcError", () => [{
4729
4757
  no: 1,
4730
4758
  name: "code",
4731
4759
  kind: "scalar",
@@ -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.9";
11179
+ var version$1 = "2.6.0";
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
  /**
@@ -11808,11 +11836,7 @@ function screenCaptureToDisplayMediaStreamOptions(options) {
11808
11836
  };
11809
11837
  }
11810
11838
  function mimeTypeToVideoCodecString(mimeType) {
11811
- const codec = mimeType.split('/')[1].toLowerCase();
11812
- if (!videoCodecs.includes(codec)) {
11813
- throw Error("Video codec not supported: ".concat(codec));
11814
- }
11815
- return codec;
11839
+ return mimeType.split('/')[1].toLowerCase();
11816
11840
  }
11817
11841
  function getTrackPublicationInfo(tracks) {
11818
11842
  const infos = [];
@@ -12217,29 +12241,6 @@ function createAudioAnalyser(track, options) {
12217
12241
  cleanup
12218
12242
  };
12219
12243
  }
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
12244
  function isVideoCodec(maybeCodec) {
12244
12245
  return videoCodecs.includes(maybeCodec);
12245
12246
  }
@@ -12447,10 +12448,10 @@ class LocalTrack extends Track {
12447
12448
  };
12448
12449
  this.reacquireTrack = false;
12449
12450
  this.providedByUser = userProvidedTrack;
12450
- this.muteLock = new Mutex();
12451
- this.pauseUpstreamLock = new Mutex();
12452
- this.processorLock = new Mutex();
12453
- this.restartLock = new Mutex();
12451
+ this.muteLock = new h();
12452
+ this.pauseUpstreamLock = new h();
12453
+ this.processorLock = new h();
12454
+ this.restartLock = new h();
12454
12455
  this.setMediaStreamTrack(mediaTrack, true);
12455
12456
  // added to satisfy TS compiler, constraints are synced with MediaStreamTrack
12456
12457
  this._constraints = mediaTrack.getConstraints();
@@ -13237,7 +13238,7 @@ var QueueTaskStatus;
13237
13238
  class AsyncQueue {
13238
13239
  constructor() {
13239
13240
  this.pendingTasks = new Map();
13240
- this.taskMutex = new Mutex();
13241
+ this.taskMutex = new h();
13241
13242
  this.nextTaskIndex = 0;
13242
13243
  }
13243
13244
  run(task) {
@@ -13330,8 +13331,8 @@ class SignalClient {
13330
13331
  this.useJSON = useJSON;
13331
13332
  this.requestQueue = new AsyncQueue();
13332
13333
  this.queuedRequests = [];
13333
- this.closingLock = new Mutex();
13334
- this.connectionLock = new Mutex();
13334
+ this.closingLock = new h();
13335
+ this.connectionLock = new h();
13335
13336
  this.state = SignalConnectionState.DISCONNECTED;
13336
13337
  }
13337
13338
  get logContext() {
@@ -14668,6 +14669,7 @@ class PCTransport extends eventsExports.EventEmitter {
14668
14669
  var _a;
14669
14670
  super();
14670
14671
  this.log = livekitLogger;
14672
+ this.ddExtID = 0;
14671
14673
  this.pendingCandidates = [];
14672
14674
  this.restartingIce = false;
14673
14675
  this.renegotiate = false;
@@ -14889,7 +14891,7 @@ class PCTransport extends eventsExports.EventEmitter {
14889
14891
  return true;
14890
14892
  }
14891
14893
  if (isSVCCodec(trackbr.codec)) {
14892
- ensureVideoDDExtensionForSVC(media);
14894
+ this.ensureVideoDDExtensionForSVC(media, sdpParsed);
14893
14895
  }
14894
14896
  // TODO: av1 slow starting issue already fixed in chrome 124, clean this after some versions
14895
14897
  // mung sdp for av1 bitrate setting that can't apply by sendEncoding
@@ -15076,6 +15078,36 @@ class PCTransport extends eventsExports.EventEmitter {
15076
15078
  }
15077
15079
  });
15078
15080
  }
15081
+ ensureVideoDDExtensionForSVC(media, sdp) {
15082
+ var _a, _b;
15083
+ const ddFound = (_a = media.ext) === null || _a === void 0 ? void 0 : _a.some(ext => {
15084
+ if (ext.uri === ddExtensionURI) {
15085
+ return true;
15086
+ }
15087
+ return false;
15088
+ });
15089
+ if (!ddFound) {
15090
+ if (this.ddExtID === 0) {
15091
+ let maxID = 0;
15092
+ sdp.media.forEach(m => {
15093
+ var _a;
15094
+ if (m.type !== 'video') {
15095
+ return;
15096
+ }
15097
+ (_a = m.ext) === null || _a === void 0 ? void 0 : _a.forEach(ext => {
15098
+ if (ext.value > maxID) {
15099
+ maxID = ext.value;
15100
+ }
15101
+ });
15102
+ });
15103
+ this.ddExtID = maxID + 1;
15104
+ }
15105
+ (_b = media.ext) === null || _b === void 0 ? void 0 : _b.push({
15106
+ value: this.ddExtID,
15107
+ uri: ddExtensionURI
15108
+ });
15109
+ }
15110
+ }
15079
15111
  }
15080
15112
  function ensureAudioNackAndStereo(media, stereoMids, nackMids) {
15081
15113
  // found opus codec to add nack fb
@@ -15111,25 +15143,6 @@ function ensureAudioNackAndStereo(media, stereoMids, nackMids) {
15111
15143
  }
15112
15144
  }
15113
15145
  }
15114
- function ensureVideoDDExtensionForSVC(media) {
15115
- var _a, _b;
15116
- let maxID = 0;
15117
- const ddFound = (_a = media.ext) === null || _a === void 0 ? void 0 : _a.some(ext => {
15118
- if (ext.uri === ddExtensionURI) {
15119
- return true;
15120
- }
15121
- if (ext.value > maxID) {
15122
- maxID = ext.value;
15123
- }
15124
- return false;
15125
- });
15126
- if (!ddFound) {
15127
- (_b = media.ext) === null || _b === void 0 ? void 0 : _b.push({
15128
- value: maxID + 1,
15129
- uri: ddExtensionURI
15130
- });
15131
- }
15132
- }
15133
15146
  function extractStereoAndNackAudioFromOffer(offer) {
15134
15147
  var _a;
15135
15148
  const stereoMids = [];
@@ -15280,8 +15293,8 @@ class PCTransportManager {
15280
15293
  (_a = this.onPublisherOffer) === null || _a === void 0 ? void 0 : _a.call(this, offer);
15281
15294
  };
15282
15295
  this.state = PCTransportState.NEW;
15283
- this.connectionLock = new Mutex();
15284
- this.remoteOfferLock = new Mutex();
15296
+ this.connectionLock = new h();
15297
+ this.remoteOfferLock = new h();
15285
15298
  }
15286
15299
  get logContext() {
15287
15300
  var _a, _b;
@@ -16120,7 +16133,7 @@ class LocalVideoTrack extends LocalTrack {
16120
16133
  }
16121
16134
  this.prevStats = statsMap;
16122
16135
  });
16123
- this.senderLock = new Mutex();
16136
+ this.senderLock = new h();
16124
16137
  }
16125
16138
  get isSimulcast() {
16126
16139
  if (this.sender && this.sender.getParameters().encodings.length > 1) {
@@ -16880,8 +16893,8 @@ class RTCEngine extends eventsExports.EventEmitter {
16880
16893
  this.client.signalLatency = this.options.expSignalLatency;
16881
16894
  this.reconnectPolicy = this.options.reconnectPolicy;
16882
16895
  this.registerOnLineListener();
16883
- this.closingLock = new Mutex();
16884
- this.dataProcessLock = new Mutex();
16896
+ this.closingLock = new h();
16897
+ this.dataProcessLock = new h();
16885
16898
  this.dcBufferStatus = new Map([[DataPacket_Kind.LOSSY, true], [DataPacket_Kind.RELIABLE, true]]);
16886
16899
  this.client.onParticipantUpdate = updates => this.emit(EngineEvent.ParticipantUpdate, updates);
16887
16900
  this.client.onConnectionQuality = update => this.emit(EngineEvent.ConnectionQualityUpdate, update);
@@ -16946,6 +16959,7 @@ class RTCEngine extends eventsExports.EventEmitter {
16946
16959
  }
16947
16960
  try {
16948
16961
  this._isClosed = true;
16962
+ this.joinAttempts = 0;
16949
16963
  this.emit(EngineEvent.Closing);
16950
16964
  this.removeAllListeners();
16951
16965
  this.deregisterOnLineListener();
@@ -17859,6 +17873,120 @@ function getCloudConfigUrl(serverUrl) {
17859
17873
  return "".concat(serverUrl.protocol.replace('ws', 'http'), "//").concat(serverUrl.host, "/settings");
17860
17874
  }
17861
17875
 
17876
+ // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
17877
+ //
17878
+ // SPDX-License-Identifier: Apache-2.0
17879
+ /**
17880
+ * Specialized error handling for RPC methods.
17881
+ *
17882
+ * Instances of this type, when thrown in a method handler, will have their `message`
17883
+ * serialized and sent across the wire. The sender will receive an equivalent error on the other side.
17884
+ *
17885
+ * Built-in types are included but developers may use any string, with a max length of 256 bytes.
17886
+ */
17887
+ class RpcError extends Error {
17888
+ /**
17889
+ * Creates an error object with the given code and message, plus an optional data payload.
17890
+ *
17891
+ * If thrown in an RPC method handler, the error will be sent back to the caller.
17892
+ *
17893
+ * Error codes 1001-1999 are reserved for built-in errors (see RpcError.ErrorCode for their meanings).
17894
+ */
17895
+ constructor(code, message, data) {
17896
+ super(message);
17897
+ this.code = code;
17898
+ this.message = truncateBytes(message, RpcError.MAX_MESSAGE_BYTES);
17899
+ this.data = data ? truncateBytes(data, RpcError.MAX_DATA_BYTES) : undefined;
17900
+ }
17901
+ /**
17902
+ * @internal
17903
+ */
17904
+ static fromProto(proto) {
17905
+ return new RpcError(proto.code, proto.message, proto.data);
17906
+ }
17907
+ /**
17908
+ * @internal
17909
+ */
17910
+ toProto() {
17911
+ return new RpcError$1({
17912
+ code: this.code,
17913
+ message: this.message,
17914
+ data: this.data
17915
+ });
17916
+ }
17917
+ /**
17918
+ * Creates an error object from the code, with an auto-populated message.
17919
+ *
17920
+ * @internal
17921
+ */
17922
+ static builtIn(key, data) {
17923
+ return new RpcError(RpcError.ErrorCode[key], RpcError.ErrorMessage[key], data);
17924
+ }
17925
+ }
17926
+ RpcError.MAX_MESSAGE_BYTES = 256;
17927
+ RpcError.MAX_DATA_BYTES = 15360; // 15 KB
17928
+ RpcError.ErrorCode = {
17929
+ APPLICATION_ERROR: 1500,
17930
+ CONNECTION_TIMEOUT: 1501,
17931
+ RESPONSE_TIMEOUT: 1502,
17932
+ RECIPIENT_DISCONNECTED: 1503,
17933
+ RESPONSE_PAYLOAD_TOO_LARGE: 1504,
17934
+ SEND_FAILED: 1505,
17935
+ UNSUPPORTED_METHOD: 1400,
17936
+ RECIPIENT_NOT_FOUND: 1401,
17937
+ REQUEST_PAYLOAD_TOO_LARGE: 1402,
17938
+ UNSUPPORTED_SERVER: 1403,
17939
+ UNSUPPORTED_VERSION: 1404
17940
+ };
17941
+ /**
17942
+ * @internal
17943
+ */
17944
+ RpcError.ErrorMessage = {
17945
+ APPLICATION_ERROR: 'Application error in method handler',
17946
+ CONNECTION_TIMEOUT: 'Connection timeout',
17947
+ RESPONSE_TIMEOUT: 'Response timeout',
17948
+ RECIPIENT_DISCONNECTED: 'Recipient disconnected',
17949
+ RESPONSE_PAYLOAD_TOO_LARGE: 'Response payload too large',
17950
+ SEND_FAILED: 'Failed to send',
17951
+ UNSUPPORTED_METHOD: 'Method not supported at destination',
17952
+ RECIPIENT_NOT_FOUND: 'Recipient not found',
17953
+ REQUEST_PAYLOAD_TOO_LARGE: 'Request payload too large',
17954
+ UNSUPPORTED_SERVER: 'RPC not supported by server',
17955
+ UNSUPPORTED_VERSION: 'Unsupported RPC version'
17956
+ };
17957
+ /*
17958
+ * Maximum payload size for RPC requests and responses. If a payload exceeds this size,
17959
+ * the RPC call will fail with a REQUEST_PAYLOAD_TOO_LARGE(1402) or RESPONSE_PAYLOAD_TOO_LARGE(1504) error.
17960
+ */
17961
+ const MAX_PAYLOAD_BYTES = 15360; // 15 KB
17962
+ /**
17963
+ * @internal
17964
+ */
17965
+ function byteLength(str) {
17966
+ const encoder = new TextEncoder();
17967
+ return encoder.encode(str).length;
17968
+ }
17969
+ /**
17970
+ * @internal
17971
+ */
17972
+ function truncateBytes(str, maxBytes) {
17973
+ if (byteLength(str) <= maxBytes) {
17974
+ return str;
17975
+ }
17976
+ let low = 0;
17977
+ let high = str.length;
17978
+ const encoder = new TextEncoder();
17979
+ while (low < high) {
17980
+ const mid = Math.floor((low + high + 1) / 2);
17981
+ if (encoder.encode(str.slice(0, mid)).length <= maxBytes) {
17982
+ low = mid;
17983
+ } else {
17984
+ high = mid - 1;
17985
+ }
17986
+ }
17987
+ return str.slice(0, low);
17988
+ }
17989
+
17862
17990
  class RemoteTrack extends Track {
17863
17991
  constructor(mediaTrack, sid, kind, receiver, loggerOptions) {
17864
17992
  super(mediaTrack, kind, loggerOptions);
@@ -19094,6 +19222,9 @@ class LocalParticipant extends Participant {
19094
19222
  this.allParticipantsAllowedToSubscribe = true;
19095
19223
  this.encryptionType = Encryption_Type.NONE;
19096
19224
  this.enabledPublishVideoCodecs = [];
19225
+ this.rpcHandlers = new Map();
19226
+ this.pendingAcks = new Map();
19227
+ this.pendingResponses = new Map();
19097
19228
  this.handleReconnecting = () => {
19098
19229
  if (!this.reconnectFuture) {
19099
19230
  this.reconnectFuture = new Future();
@@ -19127,6 +19258,29 @@ class LocalParticipant extends Participant {
19127
19258
  this.pendingSignalRequests.delete(requestId);
19128
19259
  }
19129
19260
  };
19261
+ this.handleDataPacket = packet => {
19262
+ switch (packet.value.case) {
19263
+ case 'rpcRequest':
19264
+ let rpcRequest = packet.value.value;
19265
+ this.handleIncomingRpcRequest(packet.participantIdentity, rpcRequest.id, rpcRequest.method, rpcRequest.payload, rpcRequest.responseTimeoutMs, rpcRequest.version);
19266
+ break;
19267
+ case 'rpcResponse':
19268
+ let rpcResponse = packet.value.value;
19269
+ let payload = null;
19270
+ let error = null;
19271
+ if (rpcResponse.value.case === 'payload') {
19272
+ payload = rpcResponse.value.value;
19273
+ } else if (rpcResponse.value.case === 'error') {
19274
+ error = RpcError.fromProto(rpcResponse.value.value);
19275
+ }
19276
+ this.handleIncomingRpcResponse(rpcResponse.requestId, payload, error);
19277
+ break;
19278
+ case 'rpcAck':
19279
+ let rpcAck = packet.value.value;
19280
+ this.handleIncomingRpcAck(rpcAck.requestId);
19281
+ break;
19282
+ }
19283
+ };
19130
19284
  this.updateTrackSubscriptionPermissions = () => {
19131
19285
  this.log.debug('updating track subscription permissions', Object.assign(Object.assign({}, this.logContext), {
19132
19286
  allParticipantsAllowed: this.allParticipantsAllowedToSubscribe,
@@ -19314,7 +19468,7 @@ class LocalParticipant extends Participant {
19314
19468
  pub.unmute();
19315
19469
  }
19316
19470
  });
19317
- this.engine.on(EngineEvent.Connected, this.handleReconnected).on(EngineEvent.SignalRestarted, this.handleReconnected).on(EngineEvent.SignalResumed, this.handleReconnected).on(EngineEvent.Restarting, this.handleReconnecting).on(EngineEvent.Resuming, this.handleReconnecting).on(EngineEvent.LocalTrackUnpublished, this.handleLocalTrackUnpublished).on(EngineEvent.SubscribedQualityUpdate, this.handleSubscribedQualityUpdate).on(EngineEvent.Disconnected, this.handleDisconnected).on(EngineEvent.SignalRequestResponse, this.handleSignalRequestResponse);
19471
+ this.engine.on(EngineEvent.Connected, this.handleReconnected).on(EngineEvent.SignalRestarted, this.handleReconnected).on(EngineEvent.SignalResumed, this.handleReconnected).on(EngineEvent.Restarting, this.handleReconnecting).on(EngineEvent.Resuming, this.handleReconnecting).on(EngineEvent.LocalTrackUnpublished, this.handleLocalTrackUnpublished).on(EngineEvent.SubscribedQualityUpdate, this.handleSubscribedQualityUpdate).on(EngineEvent.Disconnected, this.handleDisconnected).on(EngineEvent.SignalRequestResponse, this.handleSignalRequestResponse).on(EngineEvent.DataPacketReceived, this.handleDataPacket);
19318
19472
  }
19319
19473
  /**
19320
19474
  * Sets and updates the metadata of the local participant.
@@ -20303,6 +20457,108 @@ class LocalParticipant extends Participant {
20303
20457
  return msg;
20304
20458
  });
20305
20459
  }
20460
+ /**
20461
+ * Initiate an RPC call to a remote participant
20462
+ * @param params - Parameters for initiating the RPC call, see {@link PerformRpcParams}
20463
+ * @returns A promise that resolves with the response payload or rejects with an error.
20464
+ * @throws Error on failure. Details in `message`.
20465
+ */
20466
+ performRpc(_a) {
20467
+ return __awaiter(this, arguments, void 0, function (_ref3) {
20468
+ var _this5 = this;
20469
+ let {
20470
+ destinationIdentity,
20471
+ method,
20472
+ payload,
20473
+ responseTimeout = 10000
20474
+ } = _ref3;
20475
+ return function* () {
20476
+ const maxRoundTripLatency = 2000;
20477
+ return new Promise((resolve, reject) => __awaiter(_this5, void 0, void 0, function* () {
20478
+ var _a, _b, _c, _d;
20479
+ if (byteLength(payload) > MAX_PAYLOAD_BYTES) {
20480
+ reject(RpcError.builtIn('REQUEST_PAYLOAD_TOO_LARGE'));
20481
+ return;
20482
+ }
20483
+ if (((_b = (_a = this.engine.latestJoinResponse) === null || _a === void 0 ? void 0 : _a.serverInfo) === null || _b === void 0 ? void 0 : _b.version) && compareVersions((_d = (_c = this.engine.latestJoinResponse) === null || _c === void 0 ? void 0 : _c.serverInfo) === null || _d === void 0 ? void 0 : _d.version, '1.8.0') < 0) {
20484
+ reject(RpcError.builtIn('UNSUPPORTED_SERVER'));
20485
+ return;
20486
+ }
20487
+ const id = crypto.randomUUID();
20488
+ yield this.publishRpcRequest(destinationIdentity, id, method, payload, responseTimeout - maxRoundTripLatency);
20489
+ const ackTimeoutId = setTimeout(() => {
20490
+ this.pendingAcks.delete(id);
20491
+ reject(RpcError.builtIn('CONNECTION_TIMEOUT'));
20492
+ this.pendingResponses.delete(id);
20493
+ clearTimeout(responseTimeoutId);
20494
+ }, maxRoundTripLatency);
20495
+ this.pendingAcks.set(id, {
20496
+ resolve: () => {
20497
+ clearTimeout(ackTimeoutId);
20498
+ },
20499
+ participantIdentity: destinationIdentity
20500
+ });
20501
+ const responseTimeoutId = setTimeout(() => {
20502
+ this.pendingResponses.delete(id);
20503
+ reject(RpcError.builtIn('RESPONSE_TIMEOUT'));
20504
+ }, responseTimeout);
20505
+ this.pendingResponses.set(id, {
20506
+ resolve: (responsePayload, responseError) => {
20507
+ clearTimeout(responseTimeoutId);
20508
+ if (this.pendingAcks.has(id)) {
20509
+ console.warn('RPC response received before ack', id);
20510
+ this.pendingAcks.delete(id);
20511
+ clearTimeout(ackTimeoutId);
20512
+ }
20513
+ if (responseError) {
20514
+ reject(responseError);
20515
+ } else {
20516
+ resolve(responsePayload !== null && responsePayload !== void 0 ? responsePayload : '');
20517
+ }
20518
+ },
20519
+ participantIdentity: destinationIdentity
20520
+ });
20521
+ }));
20522
+ }();
20523
+ });
20524
+ }
20525
+ /**
20526
+ * Establishes the participant as a receiver for calls of the specified RPC method.
20527
+ * Will overwrite any existing callback for the same method.
20528
+ *
20529
+ * @param method - The name of the indicated RPC method
20530
+ * @param handler - Will be invoked when an RPC request for this method is received
20531
+ * @returns A promise that resolves when the method is successfully registered
20532
+ *
20533
+ * @example
20534
+ * ```typescript
20535
+ * room.localParticipant?.registerRpcMethod(
20536
+ * 'greet',
20537
+ * async (data: RpcInvocationData) => {
20538
+ * console.log(`Received greeting from ${data.callerIdentity}: ${data.payload}`);
20539
+ * return `Hello, ${data.callerIdentity}!`;
20540
+ * }
20541
+ * );
20542
+ * ```
20543
+ *
20544
+ * The handler should return a Promise that resolves to a string.
20545
+ * If unable to respond within `responseTimeout`, the request will result in an error on the caller's side.
20546
+ *
20547
+ * You may throw errors of type `RpcError` with a string `message` in the handler,
20548
+ * and they will be received on the caller's side with the message intact.
20549
+ * Other errors thrown in your handler will not be transmitted as-is, and will instead arrive to the caller as `1500` ("Application Error").
20550
+ */
20551
+ registerRpcMethod(method, handler) {
20552
+ this.rpcHandlers.set(method, handler);
20553
+ }
20554
+ /**
20555
+ * Unregisters a previously registered RPC method.
20556
+ *
20557
+ * @param method - The name of the RPC method to unregister
20558
+ */
20559
+ unregisterRpcMethod(method) {
20560
+ this.rpcHandlers.delete(method);
20561
+ }
20306
20562
  /**
20307
20563
  * Control who can subscribe to LocalParticipant's published tracks.
20308
20564
  *
@@ -20328,6 +20584,140 @@ class LocalParticipant extends Participant {
20328
20584
  this.updateTrackSubscriptionPermissions();
20329
20585
  }
20330
20586
  }
20587
+ handleIncomingRpcAck(requestId) {
20588
+ const handler = this.pendingAcks.get(requestId);
20589
+ if (handler) {
20590
+ handler.resolve();
20591
+ this.pendingAcks.delete(requestId);
20592
+ } else {
20593
+ console.error('Ack received for unexpected RPC request', requestId);
20594
+ }
20595
+ }
20596
+ handleIncomingRpcResponse(requestId, payload, error) {
20597
+ const handler = this.pendingResponses.get(requestId);
20598
+ if (handler) {
20599
+ handler.resolve(payload, error);
20600
+ this.pendingResponses.delete(requestId);
20601
+ } else {
20602
+ console.error('Response received for unexpected RPC request', requestId);
20603
+ }
20604
+ }
20605
+ handleIncomingRpcRequest(callerIdentity, requestId, method, payload, responseTimeout, version) {
20606
+ return __awaiter(this, void 0, void 0, function* () {
20607
+ yield this.publishRpcAck(callerIdentity, requestId);
20608
+ if (version !== 1) {
20609
+ yield this.publishRpcResponse(callerIdentity, requestId, null, RpcError.builtIn('UNSUPPORTED_VERSION'));
20610
+ return;
20611
+ }
20612
+ const handler = this.rpcHandlers.get(method);
20613
+ if (!handler) {
20614
+ yield this.publishRpcResponse(callerIdentity, requestId, null, RpcError.builtIn('UNSUPPORTED_METHOD'));
20615
+ return;
20616
+ }
20617
+ let responseError = null;
20618
+ let responsePayload = null;
20619
+ try {
20620
+ const response = yield handler({
20621
+ requestId,
20622
+ callerIdentity,
20623
+ payload,
20624
+ responseTimeout
20625
+ });
20626
+ if (byteLength(response) > MAX_PAYLOAD_BYTES) {
20627
+ responseError = RpcError.builtIn('RESPONSE_PAYLOAD_TOO_LARGE');
20628
+ console.warn("RPC Response payload too large for ".concat(method));
20629
+ } else {
20630
+ responsePayload = response;
20631
+ }
20632
+ } catch (error) {
20633
+ if (error instanceof RpcError) {
20634
+ responseError = error;
20635
+ } else {
20636
+ console.warn("Uncaught error returned by RPC handler for ".concat(method, ". Returning APPLICATION_ERROR instead."), error);
20637
+ responseError = RpcError.builtIn('APPLICATION_ERROR');
20638
+ }
20639
+ }
20640
+ yield this.publishRpcResponse(callerIdentity, requestId, responsePayload, responseError);
20641
+ });
20642
+ }
20643
+ /** @internal */
20644
+ publishRpcRequest(destinationIdentity, requestId, method, payload, responseTimeout) {
20645
+ return __awaiter(this, void 0, void 0, function* () {
20646
+ const packet = new DataPacket({
20647
+ destinationIdentities: [destinationIdentity],
20648
+ kind: DataPacket_Kind.RELIABLE,
20649
+ value: {
20650
+ case: 'rpcRequest',
20651
+ value: new RpcRequest({
20652
+ id: requestId,
20653
+ method,
20654
+ payload,
20655
+ responseTimeoutMs: responseTimeout,
20656
+ version: 1
20657
+ })
20658
+ }
20659
+ });
20660
+ yield this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
20661
+ });
20662
+ }
20663
+ /** @internal */
20664
+ publishRpcResponse(destinationIdentity, requestId, payload, error) {
20665
+ return __awaiter(this, void 0, void 0, function* () {
20666
+ const packet = new DataPacket({
20667
+ destinationIdentities: [destinationIdentity],
20668
+ kind: DataPacket_Kind.RELIABLE,
20669
+ value: {
20670
+ case: 'rpcResponse',
20671
+ value: new RpcResponse({
20672
+ requestId,
20673
+ value: error ? {
20674
+ case: 'error',
20675
+ value: error.toProto()
20676
+ } : {
20677
+ case: 'payload',
20678
+ value: payload !== null && payload !== void 0 ? payload : ''
20679
+ }
20680
+ })
20681
+ }
20682
+ });
20683
+ yield this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
20684
+ });
20685
+ }
20686
+ /** @internal */
20687
+ publishRpcAck(destinationIdentity, requestId) {
20688
+ return __awaiter(this, void 0, void 0, function* () {
20689
+ const packet = new DataPacket({
20690
+ destinationIdentities: [destinationIdentity],
20691
+ kind: DataPacket_Kind.RELIABLE,
20692
+ value: {
20693
+ case: 'rpcAck',
20694
+ value: new RpcAck({
20695
+ requestId
20696
+ })
20697
+ }
20698
+ });
20699
+ yield this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
20700
+ });
20701
+ }
20702
+ /** @internal */
20703
+ handleParticipantDisconnected(participantIdentity) {
20704
+ for (const [id, {
20705
+ participantIdentity: pendingIdentity
20706
+ }] of this.pendingAcks) {
20707
+ if (pendingIdentity === participantIdentity) {
20708
+ this.pendingAcks.delete(id);
20709
+ }
20710
+ }
20711
+ for (const [id, {
20712
+ participantIdentity: pendingIdentity,
20713
+ resolve
20714
+ }] of this.pendingResponses) {
20715
+ if (pendingIdentity === participantIdentity) {
20716
+ resolve(null, RpcError.builtIn('RECIPIENT_DISCONNECTED'));
20717
+ this.pendingResponses.delete(id);
20718
+ }
20719
+ }
20720
+ }
20331
20721
  /** @internal */
20332
20722
  setEnabledPublishCodecs(codecs) {
20333
20723
  this.enabledPublishVideoCodecs = codecs.filter(c => c.mime.split('/')[0].toLowerCase() === 'video');
@@ -20382,8 +20772,8 @@ class LocalParticipant extends Participant {
20382
20772
  }
20383
20773
  waitForPendingPublicationOfSource(source) {
20384
20774
  return __awaiter(this, void 0, void 0, function* () {
20385
- const publishPromiseEntry = Array.from(this.pendingPublishPromises.entries()).find(_ref3 => {
20386
- let [pendingTrack] = _ref3;
20775
+ const publishPromiseEntry = Array.from(this.pendingPublishPromises.entries()).find(_ref4 => {
20776
+ let [pendingTrack] = _ref4;
20387
20777
  return pendingTrack.source === source;
20388
20778
  });
20389
20779
  if (publishPromiseEntry) {
@@ -21638,7 +22028,7 @@ class Room extends eventsExports.EventEmitter {
21638
22028
  this.options.videoCaptureDefaults = Object.assign(Object.assign({}, videoDefaults), options === null || options === void 0 ? void 0 : options.videoCaptureDefaults);
21639
22029
  this.options.publishDefaults = Object.assign(Object.assign({}, publishDefaults), options === null || options === void 0 ? void 0 : options.publishDefaults);
21640
22030
  this.maybeCreateEngine();
21641
- this.disconnectLock = new Mutex();
22031
+ this.disconnectLock = new h();
21642
22032
  this.localParticipant = new LocalParticipant('', '', this.engine, this.options);
21643
22033
  if (this.options.videoCaptureDefaults.deviceId) {
21644
22034
  this.localParticipant.activeDeviceMap.set('videoinput', unwrapConstraint(this.options.videoCaptureDefaults.deviceId));
@@ -22204,6 +22594,7 @@ class Room extends eventsExports.EventEmitter {
22204
22594
  }
22205
22595
  }
22206
22596
  handleParticipantDisconnected(identity, participant) {
22597
+ var _a;
22207
22598
  // remove and send event
22208
22599
  this.remoteParticipants.delete(identity);
22209
22600
  if (!participant) {
@@ -22213,6 +22604,7 @@ class Room extends eventsExports.EventEmitter {
22213
22604
  participant.unpublishTrack(publication.trackSid, true);
22214
22605
  });
22215
22606
  this.emit(RoomEvent.ParticipantDisconnected, participant);
22607
+ (_a = this.localParticipant) === null || _a === void 0 ? void 0 : _a.handleParticipantDisconnected(participant.identity);
22216
22608
  }
22217
22609
  acquireAudioContext() {
22218
22610
  return __awaiter(this, void 0, void 0, function* () {
@@ -23090,5 +23482,5 @@ function isFacingModeValue(item) {
23090
23482
  return item === undefined || allowedValues.includes(item);
23091
23483
  }
23092
23484
 
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 };
23485
+ 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, RpcError, 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
23486
  //# sourceMappingURL=livekit-client.esm.mjs.map