livekit-client 1.6.2 → 1.6.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.
Files changed (64) hide show
  1. package/dist/livekit-client.esm.mjs +468 -140
  2. package/dist/livekit-client.esm.mjs.map +1 -1
  3. package/dist/livekit-client.umd.js +1 -1
  4. package/dist/livekit-client.umd.js.map +1 -1
  5. package/dist/src/api/SignalClient.d.ts +3 -3
  6. package/dist/src/api/SignalClient.d.ts.map +1 -1
  7. package/dist/src/connectionHelper/ConnectionCheck.d.ts +2 -2
  8. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  9. package/dist/src/index.d.ts +2 -1
  10. package/dist/src/index.d.ts.map +1 -1
  11. package/dist/src/proto/livekit_models.d.ts +53 -4
  12. package/dist/src/proto/livekit_models.d.ts.map +1 -1
  13. package/dist/src/proto/livekit_rtc.d.ts +650 -91
  14. package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
  15. package/dist/src/room/PCTransport.d.ts +1 -0
  16. package/dist/src/room/PCTransport.d.ts.map +1 -1
  17. package/dist/src/room/RTCEngine.d.ts +2 -0
  18. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  19. package/dist/src/room/Room.d.ts +1 -1
  20. package/dist/src/room/Room.d.ts.map +1 -1
  21. package/dist/src/room/errors.d.ts +3 -0
  22. package/dist/src/room/errors.d.ts.map +1 -1
  23. package/dist/src/room/participant/LocalParticipant.d.ts +1 -3
  24. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  25. package/dist/src/room/participant/Participant.d.ts +1 -1
  26. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  27. package/dist/src/room/timers.d.ts +13 -0
  28. package/dist/src/room/timers.d.ts.map +1 -0
  29. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  30. package/dist/src/room/track/create.d.ts.map +1 -1
  31. package/dist/src/room/track/options.d.ts +2 -2
  32. package/dist/src/room/track/options.d.ts.map +1 -1
  33. package/dist/src/test/mocks.d.ts +1 -1
  34. package/dist/ts4.2/src/api/SignalClient.d.ts +3 -3
  35. package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -2
  36. package/dist/ts4.2/src/index.d.ts +2 -1
  37. package/dist/ts4.2/src/proto/livekit_models.d.ts +59 -4
  38. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +739 -120
  39. package/dist/ts4.2/src/room/PCTransport.d.ts +1 -0
  40. package/dist/ts4.2/src/room/RTCEngine.d.ts +2 -0
  41. package/dist/ts4.2/src/room/Room.d.ts +1 -1
  42. package/dist/ts4.2/src/room/errors.d.ts +3 -0
  43. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +1 -3
  44. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -1
  45. package/dist/ts4.2/src/room/timers.d.ts +13 -0
  46. package/dist/ts4.2/src/room/track/options.d.ts +2 -2
  47. package/dist/ts4.2/src/test/mocks.d.ts +1 -1
  48. package/package.json +17 -17
  49. package/src/api/SignalClient.ts +33 -21
  50. package/src/connectionHelper/ConnectionCheck.ts +1 -1
  51. package/src/index.ts +2 -0
  52. package/src/proto/google/protobuf/timestamp.ts +2 -2
  53. package/src/proto/livekit_models.ts +158 -10
  54. package/src/proto/livekit_rtc.ts +205 -6
  55. package/src/room/PCTransport.ts +22 -6
  56. package/src/room/RTCEngine.ts +58 -45
  57. package/src/room/Room.ts +8 -10
  58. package/src/room/errors.ts +6 -0
  59. package/src/room/participant/LocalParticipant.ts +12 -17
  60. package/src/room/participant/Participant.ts +10 -2
  61. package/src/room/timers.ts +16 -0
  62. package/src/room/track/RemoteVideoTrack.ts +2 -1
  63. package/src/room/track/create.ts +6 -1
  64. package/src/room/track/options.ts +2 -2
@@ -3997,9 +3997,9 @@ var roots = {};
3997
3997
  var _m0 = /*@__PURE__*/getDefaultExportFromCjs(minimalExports);
3998
3998
 
3999
3999
  /* eslint-disable */
4000
- var globalThis$3 = (() => {
4001
- if (typeof globalThis$3 !== "undefined") {
4002
- return globalThis$3;
4000
+ (() => {
4001
+ if (typeof globalThis !== "undefined") {
4002
+ return globalThis;
4003
4003
  }
4004
4004
  if (typeof self !== "undefined") {
4005
4005
  return self;
@@ -4335,6 +4335,43 @@ function participantInfo_StateToJSON(object) {
4335
4335
  return "UNRECOGNIZED";
4336
4336
  }
4337
4337
  }
4338
+ var Encryption_Type;
4339
+ (function (Encryption_Type) {
4340
+ Encryption_Type[Encryption_Type["NONE"] = 0] = "NONE";
4341
+ Encryption_Type[Encryption_Type["GCM"] = 1] = "GCM";
4342
+ Encryption_Type[Encryption_Type["CUSTOM"] = 2] = "CUSTOM";
4343
+ Encryption_Type[Encryption_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
4344
+ })(Encryption_Type || (Encryption_Type = {}));
4345
+ function encryption_TypeFromJSON(object) {
4346
+ switch (object) {
4347
+ case 0:
4348
+ case "NONE":
4349
+ return Encryption_Type.NONE;
4350
+ case 1:
4351
+ case "GCM":
4352
+ return Encryption_Type.GCM;
4353
+ case 2:
4354
+ case "CUSTOM":
4355
+ return Encryption_Type.CUSTOM;
4356
+ case -1:
4357
+ case "UNRECOGNIZED":
4358
+ default:
4359
+ return Encryption_Type.UNRECOGNIZED;
4360
+ }
4361
+ }
4362
+ function encryption_TypeToJSON(object) {
4363
+ switch (object) {
4364
+ case Encryption_Type.NONE:
4365
+ return "NONE";
4366
+ case Encryption_Type.GCM:
4367
+ return "GCM";
4368
+ case Encryption_Type.CUSTOM:
4369
+ return "CUSTOM";
4370
+ case Encryption_Type.UNRECOGNIZED:
4371
+ default:
4372
+ return "UNRECOGNIZED";
4373
+ }
4374
+ }
4338
4375
  var DataPacket_Kind;
4339
4376
  (function (DataPacket_Kind) {
4340
4377
  DataPacket_Kind[DataPacket_Kind["RELIABLE"] = 0] = "RELIABLE";
@@ -4661,6 +4698,7 @@ function createBaseParticipantPermission() {
4661
4698
  canSubscribe: false,
4662
4699
  canPublish: false,
4663
4700
  canPublishData: false,
4701
+ canPublishSources: [],
4664
4702
  hidden: false,
4665
4703
  recorder: false
4666
4704
  };
@@ -4677,6 +4715,11 @@ const ParticipantPermission = {
4677
4715
  if (message.canPublishData === true) {
4678
4716
  writer.uint32(24).bool(message.canPublishData);
4679
4717
  }
4718
+ writer.uint32(74).fork();
4719
+ for (const v of message.canPublishSources) {
4720
+ writer.int32(v);
4721
+ }
4722
+ writer.ldelim();
4680
4723
  if (message.hidden === true) {
4681
4724
  writer.uint32(56).bool(message.hidden);
4682
4725
  }
@@ -4701,6 +4744,16 @@ const ParticipantPermission = {
4701
4744
  case 3:
4702
4745
  message.canPublishData = reader.bool();
4703
4746
  break;
4747
+ case 9:
4748
+ if ((tag & 7) === 2) {
4749
+ const end2 = reader.uint32() + reader.pos;
4750
+ while (reader.pos < end2) {
4751
+ message.canPublishSources.push(reader.int32());
4752
+ }
4753
+ } else {
4754
+ message.canPublishSources.push(reader.int32());
4755
+ }
4756
+ break;
4704
4757
  case 7:
4705
4758
  message.hidden = reader.bool();
4706
4759
  break;
@@ -4719,6 +4772,7 @@ const ParticipantPermission = {
4719
4772
  canSubscribe: isSet$1(object.canSubscribe) ? Boolean(object.canSubscribe) : false,
4720
4773
  canPublish: isSet$1(object.canPublish) ? Boolean(object.canPublish) : false,
4721
4774
  canPublishData: isSet$1(object.canPublishData) ? Boolean(object.canPublishData) : false,
4775
+ canPublishSources: Array.isArray(object === null || object === void 0 ? void 0 : object.canPublishSources) ? object.canPublishSources.map(e => trackSourceFromJSON(e)) : [],
4722
4776
  hidden: isSet$1(object.hidden) ? Boolean(object.hidden) : false,
4723
4777
  recorder: isSet$1(object.recorder) ? Boolean(object.recorder) : false
4724
4778
  };
@@ -4728,18 +4782,24 @@ const ParticipantPermission = {
4728
4782
  message.canSubscribe !== undefined && (obj.canSubscribe = message.canSubscribe);
4729
4783
  message.canPublish !== undefined && (obj.canPublish = message.canPublish);
4730
4784
  message.canPublishData !== undefined && (obj.canPublishData = message.canPublishData);
4785
+ if (message.canPublishSources) {
4786
+ obj.canPublishSources = message.canPublishSources.map(e => trackSourceToJSON(e));
4787
+ } else {
4788
+ obj.canPublishSources = [];
4789
+ }
4731
4790
  message.hidden !== undefined && (obj.hidden = message.hidden);
4732
4791
  message.recorder !== undefined && (obj.recorder = message.recorder);
4733
4792
  return obj;
4734
4793
  },
4735
4794
  fromPartial(object) {
4736
- var _a, _b, _c, _d, _e;
4795
+ var _a, _b, _c, _d, _e, _f;
4737
4796
  const message = createBaseParticipantPermission();
4738
4797
  message.canSubscribe = (_a = object.canSubscribe) !== null && _a !== void 0 ? _a : false;
4739
4798
  message.canPublish = (_b = object.canPublish) !== null && _b !== void 0 ? _b : false;
4740
4799
  message.canPublishData = (_c = object.canPublishData) !== null && _c !== void 0 ? _c : false;
4741
- message.hidden = (_d = object.hidden) !== null && _d !== void 0 ? _d : false;
4742
- message.recorder = (_e = object.recorder) !== null && _e !== void 0 ? _e : false;
4800
+ message.canPublishSources = ((_d = object.canPublishSources) === null || _d === void 0 ? void 0 : _d.map(e => e)) || [];
4801
+ message.hidden = (_e = object.hidden) !== null && _e !== void 0 ? _e : false;
4802
+ message.recorder = (_f = object.recorder) !== null && _f !== void 0 ? _f : false;
4743
4803
  return message;
4744
4804
  }
4745
4805
  };
@@ -4989,7 +5049,10 @@ function createBaseTrackInfo() {
4989
5049
  layers: [],
4990
5050
  mimeType: "",
4991
5051
  mid: "",
4992
- codecs: []
5052
+ codecs: [],
5053
+ stereo: false,
5054
+ disableRed: false,
5055
+ encryption: 0
4993
5056
  };
4994
5057
  }
4995
5058
  const TrackInfo = {
@@ -5034,6 +5097,15 @@ const TrackInfo = {
5034
5097
  for (const v of message.codecs) {
5035
5098
  SimulcastCodecInfo.encode(v, writer.uint32(106).fork()).ldelim();
5036
5099
  }
5100
+ if (message.stereo === true) {
5101
+ writer.uint32(112).bool(message.stereo);
5102
+ }
5103
+ if (message.disableRed === true) {
5104
+ writer.uint32(120).bool(message.disableRed);
5105
+ }
5106
+ if (message.encryption !== 0) {
5107
+ writer.uint32(128).int32(message.encryption);
5108
+ }
5037
5109
  return writer;
5038
5110
  },
5039
5111
  decode(input, length) {
@@ -5082,6 +5154,15 @@ const TrackInfo = {
5082
5154
  case 13:
5083
5155
  message.codecs.push(SimulcastCodecInfo.decode(reader, reader.uint32()));
5084
5156
  break;
5157
+ case 14:
5158
+ message.stereo = reader.bool();
5159
+ break;
5160
+ case 15:
5161
+ message.disableRed = reader.bool();
5162
+ break;
5163
+ case 16:
5164
+ message.encryption = reader.int32();
5165
+ break;
5085
5166
  default:
5086
5167
  reader.skipType(tag & 7);
5087
5168
  break;
@@ -5103,7 +5184,10 @@ const TrackInfo = {
5103
5184
  layers: Array.isArray(object === null || object === void 0 ? void 0 : object.layers) ? object.layers.map(e => VideoLayer.fromJSON(e)) : [],
5104
5185
  mimeType: isSet$1(object.mimeType) ? String(object.mimeType) : "",
5105
5186
  mid: isSet$1(object.mid) ? String(object.mid) : "",
5106
- codecs: Array.isArray(object === null || object === void 0 ? void 0 : object.codecs) ? object.codecs.map(e => SimulcastCodecInfo.fromJSON(e)) : []
5187
+ codecs: Array.isArray(object === null || object === void 0 ? void 0 : object.codecs) ? object.codecs.map(e => SimulcastCodecInfo.fromJSON(e)) : [],
5188
+ stereo: isSet$1(object.stereo) ? Boolean(object.stereo) : false,
5189
+ disableRed: isSet$1(object.disableRed) ? Boolean(object.disableRed) : false,
5190
+ encryption: isSet$1(object.encryption) ? encryption_TypeFromJSON(object.encryption) : 0
5107
5191
  };
5108
5192
  },
5109
5193
  toJSON(message) {
@@ -5129,10 +5213,13 @@ const TrackInfo = {
5129
5213
  } else {
5130
5214
  obj.codecs = [];
5131
5215
  }
5216
+ message.stereo !== undefined && (obj.stereo = message.stereo);
5217
+ message.disableRed !== undefined && (obj.disableRed = message.disableRed);
5218
+ message.encryption !== undefined && (obj.encryption = encryption_TypeToJSON(message.encryption));
5132
5219
  return obj;
5133
5220
  },
5134
5221
  fromPartial(object) {
5135
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
5222
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5136
5223
  const message = createBaseTrackInfo();
5137
5224
  message.sid = (_a = object.sid) !== null && _a !== void 0 ? _a : "";
5138
5225
  message.type = (_b = object.type) !== null && _b !== void 0 ? _b : 0;
@@ -5147,6 +5234,9 @@ const TrackInfo = {
5147
5234
  message.mimeType = (_l = object.mimeType) !== null && _l !== void 0 ? _l : "";
5148
5235
  message.mid = (_m = object.mid) !== null && _m !== void 0 ? _m : "";
5149
5236
  message.codecs = ((_o = object.codecs) === null || _o === void 0 ? void 0 : _o.map(e => SimulcastCodecInfo.fromPartial(e))) || [];
5237
+ message.stereo = (_p = object.stereo) !== null && _p !== void 0 ? _p : false;
5238
+ message.disableRed = (_q = object.disableRed) !== null && _q !== void 0 ? _q : false;
5239
+ message.encryption = (_r = object.encryption) !== null && _r !== void 0 ? _r : 0;
5150
5240
  return message;
5151
5241
  }
5152
5242
  };
@@ -5995,9 +6085,9 @@ const DisabledCodecs = {
5995
6085
  return message;
5996
6086
  }
5997
6087
  };
5998
- var globalThis$2 = (() => {
5999
- if (typeof globalThis$2 !== "undefined") {
6000
- return globalThis$2;
6088
+ var tsProtoGlobalThis$1 = (() => {
6089
+ if (typeof globalThis !== "undefined") {
6090
+ return globalThis;
6001
6091
  }
6002
6092
  if (typeof self !== "undefined") {
6003
6093
  return self;
@@ -6011,10 +6101,10 @@ var globalThis$2 = (() => {
6011
6101
  throw "Unable to locate global object";
6012
6102
  })();
6013
6103
  function bytesFromBase64(b64) {
6014
- if (globalThis$2.Buffer) {
6015
- return Uint8Array.from(globalThis$2.Buffer.from(b64, "base64"));
6104
+ if (tsProtoGlobalThis$1.Buffer) {
6105
+ return Uint8Array.from(tsProtoGlobalThis$1.Buffer.from(b64, "base64"));
6016
6106
  } else {
6017
- const bin = globalThis$2.atob(b64);
6107
+ const bin = tsProtoGlobalThis$1.atob(b64);
6018
6108
  const arr = new Uint8Array(bin.length);
6019
6109
  for (let i = 0; i < bin.length; ++i) {
6020
6110
  arr[i] = bin.charCodeAt(i);
@@ -6023,19 +6113,19 @@ function bytesFromBase64(b64) {
6023
6113
  }
6024
6114
  }
6025
6115
  function base64FromBytes(arr) {
6026
- if (globalThis$2.Buffer) {
6027
- return globalThis$2.Buffer.from(arr).toString("base64");
6116
+ if (tsProtoGlobalThis$1.Buffer) {
6117
+ return tsProtoGlobalThis$1.Buffer.from(arr).toString("base64");
6028
6118
  } else {
6029
6119
  const bin = [];
6030
6120
  arr.forEach(byte => {
6031
6121
  bin.push(String.fromCharCode(byte));
6032
6122
  });
6033
- return globalThis$2.btoa(bin.join(""));
6123
+ return tsProtoGlobalThis$1.btoa(bin.join(""));
6034
6124
  }
6035
6125
  }
6036
6126
  function longToNumber$1(long) {
6037
6127
  if (long.gt(Number.MAX_SAFE_INTEGER)) {
6038
- throw new globalThis$2.Error("Value is larger than Number.MAX_SAFE_INTEGER");
6128
+ throw new tsProtoGlobalThis$1.Error("Value is larger than Number.MAX_SAFE_INTEGER");
6039
6129
  }
6040
6130
  return long.toNumber();
6041
6131
  }
@@ -9327,7 +9417,7 @@ function createBaseSignalRequest() {
9327
9417
  const SignalRequest = {
9328
9418
  encode(message) {
9329
9419
  let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
9330
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
9420
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
9331
9421
  if (((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "offer") {
9332
9422
  SessionDescription.encode(message.message.offer, writer.uint32(10).fork()).ldelim();
9333
9423
  }
@@ -9367,6 +9457,9 @@ const SignalRequest = {
9367
9457
  if (((_o = message.message) === null || _o === void 0 ? void 0 : _o.$case) === "ping") {
9368
9458
  writer.uint32(112).int64(message.message.ping);
9369
9459
  }
9460
+ if (((_p = message.message) === null || _p === void 0 ? void 0 : _p.$case) === "updateMetadata") {
9461
+ UpdateParticipantMetadata.encode(message.message.updateMetadata, writer.uint32(122).fork()).ldelim();
9462
+ }
9370
9463
  return writer;
9371
9464
  },
9372
9465
  decode(input, length) {
@@ -9454,6 +9547,12 @@ const SignalRequest = {
9454
9547
  ping: longToNumber(reader.int64())
9455
9548
  };
9456
9549
  break;
9550
+ case 15:
9551
+ message.message = {
9552
+ $case: "updateMetadata",
9553
+ updateMetadata: UpdateParticipantMetadata.decode(reader, reader.uint32())
9554
+ };
9555
+ break;
9457
9556
  default:
9458
9557
  reader.skipType(tag & 7);
9459
9558
  break;
@@ -9502,11 +9601,14 @@ const SignalRequest = {
9502
9601
  } : isSet(object.ping) ? {
9503
9602
  $case: "ping",
9504
9603
  ping: Number(object.ping)
9604
+ } : isSet(object.updateMetadata) ? {
9605
+ $case: "updateMetadata",
9606
+ updateMetadata: UpdateParticipantMetadata.fromJSON(object.updateMetadata)
9505
9607
  } : undefined
9506
9608
  };
9507
9609
  },
9508
9610
  toJSON(message) {
9509
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
9611
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
9510
9612
  const obj = {};
9511
9613
  ((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "offer" && (obj.offer = ((_b = message.message) === null || _b === void 0 ? void 0 : _b.offer) ? SessionDescription.toJSON((_c = message.message) === null || _c === void 0 ? void 0 : _c.offer) : undefined);
9512
9614
  ((_d = message.message) === null || _d === void 0 ? void 0 : _d.$case) === "answer" && (obj.answer = ((_e = message.message) === null || _e === void 0 ? void 0 : _e.answer) ? SessionDescription.toJSON((_f = message.message) === null || _f === void 0 ? void 0 : _f.answer) : undefined);
@@ -9521,10 +9623,11 @@ const SignalRequest = {
9521
9623
  ((_6 = message.message) === null || _6 === void 0 ? void 0 : _6.$case) === "syncState" && (obj.syncState = ((_7 = message.message) === null || _7 === void 0 ? void 0 : _7.syncState) ? SyncState.toJSON((_8 = message.message) === null || _8 === void 0 ? void 0 : _8.syncState) : undefined);
9522
9624
  ((_9 = message.message) === null || _9 === void 0 ? void 0 : _9.$case) === "simulate" && (obj.simulate = ((_10 = message.message) === null || _10 === void 0 ? void 0 : _10.simulate) ? SimulateScenario.toJSON((_11 = message.message) === null || _11 === void 0 ? void 0 : _11.simulate) : undefined);
9523
9625
  ((_12 = message.message) === null || _12 === void 0 ? void 0 : _12.$case) === "ping" && (obj.ping = Math.round((_13 = message.message) === null || _13 === void 0 ? void 0 : _13.ping));
9626
+ ((_14 = message.message) === null || _14 === void 0 ? void 0 : _14.$case) === "updateMetadata" && (obj.updateMetadata = ((_15 = message.message) === null || _15 === void 0 ? void 0 : _15.updateMetadata) ? UpdateParticipantMetadata.toJSON((_16 = message.message) === null || _16 === void 0 ? void 0 : _16.updateMetadata) : undefined);
9524
9627
  return obj;
9525
9628
  },
9526
9629
  fromPartial(object) {
9527
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
9630
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
9528
9631
  const message = createBaseSignalRequest();
9529
9632
  if (((_a = object.message) === null || _a === void 0 ? void 0 : _a.$case) === "offer" && ((_b = object.message) === null || _b === void 0 ? void 0 : _b.offer) !== undefined && ((_c = object.message) === null || _c === void 0 ? void 0 : _c.offer) !== null) {
9530
9633
  message.message = {
@@ -9604,6 +9707,12 @@ const SignalRequest = {
9604
9707
  ping: object.message.ping
9605
9708
  };
9606
9709
  }
9710
+ if (((_15 = object.message) === null || _15 === void 0 ? void 0 : _15.$case) === "updateMetadata" && ((_16 = object.message) === null || _16 === void 0 ? void 0 : _16.updateMetadata) !== undefined && ((_17 = object.message) === null || _17 === void 0 ? void 0 : _17.updateMetadata) !== null) {
9711
+ message.message = {
9712
+ $case: "updateMetadata",
9713
+ updateMetadata: UpdateParticipantMetadata.fromPartial(object.message.updateMetadata)
9714
+ };
9715
+ }
9607
9716
  return message;
9608
9717
  }
9609
9718
  };
@@ -9615,7 +9724,7 @@ function createBaseSignalResponse() {
9615
9724
  const SignalResponse = {
9616
9725
  encode(message) {
9617
9726
  let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
9618
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
9727
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
9619
9728
  if (((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "join") {
9620
9729
  JoinResponse.encode(message.message.join, writer.uint32(10).fork()).ldelim();
9621
9730
  }
@@ -9667,6 +9776,9 @@ const SignalResponse = {
9667
9776
  if (((_s = message.message) === null || _s === void 0 ? void 0 : _s.$case) === "pong") {
9668
9777
  writer.uint32(144).int64(message.message.pong);
9669
9778
  }
9779
+ if (((_t = message.message) === null || _t === void 0 ? void 0 : _t.$case) === "reconnect") {
9780
+ ReconnectResponse.encode(message.message.reconnect, writer.uint32(154).fork()).ldelim();
9781
+ }
9670
9782
  return writer;
9671
9783
  },
9672
9784
  decode(input, length) {
@@ -9778,6 +9890,12 @@ const SignalResponse = {
9778
9890
  pong: longToNumber(reader.int64())
9779
9891
  };
9780
9892
  break;
9893
+ case 19:
9894
+ message.message = {
9895
+ $case: "reconnect",
9896
+ reconnect: ReconnectResponse.decode(reader, reader.uint32())
9897
+ };
9898
+ break;
9781
9899
  default:
9782
9900
  reader.skipType(tag & 7);
9783
9901
  break;
@@ -9838,11 +9956,14 @@ const SignalResponse = {
9838
9956
  } : isSet(object.pong) ? {
9839
9957
  $case: "pong",
9840
9958
  pong: Number(object.pong)
9959
+ } : isSet(object.reconnect) ? {
9960
+ $case: "reconnect",
9961
+ reconnect: ReconnectResponse.fromJSON(object.reconnect)
9841
9962
  } : undefined
9842
9963
  };
9843
9964
  },
9844
9965
  toJSON(message) {
9845
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
9966
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27;
9846
9967
  const obj = {};
9847
9968
  ((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "join" && (obj.join = ((_b = message.message) === null || _b === void 0 ? void 0 : _b.join) ? JoinResponse.toJSON((_c = message.message) === null || _c === void 0 ? void 0 : _c.join) : undefined);
9848
9969
  ((_d = message.message) === null || _d === void 0 ? void 0 : _d.$case) === "answer" && (obj.answer = ((_e = message.message) === null || _e === void 0 ? void 0 : _e.answer) ? SessionDescription.toJSON((_f = message.message) === null || _f === void 0 ? void 0 : _f.answer) : undefined);
@@ -9861,10 +9982,11 @@ const SignalResponse = {
9861
9982
  ((_18 = message.message) === null || _18 === void 0 ? void 0 : _18.$case) === "refreshToken" && (obj.refreshToken = (_19 = message.message) === null || _19 === void 0 ? void 0 : _19.refreshToken);
9862
9983
  ((_20 = message.message) === null || _20 === void 0 ? void 0 : _20.$case) === "trackUnpublished" && (obj.trackUnpublished = ((_21 = message.message) === null || _21 === void 0 ? void 0 : _21.trackUnpublished) ? TrackUnpublishedResponse.toJSON((_22 = message.message) === null || _22 === void 0 ? void 0 : _22.trackUnpublished) : undefined);
9863
9984
  ((_23 = message.message) === null || _23 === void 0 ? void 0 : _23.$case) === "pong" && (obj.pong = Math.round((_24 = message.message) === null || _24 === void 0 ? void 0 : _24.pong));
9985
+ ((_25 = message.message) === null || _25 === void 0 ? void 0 : _25.$case) === "reconnect" && (obj.reconnect = ((_26 = message.message) === null || _26 === void 0 ? void 0 : _26.reconnect) ? ReconnectResponse.toJSON((_27 = message.message) === null || _27 === void 0 ? void 0 : _27.reconnect) : undefined);
9864
9986
  return obj;
9865
9987
  },
9866
9988
  fromPartial(object) {
9867
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26;
9989
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29;
9868
9990
  const message = createBaseSignalResponse();
9869
9991
  if (((_a = object.message) === null || _a === void 0 ? void 0 : _a.$case) === "join" && ((_b = object.message) === null || _b === void 0 ? void 0 : _b.join) !== undefined && ((_c = object.message) === null || _c === void 0 ? void 0 : _c.join) !== null) {
9870
9992
  message.message = {
@@ -9968,6 +10090,12 @@ const SignalResponse = {
9968
10090
  pong: object.message.pong
9969
10091
  };
9970
10092
  }
10093
+ if (((_27 = object.message) === null || _27 === void 0 ? void 0 : _27.$case) === "reconnect" && ((_28 = object.message) === null || _28 === void 0 ? void 0 : _28.reconnect) !== undefined && ((_29 = object.message) === null || _29 === void 0 ? void 0 : _29.reconnect) !== null) {
10094
+ message.message = {
10095
+ $case: "reconnect",
10096
+ reconnect: ReconnectResponse.fromPartial(object.message.reconnect)
10097
+ };
10098
+ }
9971
10099
  return message;
9972
10100
  }
9973
10101
  };
@@ -10052,7 +10180,8 @@ function createBaseAddTrackRequest() {
10052
10180
  simulcastCodecs: [],
10053
10181
  sid: "",
10054
10182
  stereo: false,
10055
- disableRed: false
10183
+ disableRed: false,
10184
+ encryption: 0
10056
10185
  };
10057
10186
  }
10058
10187
  const AddTrackRequest = {
@@ -10097,6 +10226,9 @@ const AddTrackRequest = {
10097
10226
  if (message.disableRed === true) {
10098
10227
  writer.uint32(104).bool(message.disableRed);
10099
10228
  }
10229
+ if (message.encryption !== 0) {
10230
+ writer.uint32(112).int32(message.encryption);
10231
+ }
10100
10232
  return writer;
10101
10233
  },
10102
10234
  decode(input, length) {
@@ -10145,6 +10277,9 @@ const AddTrackRequest = {
10145
10277
  case 13:
10146
10278
  message.disableRed = reader.bool();
10147
10279
  break;
10280
+ case 14:
10281
+ message.encryption = reader.int32();
10282
+ break;
10148
10283
  default:
10149
10284
  reader.skipType(tag & 7);
10150
10285
  break;
@@ -10166,7 +10301,8 @@ const AddTrackRequest = {
10166
10301
  simulcastCodecs: Array.isArray(object === null || object === void 0 ? void 0 : object.simulcastCodecs) ? object.simulcastCodecs.map(e => SimulcastCodec.fromJSON(e)) : [],
10167
10302
  sid: isSet(object.sid) ? String(object.sid) : "",
10168
10303
  stereo: isSet(object.stereo) ? Boolean(object.stereo) : false,
10169
- disableRed: isSet(object.disableRed) ? Boolean(object.disableRed) : false
10304
+ disableRed: isSet(object.disableRed) ? Boolean(object.disableRed) : false,
10305
+ encryption: isSet(object.encryption) ? encryption_TypeFromJSON(object.encryption) : 0
10170
10306
  };
10171
10307
  },
10172
10308
  toJSON(message) {
@@ -10192,10 +10328,11 @@ const AddTrackRequest = {
10192
10328
  message.sid !== undefined && (obj.sid = message.sid);
10193
10329
  message.stereo !== undefined && (obj.stereo = message.stereo);
10194
10330
  message.disableRed !== undefined && (obj.disableRed = message.disableRed);
10331
+ message.encryption !== undefined && (obj.encryption = encryption_TypeToJSON(message.encryption));
10195
10332
  return obj;
10196
10333
  },
10197
10334
  fromPartial(object) {
10198
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
10335
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
10199
10336
  const message = createBaseAddTrackRequest();
10200
10337
  message.cid = (_a = object.cid) !== null && _a !== void 0 ? _a : "";
10201
10338
  message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
@@ -10210,6 +10347,7 @@ const AddTrackRequest = {
10210
10347
  message.sid = (_l = object.sid) !== null && _l !== void 0 ? _l : "";
10211
10348
  message.stereo = (_m = object.stereo) !== null && _m !== void 0 ? _m : false;
10212
10349
  message.disableRed = (_o = object.disableRed) !== null && _o !== void 0 ? _o : false;
10350
+ message.encryption = (_p = object.encryption) !== null && _p !== void 0 ? _p : 0;
10213
10351
  return message;
10214
10352
  }
10215
10353
  };
@@ -10492,6 +10630,67 @@ const JoinResponse = {
10492
10630
  return message;
10493
10631
  }
10494
10632
  };
10633
+ function createBaseReconnectResponse() {
10634
+ return {
10635
+ iceServers: [],
10636
+ clientConfiguration: undefined
10637
+ };
10638
+ }
10639
+ const ReconnectResponse = {
10640
+ encode(message) {
10641
+ let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
10642
+ for (const v of message.iceServers) {
10643
+ ICEServer.encode(v, writer.uint32(10).fork()).ldelim();
10644
+ }
10645
+ if (message.clientConfiguration !== undefined) {
10646
+ ClientConfiguration.encode(message.clientConfiguration, writer.uint32(18).fork()).ldelim();
10647
+ }
10648
+ return writer;
10649
+ },
10650
+ decode(input, length) {
10651
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
10652
+ let end = length === undefined ? reader.len : reader.pos + length;
10653
+ const message = createBaseReconnectResponse();
10654
+ while (reader.pos < end) {
10655
+ const tag = reader.uint32();
10656
+ switch (tag >>> 3) {
10657
+ case 1:
10658
+ message.iceServers.push(ICEServer.decode(reader, reader.uint32()));
10659
+ break;
10660
+ case 2:
10661
+ message.clientConfiguration = ClientConfiguration.decode(reader, reader.uint32());
10662
+ break;
10663
+ default:
10664
+ reader.skipType(tag & 7);
10665
+ break;
10666
+ }
10667
+ }
10668
+ return message;
10669
+ },
10670
+ fromJSON(object) {
10671
+ return {
10672
+ iceServers: Array.isArray(object === null || object === void 0 ? void 0 : object.iceServers) ? object.iceServers.map(e => ICEServer.fromJSON(e)) : [],
10673
+ clientConfiguration: isSet(object.clientConfiguration) ? ClientConfiguration.fromJSON(object.clientConfiguration) : undefined
10674
+ };
10675
+ },
10676
+ toJSON(message) {
10677
+ const obj = {};
10678
+ if (message.iceServers) {
10679
+ obj.iceServers = message.iceServers.map(e => e ? ICEServer.toJSON(e) : undefined);
10680
+ } else {
10681
+ obj.iceServers = [];
10682
+ }
10683
+ message.clientConfiguration !== undefined && (obj.clientConfiguration = message.clientConfiguration ? ClientConfiguration.toJSON(message.clientConfiguration) : undefined);
10684
+ return obj;
10685
+ },
10686
+ fromPartial(object) {
10687
+ var _a;
10688
+ const message = createBaseReconnectResponse();
10689
+ message.iceServers = ((_a = object.iceServers) === null || _a === void 0 ? void 0 : _a.map(e => ICEServer.fromPartial(e))) || [];
10690
+ message.clientConfiguration = object.clientConfiguration !== undefined && object.clientConfiguration !== null ? ClientConfiguration.fromPartial(object.clientConfiguration) : undefined;
10691
+ return message;
10692
+ }
10693
+ };
10495
10694
  function createBaseTrackPublishedResponse() {
10496
10695
  return {
10497
10696
  cid: "",
@@ -10786,7 +10985,8 @@ function createBaseUpdateTrackSettings() {
10786
10985
  quality: 0,
10787
10986
  width: 0,
10788
10987
  height: 0,
10789
- fps: 0
10988
+ fps: 0,
10989
+ priority: 0
10790
10990
  };
10791
10991
  }
10792
10992
  const UpdateTrackSettings = {
@@ -10810,6 +11010,9 @@ const UpdateTrackSettings = {
10810
11010
  if (message.fps !== 0) {
10811
11011
  writer.uint32(56).uint32(message.fps);
10812
11012
  }
11013
+ if (message.priority !== 0) {
11014
+ writer.uint32(64).uint32(message.priority);
11015
+ }
10813
11016
  return writer;
10814
11017
  },
10815
11018
  decode(input, length) {
@@ -10837,6 +11040,9 @@ const UpdateTrackSettings = {
10837
11040
  case 7:
10838
11041
  message.fps = reader.uint32();
10839
11042
  break;
11043
+ case 8:
11044
+ message.priority = reader.uint32();
11045
+ break;
10840
11046
  default:
10841
11047
  reader.skipType(tag & 7);
10842
11048
  break;
@@ -10851,7 +11057,8 @@ const UpdateTrackSettings = {
10851
11057
  quality: isSet(object.quality) ? videoQualityFromJSON(object.quality) : 0,
10852
11058
  width: isSet(object.width) ? Number(object.width) : 0,
10853
11059
  height: isSet(object.height) ? Number(object.height) : 0,
10854
- fps: isSet(object.fps) ? Number(object.fps) : 0
11060
+ fps: isSet(object.fps) ? Number(object.fps) : 0,
11061
+ priority: isSet(object.priority) ? Number(object.priority) : 0
10855
11062
  };
10856
11063
  },
10857
11064
  toJSON(message) {
@@ -10866,10 +11073,11 @@ const UpdateTrackSettings = {
10866
11073
  message.width !== undefined && (obj.width = Math.round(message.width));
10867
11074
  message.height !== undefined && (obj.height = Math.round(message.height));
10868
11075
  message.fps !== undefined && (obj.fps = Math.round(message.fps));
11076
+ message.priority !== undefined && (obj.priority = Math.round(message.priority));
10869
11077
  return obj;
10870
11078
  },
10871
11079
  fromPartial(object) {
10872
- var _a, _b, _c, _d, _e, _f;
11080
+ var _a, _b, _c, _d, _e, _f, _g;
10873
11081
  const message = createBaseUpdateTrackSettings();
10874
11082
  message.trackSids = ((_a = object.trackSids) === null || _a === void 0 ? void 0 : _a.map(e => e)) || [];
10875
11083
  message.disabled = (_b = object.disabled) !== null && _b !== void 0 ? _b : false;
@@ -10877,6 +11085,7 @@ const UpdateTrackSettings = {
10877
11085
  message.width = (_d = object.width) !== null && _d !== void 0 ? _d : 0;
10878
11086
  message.height = (_e = object.height) !== null && _e !== void 0 ? _e : 0;
10879
11087
  message.fps = (_f = object.fps) !== null && _f !== void 0 ? _f : 0;
11088
+ message.priority = (_g = object.priority) !== null && _g !== void 0 ? _g : 0;
10880
11089
  return message;
10881
11090
  }
10882
11091
  };
@@ -10998,6 +11207,53 @@ const UpdateVideoLayers = {
10998
11207
  return message;
10999
11208
  }
11000
11209
  };
11210
+ function createBaseUpdateParticipantMetadata() {
11211
+ return {
11212
+ metadata: ""
11213
+ };
11214
+ }
11215
+ const UpdateParticipantMetadata = {
11216
+ encode(message) {
11217
+ let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
11218
+ if (message.metadata !== "") {
11219
+ writer.uint32(10).string(message.metadata);
11220
+ }
11221
+ return writer;
11222
+ },
11223
+ decode(input, length) {
11224
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
11225
+ let end = length === undefined ? reader.len : reader.pos + length;
11226
+ const message = createBaseUpdateParticipantMetadata();
11227
+ while (reader.pos < end) {
11228
+ const tag = reader.uint32();
11229
+ switch (tag >>> 3) {
11230
+ case 1:
11231
+ message.metadata = reader.string();
11232
+ break;
11233
+ default:
11234
+ reader.skipType(tag & 7);
11235
+ break;
11236
+ }
11237
+ }
11238
+ return message;
11239
+ },
11240
+ fromJSON(object) {
11241
+ return {
11242
+ metadata: isSet(object.metadata) ? String(object.metadata) : ""
11243
+ };
11244
+ },
11245
+ toJSON(message) {
11246
+ const obj = {};
11247
+ message.metadata !== undefined && (obj.metadata = message.metadata);
11248
+ return obj;
11249
+ },
11250
+ fromPartial(object) {
11251
+ var _a;
11252
+ const message = createBaseUpdateParticipantMetadata();
11253
+ message.metadata = (_a = object.metadata) !== null && _a !== void 0 ? _a : "";
11254
+ return message;
11255
+ }
11256
+ };
11001
11257
  function createBaseICEServer() {
11002
11258
  return {
11003
11259
  urls: [],
@@ -12102,9 +12358,9 @@ const SimulateScenario = {
12102
12358
  return message;
12103
12359
  }
12104
12360
  };
12105
- var globalThis$1 = (() => {
12106
- if (typeof globalThis$1 !== "undefined") {
12107
- return globalThis$1;
12361
+ var tsProtoGlobalThis = (() => {
12362
+ if (typeof globalThis !== "undefined") {
12363
+ return globalThis;
12108
12364
  }
12109
12365
  if (typeof self !== "undefined") {
12110
12366
  return self;
@@ -12119,7 +12375,7 @@ var globalThis$1 = (() => {
12119
12375
  })();
12120
12376
  function longToNumber(long) {
12121
12377
  if (long.gt(Number.MAX_SAFE_INTEGER)) {
12122
- throw new globalThis$1.Error("Value is larger than Number.MAX_SAFE_INTEGER");
12378
+ throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
12123
12379
  }
12124
12380
  return long.toNumber();
12125
12381
  }
@@ -12144,6 +12400,11 @@ class ConnectionError extends LivekitError {
12144
12400
  this.reason = reason;
12145
12401
  }
12146
12402
  }
12403
+ class DeviceUnsupportedError extends LivekitError {
12404
+ constructor(message) {
12405
+ super(21, message !== null && message !== void 0 ? message : 'device is unsupported');
12406
+ }
12407
+ }
12147
12408
  class TrackInvalidError extends LivekitError {
12148
12409
  constructor(message) {
12149
12410
  super(20, message !== null && message !== void 0 ? message : 'track is invalid');
@@ -12657,7 +12918,7 @@ var uaParser = {
12657
12918
 
12658
12919
  (function (module, exports) {
12659
12920
  /////////////////////////////////////////////////////////////////////////////////
12660
- /* UAParser.js v1.0.2
12921
+ /* UAParser.js v1.0.33
12661
12922
  Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
12662
12923
  MIT License */ /*
12663
12924
  Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
@@ -12671,7 +12932,7 @@ var uaParser = {
12671
12932
  //////////////
12672
12933
  // Constants
12673
12934
  /////////////
12674
- var LIBVERSION = '1.0.2',
12935
+ var LIBVERSION = '1.0.33',
12675
12936
  EMPTY = '',
12676
12937
  UNKNOWN = '?',
12677
12938
  FUNC_TYPE = 'function',
@@ -12691,7 +12952,7 @@ var uaParser = {
12691
12952
  SMARTTV = 'smarttv',
12692
12953
  WEARABLE = 'wearable',
12693
12954
  EMBEDDED = 'embedded',
12694
- UA_MAX_LENGTH = 255;
12955
+ UA_MAX_LENGTH = 350;
12695
12956
  var AMAZON = 'Amazon',
12696
12957
  APPLE = 'Apple',
12697
12958
  ASUS = 'ASUS',
@@ -12707,6 +12968,7 @@ var uaParser = {
12707
12968
  MOTOROLA = 'Motorola',
12708
12969
  OPERA = 'Opera',
12709
12970
  SAMSUNG = 'Samsung',
12971
+ SHARP = 'Sharp',
12710
12972
  SONY = 'Sony',
12711
12973
  XIAOMI = 'Xiaomi',
12712
12974
  ZEBRA = 'Zebra',
@@ -12745,7 +13007,7 @@ var uaParser = {
12745
13007
  },
12746
13008
  trim = function (str, len) {
12747
13009
  if (typeof str === STR_TYPE) {
12748
- str = str.replace(/^\s\s*/, EMPTY).replace(/\s\s*$/, EMPTY);
13010
+ str = str.replace(/^\s\s*/, EMPTY);
12749
13011
  return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
12750
13012
  }
12751
13013
  };
@@ -12884,12 +13146,13 @@ var uaParser = {
12884
13146
  // Internet Explorer
12885
13147
 
12886
13148
  // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
12887
- /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,
13149
+ /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,
12888
13150
  // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
12889
13151
  /(weibo)__([\d\.]+)/i // Weibo
12890
13152
  ], [NAME, VERSION], [/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser
12891
- ], [VERSION, [NAME, 'UC' + BROWSER]], [/\bqbcore\/([\w\.]+)/i // WeChat Desktop for Windows Built-in Browser
12892
- ], [VERSION, [NAME, 'WeChat(Win) Desktop']], [/micromessenger\/([\w\.]+)/i // WeChat
13153
+ ], [VERSION, [NAME, 'UC' + BROWSER]], [/microm.+\bqbcore\/([\w\.]+)/i,
13154
+ // WeChat Desktop for Windows Built-in Browser
13155
+ /\bqbcore\/([\w\.]+).+microm/i], [VERSION, [NAME, 'WeChat(Win) Desktop']], [/micromessenger\/([\w\.]+)/i // WeChat
12893
13156
  ], [VERSION, [NAME, 'WeChat']], [/konqueror\/([\w\.]+)/i // Konqueror
12894
13157
  ], [VERSION, [NAME, 'Konqueror']], [/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11
12895
13158
  ], [VERSION, [NAME, 'IE']], [/yabrowser\/([\w\.]+)/i // Yandex
@@ -12902,8 +13165,8 @@ var uaParser = {
12902
13165
  ], [VERSION, [NAME, OPERA + ' Coast']], [/miuibrowser\/([\w\.]+)/i // MIUI Browser
12903
13166
  ], [VERSION, [NAME, 'MIUI ' + BROWSER]], [/fxios\/([-\w\.]+)/i // Firefox for iOS
12904
13167
  ], [VERSION, [NAME, FIREFOX]], [/\bqihu|(qi?ho?o?|360)browser/i // 360
12905
- ], [[NAME, '360 ' + BROWSER]], [/(oculus|samsung|sailfish)browser\/([\w\.]+)/i], [[NAME, /(.+)/, '$1 ' + BROWSER], VERSION], [
12906
- // Oculus/Samsung/Sailfish Browser
13168
+ ], [[NAME, '360 ' + BROWSER]], [/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i], [[NAME, /(.+)/, '$1 ' + BROWSER], VERSION], [
13169
+ // Oculus/Samsung/Sailfish/Huawei Browser
12907
13170
  /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
12908
13171
  ], [[NAME, /_/g, ' '], VERSION], [/(electron)\/([\w\.]+) safari/i,
12909
13172
  // Electron-based App
@@ -12912,7 +13175,9 @@ var uaParser = {
12912
13175
  /m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i // QQBrowser/Baidu App/2345 Browser
12913
13176
  ], [NAME, VERSION], [/(metasr)[\/ ]?([\w\.]+)/i,
12914
13177
  // SouGouBrowser
12915
- /(lbbrowser)/i // LieBao Browser
13178
+ /(lbbrowser)/i,
13179
+ // LieBao Browser
13180
+ /\[(linkedin)app\]/i // LinkedIn App for iOS & Android
12916
13181
  ], [NAME], [
12917
13182
  // WebView
12918
13183
  /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
@@ -12926,8 +13191,8 @@ var uaParser = {
12926
13191
  ], [VERSION, [NAME, CHROME + ' Headless']], [/ wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView
12927
13192
  ], [[NAME, CHROME + ' WebView'], VERSION], [/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser
12928
13193
  ], [VERSION, [NAME, 'Android ' + BROWSER]], [/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia
12929
- ], [NAME, VERSION], [/version\/([\w\.]+) .*mobile\/\w+ (safari)/i // Mobile Safari
12930
- ], [VERSION, [NAME, 'Mobile Safari']], [/version\/([\w\.]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile
13194
+ ], [NAME, VERSION], [/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i // Mobile Safari
13195
+ ], [VERSION, [NAME, 'Mobile Safari']], [/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile
12931
13196
  ], [VERSION, NAME], [/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
12932
13197
  ], [NAME, [VERSION, strMapper, oldSafariMap]], [/(webkit|khtml)\/([\w\.]+)/i], [NAME, VERSION], [
12933
13198
  // Gecko based
@@ -12950,7 +13215,8 @@ var uaParser = {
12950
13215
  /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
12951
13216
  // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
12952
13217
  /(links) \(([\w\.]+)/i // Links
12953
- ], [NAME, VERSION]],
13218
+ ], [NAME, VERSION], [/(cobalt)\/([\w\.]+)/i // Cobalt
13219
+ ], [NAME, [VERSION, /master.|lts./, ""]]],
12954
13220
  cpu: [[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i // AMD64 (x64)
12955
13221
  ], [[ARCHITECTURE, 'amd64']], [/(ia32(?=;))/i // IA32 (quicktime)
12956
13222
  ], [[ARCHITECTURE, lowerize]], [/((?:i[346]|x)86)[;\)]/i // IA32 (x86)
@@ -12970,14 +13236,14 @@ var uaParser = {
12970
13236
  /////////////////////////
12971
13237
 
12972
13238
  // Samsung
12973
- /\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i, /samsung[- ]([-\w]+)/i, /sec-(sgh\w+)/i], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [
13239
+ /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i, /samsung[- ]([-\w]+)/i, /sec-(sgh\w+)/i], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [
12974
13240
  // Apple
12975
13241
  /\((ip(?:hone|od)[\w ]*);/i // iPod/iPhone
12976
13242
  ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [/\((ipad);[-\w\),; ]+apple/i,
12977
13243
  // iPad
12978
- /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
13244
+ /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [/(macintosh);/i], [MODEL, [VENDOR, APPLE]], [
12979
13245
  // Huawei
12980
- /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [/(?:huawei|honor)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
13246
+ /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [/(?:huawei|honor)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
12981
13247
  // Xiaomi
12982
13248
  /\b(poco[\w ]+)(?: bui|\))/i,
12983
13249
  // Xiaomi POCO
@@ -12987,7 +13253,7 @@ var uaParser = {
12987
13253
  // Xiaomi Hongmi
12988
13254
  /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,
12989
13255
  // Xiaomi Redmi
12990
- /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
13256
+ /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
12991
13257
  ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets
12992
13258
  ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [
12993
13259
  // OPPO
@@ -13009,7 +13275,7 @@ var uaParser = {
13009
13275
  ], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel
13010
13276
  ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
13011
13277
  // Sony
13012
- /droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [/sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [
13278
+ /droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [/sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [
13013
13279
  // OnePlus
13014
13280
  / (kb2005|in20[12]5|be20[12][59])\b/i, /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [
13015
13281
  // Amazon
@@ -13030,14 +13296,14 @@ var uaParser = {
13030
13296
  // HTC
13031
13297
 
13032
13298
  // ZTE
13033
- /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
13299
+ /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
13034
13300
  ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
13035
13301
  // Acer
13036
13302
  /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
13037
13303
  // Meizu
13038
13304
  /droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [
13039
13305
  // Sharp
13040
- /\b(sh-?[altvz]?\d\d[a-ekm]?)/i], [MODEL, [VENDOR, 'Sharp'], [TYPE, MOBILE]], [
13306
+ /\b(sh-?[altvz]?\d\d[a-ekm]?)/i], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [
13041
13307
  // MIXED
13042
13308
  /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,
13043
13309
  // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
@@ -13116,8 +13382,10 @@ var uaParser = {
13116
13382
  ], [[VENDOR, LG], [TYPE, SMARTTV]], [/(apple) ?tv/i // Apple TV
13117
13383
  ], [VENDOR, [MODEL, APPLE + ' TV'], [TYPE, SMARTTV]], [/crkey/i // Google Chromecast
13118
13384
  ], [[MODEL, CHROME + 'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [/droid.+aft(\w)( bui|\))/i // Fire TV
13119
- ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [/\(dtv[\);].+(aquos)/i // Sharp
13120
- ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
13385
+ ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [/\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i // Sharp
13386
+ ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]], [/(bravia[\w ]+)( bui|\))/i // Sony
13387
+ ], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [/(mitv-\w{5}) bui/i // Xiaomi
13388
+ ], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
13121
13389
  // Roku
13122
13390
  /hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i // HbbTV devices
13123
13391
  ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i // SmartTV from Unidentified Vendors
@@ -13143,7 +13411,7 @@ var uaParser = {
13143
13411
  /droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors
13144
13412
  ], [MODEL, [TYPE, MOBILE]], [/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors
13145
13413
  ], [MODEL, [TYPE, TABLET]], [/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
13146
- ], [[TYPE, TABLET]], [/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
13414
+ ], [[TYPE, TABLET]], [/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
13147
13415
  ], [[TYPE, MOBILE]], [/(android[-\w\. ]{0,9});.+buil/i // Generic Android Device
13148
13416
  ], [MODEL, [VENDOR, 'Generic']]],
13149
13417
  engine: [[/windows.+ edge\/([\w\.]+)/i // EdgeHTML
@@ -13173,7 +13441,7 @@ var uaParser = {
13173
13441
  /cfnetwork\/.+darwin/i], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [/(mac os x) ?([\w\. ]*)/i, /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
13174
13442
  ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [
13175
13443
  // Mobile OSes
13176
- /droid ([\w\.]+)\b.+(android[- ]x86)/i // Android-x86
13444
+ /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
13177
13445
  ], [VERSION, NAME], [
13178
13446
  // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
13179
13447
  /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i, /(blackberry)\w*\/([\w\.]*)/i,
@@ -13336,7 +13604,7 @@ var uaParser = {
13336
13604
  })(uaParser, uaParserExports);
13337
13605
  var UAParser = uaParserExports;
13338
13606
 
13339
- var version$1 = "1.6.2";
13607
+ var version$1 = "1.6.4";
13340
13608
 
13341
13609
  const version = version$1;
13342
13610
  const protocolVersion = 8;
@@ -15603,6 +15871,27 @@ function r(r, e, n) {
15603
15871
  }, d;
15604
15872
  }
15605
15873
 
15874
+ /**
15875
+ * Timers that can be overridden with platform specific implementations
15876
+ * that ensure that they are fired. These should be used when it is critical
15877
+ * that the timer fires on time.
15878
+ */
15879
+ class CriticalTimers {}
15880
+ // eslint-disable-next-line @typescript-eslint/no-implied-eval
15881
+ CriticalTimers.setTimeout = function () {
15882
+ return setTimeout(...arguments);
15883
+ };
15884
+ // eslint-disable-next-line @typescript-eslint/no-implied-eval
15885
+ CriticalTimers.setInterval = function () {
15886
+ return setInterval(...arguments);
15887
+ };
15888
+ CriticalTimers.clearTimeout = function () {
15889
+ return clearTimeout(...arguments);
15890
+ };
15891
+ CriticalTimers.clearInterval = function () {
15892
+ return clearInterval(...arguments);
15893
+ };
15894
+
15606
15895
  const REACTION_DELAY = 100;
15607
15896
  class RemoteVideoTrack extends RemoteTrack {
15608
15897
  constructor(mediaTrack, sid, receiver, adaptiveStreamSettings) {
@@ -15774,7 +16063,7 @@ class RemoteVideoTrack extends RemoteTrack {
15774
16063
  }
15775
16064
  if (!isVisible && Date.now() - lastVisibilityChange < REACTION_DELAY) {
15776
16065
  // delay hidden events
15777
- setTimeout(() => {
16066
+ CriticalTimers.setTimeout(() => {
15778
16067
  this.updateVisibility();
15779
16068
  }, REACTION_DELAY);
15780
16069
  return;
@@ -16220,8 +16509,15 @@ class Participant extends eventsExports.EventEmitter {
16220
16509
  /** @internal */
16221
16510
  setPermissions(permissions) {
16222
16511
  var _a, _b, _c, _d, _e;
16223
- const changed = permissions.canPublish !== ((_a = this.permissions) === null || _a === void 0 ? void 0 : _a.canPublish) || permissions.canSubscribe !== ((_b = this.permissions) === null || _b === void 0 ? void 0 : _b.canSubscribe) || permissions.canPublishData !== ((_c = this.permissions) === null || _c === void 0 ? void 0 : _c.canPublishData) || permissions.hidden !== ((_d = this.permissions) === null || _d === void 0 ? void 0 : _d.hidden) || permissions.recorder !== ((_e = this.permissions) === null || _e === void 0 ? void 0 : _e.recorder);
16512
+ const prevPermissions = this.permissions;
16513
+ const changed = permissions.canPublish !== ((_a = this.permissions) === null || _a === void 0 ? void 0 : _a.canPublish) || permissions.canSubscribe !== ((_b = this.permissions) === null || _b === void 0 ? void 0 : _b.canSubscribe) || permissions.canPublishData !== ((_c = this.permissions) === null || _c === void 0 ? void 0 : _c.canPublishData) || permissions.hidden !== ((_d = this.permissions) === null || _d === void 0 ? void 0 : _d.hidden) || permissions.recorder !== ((_e = this.permissions) === null || _e === void 0 ? void 0 : _e.recorder) || permissions.canPublishSources.length !== this.permissions.canPublishSources.length || permissions.canPublishSources.some((value, index) => {
16514
+ var _a;
16515
+ return value !== ((_a = this.permissions) === null || _a === void 0 ? void 0 : _a.canPublishSources[index]);
16516
+ });
16224
16517
  this.permissions = permissions;
16518
+ if (changed) {
16519
+ this.emit(ParticipantEvent.ParticipantPermissionsChanged, prevPermissions);
16520
+ }
16225
16521
  return changed;
16226
16522
  }
16227
16523
  /** @internal */
@@ -17221,15 +17517,6 @@ class LocalParticipant extends Participant {
17221
17517
  setScreenShareEnabled(enabled, options, publishOptions) {
17222
17518
  return this.setTrackEnabled(Track.Source.ScreenShare, enabled, options, publishOptions);
17223
17519
  }
17224
- /** @internal */
17225
- setPermissions(permissions) {
17226
- const prevPermissions = this.permissions;
17227
- const changed = super.setPermissions(permissions);
17228
- if (changed && prevPermissions) {
17229
- this.emit(ParticipantEvent.ParticipantPermissionsChanged, prevPermissions);
17230
- }
17231
- return changed;
17232
- }
17233
17520
  async setTrackEnabled(source, enabled, options, publishOptions) {
17234
17521
  var _a, _b;
17235
17522
  livekitLogger.debug('setTrackEnabled', {
@@ -17408,6 +17695,9 @@ class LocalParticipant extends Participant {
17408
17695
  };
17409
17696
  }
17410
17697
  }
17698
+ if (navigator.mediaDevices.getDisplayMedia === undefined) {
17699
+ throw new DeviceUnsupportedError('getDisplayMedia not supported');
17700
+ }
17411
17701
  const stream = await navigator.mediaDevices.getDisplayMedia({
17412
17702
  audio: (_a = options.audio) !== null && _a !== void 0 ? _a : false,
17413
17703
  video: videoConstraints
@@ -17796,6 +18086,11 @@ class LocalParticipant extends Participant {
17796
18086
  }
17797
18087
  /** @internal */
17798
18088
  updateInfo(info) {
18089
+ if (info.sid !== this.sid) {
18090
+ // drop updates that specify a wrong sid.
18091
+ // the sid for local participant is only explicitly set on join and full reconnect
18092
+ return;
18093
+ }
17799
18094
  super.updateInfo(info);
17800
18095
  // reconcile track mute status.
17801
18096
  // if server's track mute status doesn't match actual, we'll have to update
@@ -17904,10 +18199,11 @@ class SignalClient {
17904
18199
  this.isReconnecting = true;
17905
18200
  // clear ping interval and restart it once reconnected
17906
18201
  this.clearPingInterval();
17907
- await this.connect(url, token, _objectSpread2(_objectSpread2({}, this.options), {}, {
18202
+ const res = await this.connect(url, token, _objectSpread2(_objectSpread2({}, this.options), {}, {
17908
18203
  reconnect: true,
17909
18204
  sid
17910
18205
  }));
18206
+ return res;
17911
18207
  }
17912
18208
  connect(url, token, opts, abortSignal) {
17913
18209
  this.connectOptions = opts;
@@ -17953,17 +18249,8 @@ class SignalClient {
17953
18249
  // other errors, handle
17954
18250
  this.handleWSError(ev);
17955
18251
  };
17956
- this.ws.onopen = () => {
17957
- if (opts.reconnect) {
17958
- // upon reconnection, there will not be additional handshake
17959
- this.isConnected = true;
17960
- // restart ping interval as it's cleared for reconnection
17961
- this.startPingInterval();
17962
- resolve();
17963
- }
17964
- };
17965
18252
  this.ws.onmessage = async ev => {
17966
- var _a, _b;
18253
+ var _a, _b, _c, _d;
17967
18254
  // not considered connected until JoinResponse is received
17968
18255
  let resp;
17969
18256
  if (typeof ev.data === 'string') {
@@ -17976,6 +18263,7 @@ class SignalClient {
17976
18263
  return;
17977
18264
  }
17978
18265
  if (!this.isConnected) {
18266
+ let shouldProcessMessage = false;
17979
18267
  // handle join message only
17980
18268
  if (((_a = resp.message) === null || _a === void 0 ? void 0 : _a.$case) === 'join') {
17981
18269
  this.isConnected = true;
@@ -17990,10 +18278,24 @@ class SignalClient {
17990
18278
  this.startPingInterval();
17991
18279
  }
17992
18280
  resolve(resp.message.join);
17993
- } else {
17994
- reject(new ConnectionError("did not receive join response, got ".concat((_b = resp.message) === null || _b === void 0 ? void 0 : _b.$case, " instead")));
18281
+ } else if (opts.reconnect) {
18282
+ // in reconnecting, any message received means signal reconnected
18283
+ this.isConnected = true;
18284
+ abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener('abort', abortHandler);
18285
+ this.startPingInterval();
18286
+ if (((_b = resp.message) === null || _b === void 0 ? void 0 : _b.$case) === 'reconnect') {
18287
+ resolve((_c = resp.message) === null || _c === void 0 ? void 0 : _c.reconnect);
18288
+ } else {
18289
+ resolve();
18290
+ shouldProcessMessage = true;
18291
+ }
18292
+ } else if (!opts.reconnect) {
18293
+ // non-reconnect case, should receive join response first
18294
+ reject(new ConnectionError("did not receive join response, got ".concat((_d = resp.message) === null || _d === void 0 ? void 0 : _d.$case, " instead")));
18295
+ }
18296
+ if (!shouldProcessMessage) {
18297
+ return;
17995
18298
  }
17996
- return;
17997
18299
  }
17998
18300
  if (this.signalLatency) {
17999
18301
  await sleep(this.signalLatency);
@@ -18175,6 +18477,10 @@ class SignalClient {
18175
18477
  handleSignalResponse(res) {
18176
18478
  var _a, _b;
18177
18479
  const msg = res.message;
18480
+ if (msg == undefined) {
18481
+ livekitLogger.debug('received unsupported message');
18482
+ return;
18483
+ }
18178
18484
  if (msg.$case === 'answer') {
18179
18485
  const sd = fromProtoSessionDescription(msg.answer);
18180
18486
  if (this.onAnswer) {
@@ -18262,7 +18568,7 @@ class SignalClient {
18262
18568
  livekitLogger.warn('ping timeout duration not set');
18263
18569
  return;
18264
18570
  }
18265
- this.pingTimeout = setTimeout(() => {
18571
+ this.pingTimeout = CriticalTimers.setTimeout(() => {
18266
18572
  livekitLogger.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now() - this.pingTimeoutDuration * 1000).toUTCString()));
18267
18573
  if (this.onClose) {
18268
18574
  this.onClose('ping timeout');
@@ -18271,7 +18577,7 @@ class SignalClient {
18271
18577
  }
18272
18578
  clearPingTimeout() {
18273
18579
  if (this.pingTimeout) {
18274
- clearTimeout(this.pingTimeout);
18580
+ CriticalTimers.clearTimeout(this.pingTimeout);
18275
18581
  }
18276
18582
  }
18277
18583
  startPingInterval() {
@@ -18282,7 +18588,7 @@ class SignalClient {
18282
18588
  return;
18283
18589
  }
18284
18590
  livekitLogger.debug('start ping interval');
18285
- this.pingInterval = setInterval(() => {
18591
+ this.pingInterval = CriticalTimers.setInterval(() => {
18286
18592
  this.sendPing();
18287
18593
  }, this.pingIntervalDuration * 1000);
18288
18594
  }
@@ -18290,7 +18596,7 @@ class SignalClient {
18290
18596
  livekitLogger.debug('clearing ping interval');
18291
18597
  this.clearPingTimeout();
18292
18598
  if (this.pingInterval) {
18293
- clearInterval(this.pingInterval);
18599
+ CriticalTimers.clearInterval(this.pingInterval);
18294
18600
  }
18295
18601
  }
18296
18602
  }
@@ -19083,6 +19389,7 @@ class PCTransport extends eventsExports {
19083
19389
  this.renegotiate = false;
19084
19390
  this.trackBitrates = [];
19085
19391
  this.remoteStereoMids = [];
19392
+ this.remoteNackMids = [];
19086
19393
  // debounced negotiate interface
19087
19394
  this.negotiate = r(onError => {
19088
19395
  this.emit(PCEvents.NegotiationStarted);
@@ -19109,7 +19416,12 @@ class PCTransport extends eventsExports {
19109
19416
  }
19110
19417
  async setRemoteDescription(sd) {
19111
19418
  if (sd.type === 'offer') {
19112
- this.remoteStereoMids = extractStereoTracksFromOffer(sd);
19419
+ let {
19420
+ stereoMids,
19421
+ nackMids
19422
+ } = extractStereoAndNackAudioFromOffer(sd);
19423
+ this.remoteStereoMids = stereoMids;
19424
+ this.remoteNackMids = nackMids;
19113
19425
  }
19114
19426
  await this.pc.setRemoteDescription(sd);
19115
19427
  this.pendingCandidates.forEach(candidate => {
@@ -19155,7 +19467,7 @@ class PCTransport extends eventsExports {
19155
19467
  const sdpParsed = parse((_a = offer.sdp) !== null && _a !== void 0 ? _a : '');
19156
19468
  sdpParsed.media.forEach(media => {
19157
19469
  if (media.type === 'audio') {
19158
- ensureAudioNackAndStereo(media, []);
19470
+ ensureAudioNackAndStereo(media, [], []);
19159
19471
  } else if (media.type === 'video') {
19160
19472
  // mung sdp for codec bitrate setting that can't apply by sendEncoding
19161
19473
  this.trackBitrates.some(trackbr => {
@@ -19201,7 +19513,7 @@ class PCTransport extends eventsExports {
19201
19513
  const sdpParsed = parse((_a = answer.sdp) !== null && _a !== void 0 ? _a : '');
19202
19514
  sdpParsed.media.forEach(media => {
19203
19515
  if (media.type === 'audio') {
19204
- ensureAudioNackAndStereo(media, this.remoteStereoMids);
19516
+ ensureAudioNackAndStereo(media, this.remoteStereoMids, this.remoteNackMids);
19205
19517
  }
19206
19518
  });
19207
19519
  await this.setMungedLocalDescription(answer, write(sdpParsed));
@@ -19245,7 +19557,7 @@ class PCTransport extends eventsExports {
19245
19557
  }
19246
19558
  }
19247
19559
  }
19248
- function ensureAudioNackAndStereo(media, stereoMids) {
19560
+ function ensureAudioNackAndStereo(media, stereoMids, nackMids) {
19249
19561
  // found opus codec to add nack fb
19250
19562
  let opusPayload = 0;
19251
19563
  media.rtp.some(rtp => {
@@ -19260,7 +19572,7 @@ function ensureAudioNackAndStereo(media, stereoMids) {
19260
19572
  if (!media.rtcpFb) {
19261
19573
  media.rtcpFb = [];
19262
19574
  }
19263
- if (!media.rtcpFb.some(fb => fb.payload === opusPayload && fb.type === 'nack')) {
19575
+ if (nackMids.includes(media.mid) && !media.rtcpFb.some(fb => fb.payload === opusPayload && fb.type === 'nack')) {
19264
19576
  media.rtcpFb.push({
19265
19577
  payload: opusPayload,
19266
19578
  type: 'nack'
@@ -19279,12 +19591,14 @@ function ensureAudioNackAndStereo(media, stereoMids) {
19279
19591
  }
19280
19592
  }
19281
19593
  }
19282
- function extractStereoTracksFromOffer(offer) {
19594
+ function extractStereoAndNackAudioFromOffer(offer) {
19283
19595
  var _a;
19284
19596
  const stereoMids = [];
19597
+ const nackMids = [];
19285
19598
  const sdpParsed = parse((_a = offer.sdp) !== null && _a !== void 0 ? _a : '');
19286
19599
  let opusPayload = 0;
19287
19600
  sdpParsed.media.forEach(media => {
19601
+ var _a;
19288
19602
  if (media.type === 'audio') {
19289
19603
  media.rtp.some(rtp => {
19290
19604
  if (rtp.codec === 'opus') {
@@ -19293,6 +19607,9 @@ function extractStereoTracksFromOffer(offer) {
19293
19607
  }
19294
19608
  return false;
19295
19609
  });
19610
+ if ((_a = media.rtcpFb) === null || _a === void 0 ? void 0 : _a.some(fb => fb.payload === opusPayload && fb.type === 'nack')) {
19611
+ nackMids.push(media.mid);
19612
+ }
19296
19613
  media.fmtp.some(fmtp => {
19297
19614
  if (fmtp.payload === opusPayload) {
19298
19615
  if (fmtp.config.includes('sprop-stereo=1')) {
@@ -19304,7 +19621,10 @@ function extractStereoTracksFromOffer(offer) {
19304
19621
  });
19305
19622
  }
19306
19623
  });
19307
- return stereoMids;
19624
+ return {
19625
+ stereoMids,
19626
+ nackMids
19627
+ };
19308
19628
  }
19309
19629
 
19310
19630
  const lossyDataChannel = '_lossy';
@@ -19403,13 +19723,13 @@ class RTCEngine extends eventsExports.EventEmitter {
19403
19723
  if (_this._isClosed) {
19404
19724
  return;
19405
19725
  }
19406
- livekitLogger.debug("".concat(connection, " disconnected"));
19726
+ livekitLogger.warn("".concat(connection, " disconnected"));
19407
19727
  if (_this.reconnectAttempts === 0) {
19408
19728
  // only reset start time on the first try
19409
19729
  _this.reconnectStart = Date.now();
19410
19730
  }
19411
19731
  const disconnect = duration => {
19412
- livekitLogger.info("could not recover connection after ".concat(_this.reconnectAttempts, " attempts, ").concat(duration, "ms. giving up"));
19732
+ livekitLogger.warn("could not recover connection after ".concat(_this.reconnectAttempts, " attempts, ").concat(duration, "ms. giving up"));
19413
19733
  _this.emit(EngineEvent.Disconnected);
19414
19734
  _this.close();
19415
19735
  };
@@ -19426,17 +19746,13 @@ class RTCEngine extends eventsExports.EventEmitter {
19426
19746
  delay = 0;
19427
19747
  }
19428
19748
  livekitLogger.debug("reconnecting in ".concat(delay, "ms"));
19429
- if (_this.reconnectTimeout) {
19430
- clearTimeout(_this.reconnectTimeout);
19431
- }
19432
- _this.reconnectTimeout = setTimeout(() => _this.attemptReconnect(signalEvents), delay);
19749
+ _this.clearReconnectTimeout();
19750
+ _this.reconnectTimeout = CriticalTimers.setTimeout(() => _this.attemptReconnect(signalEvents), delay);
19433
19751
  };
19434
19752
  this.handleBrowserOnLine = () => {
19435
19753
  // in case the engine is currently reconnecting, attempt a reconnect immediately after the browser state has changed to 'onLine'
19436
19754
  if (this.client.isReconnecting) {
19437
- if (this.reconnectTimeout) {
19438
- clearTimeout(this.reconnectTimeout);
19439
- }
19755
+ this.clearReconnectTimeout();
19440
19756
  this.attemptReconnect(true);
19441
19757
  }
19442
19758
  };
@@ -19573,29 +19889,7 @@ class RTCEngine extends eventsExports.EventEmitter {
19573
19889
  return;
19574
19890
  }
19575
19891
  this.participantSid = (_a = joinResponse.participant) === null || _a === void 0 ? void 0 : _a.sid;
19576
- const rtcConfig = _objectSpread2({}, this.rtcConfig);
19577
- // update ICE servers before creating PeerConnection
19578
- if (joinResponse.iceServers && !rtcConfig.iceServers) {
19579
- const rtcIceServers = [];
19580
- joinResponse.iceServers.forEach(iceServer => {
19581
- const rtcIceServer = {
19582
- urls: iceServer.urls
19583
- };
19584
- if (iceServer.username) rtcIceServer.username = iceServer.username;
19585
- if (iceServer.credential) {
19586
- rtcIceServer.credential = iceServer.credential;
19587
- }
19588
- rtcIceServers.push(rtcIceServer);
19589
- });
19590
- rtcConfig.iceServers = rtcIceServers;
19591
- }
19592
- if (joinResponse.clientConfiguration && joinResponse.clientConfiguration.forceRelay === ClientConfigSetting.ENABLED) {
19593
- rtcConfig.iceTransportPolicy = 'relay';
19594
- }
19595
- // @ts-ignore
19596
- rtcConfig.sdpSemantics = 'unified-plan';
19597
- // @ts-ignore
19598
- rtcConfig.continualGatheringPolicy = 'gather_continually';
19892
+ const rtcConfig = this.makeRTCConfiguration(joinResponse);
19599
19893
  this.publisher = new PCTransport(rtcConfig);
19600
19894
  this.subscriber = new PCTransport(rtcConfig);
19601
19895
  this.emit(EngineEvent.TransportsCreated, this.publisher, this.subscriber);
@@ -19727,6 +20021,32 @@ class RTCEngine extends eventsExports.EventEmitter {
19727
20021
  });
19728
20022
  };
19729
20023
  }
20024
+ makeRTCConfiguration(serverResponse) {
20025
+ const rtcConfig = _objectSpread2({}, this.rtcConfig);
20026
+ // update ICE servers before creating PeerConnection
20027
+ if (serverResponse.iceServers && !rtcConfig.iceServers) {
20028
+ const rtcIceServers = [];
20029
+ serverResponse.iceServers.forEach(iceServer => {
20030
+ const rtcIceServer = {
20031
+ urls: iceServer.urls
20032
+ };
20033
+ if (iceServer.username) rtcIceServer.username = iceServer.username;
20034
+ if (iceServer.credential) {
20035
+ rtcIceServer.credential = iceServer.credential;
20036
+ }
20037
+ rtcIceServers.push(rtcIceServer);
20038
+ });
20039
+ rtcConfig.iceServers = rtcIceServers;
20040
+ }
20041
+ if (serverResponse.clientConfiguration && serverResponse.clientConfiguration.forceRelay === ClientConfigSetting.ENABLED) {
20042
+ rtcConfig.iceTransportPolicy = 'relay';
20043
+ }
20044
+ // @ts-ignore
20045
+ rtcConfig.sdpSemantics = 'unified-plan';
20046
+ // @ts-ignore
20047
+ rtcConfig.continualGatheringPolicy = 'gather_continually';
20048
+ return rtcConfig;
20049
+ }
19730
20050
  createDataChannels() {
19731
20051
  if (!this.publisher) {
19732
20052
  return;
@@ -19881,11 +20201,8 @@ class RTCEngine extends eventsExports.EventEmitter {
19881
20201
  } else {
19882
20202
  await this.resumeConnection(signalEvents);
19883
20203
  }
19884
- this.reconnectAttempts = 0;
20204
+ this.clearPendingReconnect();
19885
20205
  this.fullReconnectOnNext = false;
19886
- if (this.reconnectTimeout) {
19887
- clearTimeout(this.reconnectTimeout);
19888
- }
19889
20206
  } catch (e) {
19890
20207
  this.reconnectAttempts += 1;
19891
20208
  let reconnectRequired = false;
@@ -19980,7 +20297,12 @@ class RTCEngine extends eventsExports.EventEmitter {
19980
20297
  this.emit(EngineEvent.Resuming);
19981
20298
  }
19982
20299
  try {
19983
- await this.client.reconnect(this.url, this.token, this.participantSid);
20300
+ const res = await this.client.reconnect(this.url, this.token, this.participantSid);
20301
+ if (res) {
20302
+ const rtcConfig = this.makeRTCConfiguration(res);
20303
+ this.publisher.pc.setConfiguration(rtcConfig);
20304
+ this.subscriber.pc.setConfiguration(rtcConfig);
20305
+ }
19984
20306
  } catch (e) {
19985
20307
  let message = '';
19986
20308
  if (e instanceof Error) {
@@ -20140,10 +20462,13 @@ class RTCEngine extends eventsExports.EventEmitter {
20140
20462
  }
20141
20463
  }
20142
20464
  }
20143
- clearPendingReconnect() {
20465
+ clearReconnectTimeout() {
20144
20466
  if (this.reconnectTimeout) {
20145
- clearTimeout(this.reconnectTimeout);
20467
+ CriticalTimers.clearTimeout(this.reconnectTimeout);
20146
20468
  }
20469
+ }
20470
+ clearPendingReconnect() {
20471
+ this.clearReconnectTimeout();
20147
20472
  this.reconnectAttempts = 0;
20148
20473
  }
20149
20474
  registerOnLineListener() {
@@ -20334,7 +20659,7 @@ class Room extends eventsExports.EventEmitter {
20334
20659
  return;
20335
20660
  }
20336
20661
  // don't return until ICE connected
20337
- const connectTimeout = setTimeout(() => {
20662
+ const connectTimeout = CriticalTimers.setTimeout(() => {
20338
20663
  // timeout
20339
20664
  this.recreateEngine();
20340
20665
  this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
@@ -20342,7 +20667,7 @@ class Room extends eventsExports.EventEmitter {
20342
20667
  }, this.connOptions.peerConnectionTimeout);
20343
20668
  const abortHandler = () => {
20344
20669
  livekitLogger.warn('closing engine');
20345
- clearTimeout(connectTimeout);
20670
+ CriticalTimers.clearTimeout(connectTimeout);
20346
20671
  this.recreateEngine();
20347
20672
  this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
20348
20673
  reject(new ConnectionError('room connection has been cancelled'));
@@ -20353,7 +20678,7 @@ class Room extends eventsExports.EventEmitter {
20353
20678
  (_b = this.abortController) === null || _b === void 0 ? void 0 : _b.signal.addEventListener('abort', abortHandler);
20354
20679
  this.engine.once(EngineEvent.Connected, () => {
20355
20680
  var _a, _b;
20356
- clearTimeout(connectTimeout);
20681
+ CriticalTimers.clearTimeout(connectTimeout);
20357
20682
  (_a = this.abortController) === null || _a === void 0 ? void 0 : _a.signal.removeEventListener('abort', abortHandler);
20358
20683
  // also hook unload event
20359
20684
  if (isWeb()) {
@@ -20459,7 +20784,7 @@ class Room extends eventsExports.EventEmitter {
20459
20784
  this.handleParticipantUpdates = participantInfos => {
20460
20785
  // handle changes to participant state, and send events
20461
20786
  participantInfos.forEach(info => {
20462
- if (info.sid === this.localParticipant.sid || info.identity === this.localParticipant.identity) {
20787
+ if (info.identity === this.localParticipant.identity) {
20463
20788
  this.localParticipant.updateInfo(info);
20464
20789
  return;
20465
20790
  }
@@ -21348,6 +21673,9 @@ async function createLocalScreenTracks(options) {
21348
21673
  height: options.resolution.height
21349
21674
  };
21350
21675
  }
21676
+ if (navigator.mediaDevices.getDisplayMedia === undefined) {
21677
+ throw new DeviceUnsupportedError('getDisplayMedia not supported');
21678
+ }
21351
21679
  // typescript definition is missing getDisplayMedia: https://github.com/microsoft/TypeScript/issues/33232
21352
21680
  // @ts-ignore
21353
21681
  const stream = await navigator.mediaDevices.getDisplayMedia({
@@ -21715,5 +22043,5 @@ class ConnectionCheck extends eventsExports {
21715
22043
  }
21716
22044
  }
21717
22045
 
21718
- export { AudioPresets, ConnectionCheck, ConnectionError, ConnectionQuality, ConnectionState, DataPacket_Kind, DefaultReconnectPolicy, DisconnectReason, EngineEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, MediaDeviceFailure, NegotiationError, Participant, ParticipantEvent, PublishDataError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RoomState, ScreenSharePresets, Track, TrackEvent, TrackInvalidError, TrackPublication, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, createAudioAnalyser, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, detachTrack, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, isBackupCodec, isBrowserSupported, protocolVersion, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, version };
22046
+ export { AudioPresets, ConnectionCheck, ConnectionError, ConnectionQuality, ConnectionState, CriticalTimers, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EngineEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, MediaDeviceFailure, NegotiationError, Participant, ParticipantEvent, PublishDataError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RoomState, ScreenSharePresets, Track, TrackEvent, TrackInvalidError, TrackPublication, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, createAudioAnalyser, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, detachTrack, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, isBackupCodec, isBrowserSupported, protocolVersion, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, version };
21719
22047
  //# sourceMappingURL=livekit-client.esm.mjs.map