livekit-client 1.6.1 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/dist/livekit-client.esm.mjs +321 -105
  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/index.d.ts +2 -1
  8. package/dist/src/index.d.ts.map +1 -1
  9. package/dist/src/proto/livekit_models.d.ts +43 -1
  10. package/dist/src/proto/livekit_models.d.ts.map +1 -1
  11. package/dist/src/proto/livekit_rtc.d.ts +473 -4
  12. package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
  13. package/dist/src/room/PCTransport.d.ts +1 -0
  14. package/dist/src/room/PCTransport.d.ts.map +1 -1
  15. package/dist/src/room/RTCEngine.d.ts +2 -0
  16. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  17. package/dist/src/room/Room.d.ts +1 -1
  18. package/dist/src/room/Room.d.ts.map +1 -1
  19. package/dist/src/room/timers.d.ts +13 -0
  20. package/dist/src/room/timers.d.ts.map +1 -0
  21. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  22. package/dist/src/room/types.d.ts +1 -0
  23. package/dist/src/room/types.d.ts.map +1 -1
  24. package/dist/ts4.2/src/api/SignalClient.d.ts +3 -3
  25. package/dist/ts4.2/src/index.d.ts +2 -1
  26. package/dist/ts4.2/src/proto/livekit_models.d.ts +45 -1
  27. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +514 -3
  28. package/dist/ts4.2/src/room/PCTransport.d.ts +1 -0
  29. package/dist/ts4.2/src/room/RTCEngine.d.ts +2 -0
  30. package/dist/ts4.2/src/room/Room.d.ts +1 -1
  31. package/dist/ts4.2/src/room/timers.d.ts +13 -0
  32. package/dist/ts4.2/src/room/types.d.ts +1 -0
  33. package/package.json +1 -1
  34. package/src/api/SignalClient.ts +28 -20
  35. package/src/index.ts +2 -0
  36. package/src/proto/livekit_models.ts +116 -1
  37. package/src/proto/livekit_rtc.ts +106 -2
  38. package/src/room/PCTransport.ts +22 -6
  39. package/src/room/RTCEngine.ts +56 -43
  40. package/src/room/Room.ts +19 -11
  41. package/src/room/timers.ts +16 -0
  42. package/src/room/track/RemoteVideoTrack.ts +2 -1
  43. package/src/room/types.ts +1 -0
@@ -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";
@@ -4989,7 +5026,10 @@ function createBaseTrackInfo() {
4989
5026
  layers: [],
4990
5027
  mimeType: "",
4991
5028
  mid: "",
4992
- codecs: []
5029
+ codecs: [],
5030
+ stereo: false,
5031
+ disableRed: false,
5032
+ encryption: 0
4993
5033
  };
4994
5034
  }
4995
5035
  const TrackInfo = {
@@ -5034,6 +5074,15 @@ const TrackInfo = {
5034
5074
  for (const v of message.codecs) {
5035
5075
  SimulcastCodecInfo.encode(v, writer.uint32(106).fork()).ldelim();
5036
5076
  }
5077
+ if (message.stereo === true) {
5078
+ writer.uint32(112).bool(message.stereo);
5079
+ }
5080
+ if (message.disableRed === true) {
5081
+ writer.uint32(120).bool(message.disableRed);
5082
+ }
5083
+ if (message.encryption !== 0) {
5084
+ writer.uint32(128).int32(message.encryption);
5085
+ }
5037
5086
  return writer;
5038
5087
  },
5039
5088
  decode(input, length) {
@@ -5082,6 +5131,15 @@ const TrackInfo = {
5082
5131
  case 13:
5083
5132
  message.codecs.push(SimulcastCodecInfo.decode(reader, reader.uint32()));
5084
5133
  break;
5134
+ case 14:
5135
+ message.stereo = reader.bool();
5136
+ break;
5137
+ case 15:
5138
+ message.disableRed = reader.bool();
5139
+ break;
5140
+ case 16:
5141
+ message.encryption = reader.int32();
5142
+ break;
5085
5143
  default:
5086
5144
  reader.skipType(tag & 7);
5087
5145
  break;
@@ -5103,7 +5161,10 @@ const TrackInfo = {
5103
5161
  layers: Array.isArray(object === null || object === void 0 ? void 0 : object.layers) ? object.layers.map(e => VideoLayer.fromJSON(e)) : [],
5104
5162
  mimeType: isSet$1(object.mimeType) ? String(object.mimeType) : "",
5105
5163
  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)) : []
5164
+ codecs: Array.isArray(object === null || object === void 0 ? void 0 : object.codecs) ? object.codecs.map(e => SimulcastCodecInfo.fromJSON(e)) : [],
5165
+ stereo: isSet$1(object.stereo) ? Boolean(object.stereo) : false,
5166
+ disableRed: isSet$1(object.disableRed) ? Boolean(object.disableRed) : false,
5167
+ encryption: isSet$1(object.encryption) ? encryption_TypeFromJSON(object.encryption) : 0
5107
5168
  };
5108
5169
  },
5109
5170
  toJSON(message) {
@@ -5129,10 +5190,13 @@ const TrackInfo = {
5129
5190
  } else {
5130
5191
  obj.codecs = [];
5131
5192
  }
5193
+ message.stereo !== undefined && (obj.stereo = message.stereo);
5194
+ message.disableRed !== undefined && (obj.disableRed = message.disableRed);
5195
+ message.encryption !== undefined && (obj.encryption = encryption_TypeToJSON(message.encryption));
5132
5196
  return obj;
5133
5197
  },
5134
5198
  fromPartial(object) {
5135
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
5199
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5136
5200
  const message = createBaseTrackInfo();
5137
5201
  message.sid = (_a = object.sid) !== null && _a !== void 0 ? _a : "";
5138
5202
  message.type = (_b = object.type) !== null && _b !== void 0 ? _b : 0;
@@ -5147,6 +5211,9 @@ const TrackInfo = {
5147
5211
  message.mimeType = (_l = object.mimeType) !== null && _l !== void 0 ? _l : "";
5148
5212
  message.mid = (_m = object.mid) !== null && _m !== void 0 ? _m : "";
5149
5213
  message.codecs = ((_o = object.codecs) === null || _o === void 0 ? void 0 : _o.map(e => SimulcastCodecInfo.fromPartial(e))) || [];
5214
+ message.stereo = (_p = object.stereo) !== null && _p !== void 0 ? _p : false;
5215
+ message.disableRed = (_q = object.disableRed) !== null && _q !== void 0 ? _q : false;
5216
+ message.encryption = (_r = object.encryption) !== null && _r !== void 0 ? _r : 0;
5150
5217
  return message;
5151
5218
  }
5152
5219
  };
@@ -9615,7 +9682,7 @@ function createBaseSignalResponse() {
9615
9682
  const SignalResponse = {
9616
9683
  encode(message) {
9617
9684
  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;
9685
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
9619
9686
  if (((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "join") {
9620
9687
  JoinResponse.encode(message.message.join, writer.uint32(10).fork()).ldelim();
9621
9688
  }
@@ -9667,6 +9734,9 @@ const SignalResponse = {
9667
9734
  if (((_s = message.message) === null || _s === void 0 ? void 0 : _s.$case) === "pong") {
9668
9735
  writer.uint32(144).int64(message.message.pong);
9669
9736
  }
9737
+ if (((_t = message.message) === null || _t === void 0 ? void 0 : _t.$case) === "reconnect") {
9738
+ ReconnectResponse.encode(message.message.reconnect, writer.uint32(154).fork()).ldelim();
9739
+ }
9670
9740
  return writer;
9671
9741
  },
9672
9742
  decode(input, length) {
@@ -9778,6 +9848,12 @@ const SignalResponse = {
9778
9848
  pong: longToNumber(reader.int64())
9779
9849
  };
9780
9850
  break;
9851
+ case 19:
9852
+ message.message = {
9853
+ $case: "reconnect",
9854
+ reconnect: ReconnectResponse.decode(reader, reader.uint32())
9855
+ };
9856
+ break;
9781
9857
  default:
9782
9858
  reader.skipType(tag & 7);
9783
9859
  break;
@@ -9838,11 +9914,14 @@ const SignalResponse = {
9838
9914
  } : isSet(object.pong) ? {
9839
9915
  $case: "pong",
9840
9916
  pong: Number(object.pong)
9917
+ } : isSet(object.reconnect) ? {
9918
+ $case: "reconnect",
9919
+ reconnect: ReconnectResponse.fromJSON(object.reconnect)
9841
9920
  } : undefined
9842
9921
  };
9843
9922
  },
9844
9923
  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;
9924
+ 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
9925
  const obj = {};
9847
9926
  ((_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
9927
  ((_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 +9940,11 @@ const SignalResponse = {
9861
9940
  ((_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
9941
  ((_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
9942
  ((_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));
9943
+ ((_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
9944
  return obj;
9865
9945
  },
9866
9946
  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;
9947
+ 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
9948
  const message = createBaseSignalResponse();
9869
9949
  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
9950
  message.message = {
@@ -9968,6 +10048,12 @@ const SignalResponse = {
9968
10048
  pong: object.message.pong
9969
10049
  };
9970
10050
  }
10051
+ 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) {
10052
+ message.message = {
10053
+ $case: "reconnect",
10054
+ reconnect: ReconnectResponse.fromPartial(object.message.reconnect)
10055
+ };
10056
+ }
9971
10057
  return message;
9972
10058
  }
9973
10059
  };
@@ -10052,7 +10138,8 @@ function createBaseAddTrackRequest() {
10052
10138
  simulcastCodecs: [],
10053
10139
  sid: "",
10054
10140
  stereo: false,
10055
- disableRed: false
10141
+ disableRed: false,
10142
+ encryption: 0
10056
10143
  };
10057
10144
  }
10058
10145
  const AddTrackRequest = {
@@ -10097,6 +10184,9 @@ const AddTrackRequest = {
10097
10184
  if (message.disableRed === true) {
10098
10185
  writer.uint32(104).bool(message.disableRed);
10099
10186
  }
10187
+ if (message.encryption !== 0) {
10188
+ writer.uint32(112).int32(message.encryption);
10189
+ }
10100
10190
  return writer;
10101
10191
  },
10102
10192
  decode(input, length) {
@@ -10145,6 +10235,9 @@ const AddTrackRequest = {
10145
10235
  case 13:
10146
10236
  message.disableRed = reader.bool();
10147
10237
  break;
10238
+ case 14:
10239
+ message.encryption = reader.int32();
10240
+ break;
10148
10241
  default:
10149
10242
  reader.skipType(tag & 7);
10150
10243
  break;
@@ -10166,7 +10259,8 @@ const AddTrackRequest = {
10166
10259
  simulcastCodecs: Array.isArray(object === null || object === void 0 ? void 0 : object.simulcastCodecs) ? object.simulcastCodecs.map(e => SimulcastCodec.fromJSON(e)) : [],
10167
10260
  sid: isSet(object.sid) ? String(object.sid) : "",
10168
10261
  stereo: isSet(object.stereo) ? Boolean(object.stereo) : false,
10169
- disableRed: isSet(object.disableRed) ? Boolean(object.disableRed) : false
10262
+ disableRed: isSet(object.disableRed) ? Boolean(object.disableRed) : false,
10263
+ encryption: isSet(object.encryption) ? encryption_TypeFromJSON(object.encryption) : 0
10170
10264
  };
10171
10265
  },
10172
10266
  toJSON(message) {
@@ -10192,10 +10286,11 @@ const AddTrackRequest = {
10192
10286
  message.sid !== undefined && (obj.sid = message.sid);
10193
10287
  message.stereo !== undefined && (obj.stereo = message.stereo);
10194
10288
  message.disableRed !== undefined && (obj.disableRed = message.disableRed);
10289
+ message.encryption !== undefined && (obj.encryption = encryption_TypeToJSON(message.encryption));
10195
10290
  return obj;
10196
10291
  },
10197
10292
  fromPartial(object) {
10198
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
10293
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
10199
10294
  const message = createBaseAddTrackRequest();
10200
10295
  message.cid = (_a = object.cid) !== null && _a !== void 0 ? _a : "";
10201
10296
  message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
@@ -10210,6 +10305,7 @@ const AddTrackRequest = {
10210
10305
  message.sid = (_l = object.sid) !== null && _l !== void 0 ? _l : "";
10211
10306
  message.stereo = (_m = object.stereo) !== null && _m !== void 0 ? _m : false;
10212
10307
  message.disableRed = (_o = object.disableRed) !== null && _o !== void 0 ? _o : false;
10308
+ message.encryption = (_p = object.encryption) !== null && _p !== void 0 ? _p : 0;
10213
10309
  return message;
10214
10310
  }
10215
10311
  };
@@ -10492,6 +10588,67 @@ const JoinResponse = {
10492
10588
  return message;
10493
10589
  }
10494
10590
  };
10591
+ function createBaseReconnectResponse() {
10592
+ return {
10593
+ iceServers: [],
10594
+ clientConfiguration: undefined
10595
+ };
10596
+ }
10597
+ const ReconnectResponse = {
10598
+ encode(message) {
10599
+ let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
10600
+ for (const v of message.iceServers) {
10601
+ ICEServer.encode(v, writer.uint32(10).fork()).ldelim();
10602
+ }
10603
+ if (message.clientConfiguration !== undefined) {
10604
+ ClientConfiguration.encode(message.clientConfiguration, writer.uint32(18).fork()).ldelim();
10605
+ }
10606
+ return writer;
10607
+ },
10608
+ decode(input, length) {
10609
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
10610
+ let end = length === undefined ? reader.len : reader.pos + length;
10611
+ const message = createBaseReconnectResponse();
10612
+ while (reader.pos < end) {
10613
+ const tag = reader.uint32();
10614
+ switch (tag >>> 3) {
10615
+ case 1:
10616
+ message.iceServers.push(ICEServer.decode(reader, reader.uint32()));
10617
+ break;
10618
+ case 2:
10619
+ message.clientConfiguration = ClientConfiguration.decode(reader, reader.uint32());
10620
+ break;
10621
+ default:
10622
+ reader.skipType(tag & 7);
10623
+ break;
10624
+ }
10625
+ }
10626
+ return message;
10627
+ },
10628
+ fromJSON(object) {
10629
+ return {
10630
+ iceServers: Array.isArray(object === null || object === void 0 ? void 0 : object.iceServers) ? object.iceServers.map(e => ICEServer.fromJSON(e)) : [],
10631
+ clientConfiguration: isSet(object.clientConfiguration) ? ClientConfiguration.fromJSON(object.clientConfiguration) : undefined
10632
+ };
10633
+ },
10634
+ toJSON(message) {
10635
+ const obj = {};
10636
+ if (message.iceServers) {
10637
+ obj.iceServers = message.iceServers.map(e => e ? ICEServer.toJSON(e) : undefined);
10638
+ } else {
10639
+ obj.iceServers = [];
10640
+ }
10641
+ message.clientConfiguration !== undefined && (obj.clientConfiguration = message.clientConfiguration ? ClientConfiguration.toJSON(message.clientConfiguration) : undefined);
10642
+ return obj;
10643
+ },
10644
+ fromPartial(object) {
10645
+ var _a;
10646
+ const message = createBaseReconnectResponse();
10647
+ message.iceServers = ((_a = object.iceServers) === null || _a === void 0 ? void 0 : _a.map(e => ICEServer.fromPartial(e))) || [];
10648
+ message.clientConfiguration = object.clientConfiguration !== undefined && object.clientConfiguration !== null ? ClientConfiguration.fromPartial(object.clientConfiguration) : undefined;
10649
+ return message;
10650
+ }
10651
+ };
10495
10652
  function createBaseTrackPublishedResponse() {
10496
10653
  return {
10497
10654
  cid: "",
@@ -12657,7 +12814,7 @@ var uaParser = {
12657
12814
 
12658
12815
  (function (module, exports) {
12659
12816
  /////////////////////////////////////////////////////////////////////////////////
12660
- /* UAParser.js v1.0.2
12817
+ /* UAParser.js v1.0.33
12661
12818
  Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
12662
12819
  MIT License */ /*
12663
12820
  Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
@@ -12671,7 +12828,7 @@ var uaParser = {
12671
12828
  //////////////
12672
12829
  // Constants
12673
12830
  /////////////
12674
- var LIBVERSION = '1.0.2',
12831
+ var LIBVERSION = '1.0.33',
12675
12832
  EMPTY = '',
12676
12833
  UNKNOWN = '?',
12677
12834
  FUNC_TYPE = 'function',
@@ -12691,7 +12848,7 @@ var uaParser = {
12691
12848
  SMARTTV = 'smarttv',
12692
12849
  WEARABLE = 'wearable',
12693
12850
  EMBEDDED = 'embedded',
12694
- UA_MAX_LENGTH = 255;
12851
+ UA_MAX_LENGTH = 350;
12695
12852
  var AMAZON = 'Amazon',
12696
12853
  APPLE = 'Apple',
12697
12854
  ASUS = 'ASUS',
@@ -12707,6 +12864,7 @@ var uaParser = {
12707
12864
  MOTOROLA = 'Motorola',
12708
12865
  OPERA = 'Opera',
12709
12866
  SAMSUNG = 'Samsung',
12867
+ SHARP = 'Sharp',
12710
12868
  SONY = 'Sony',
12711
12869
  XIAOMI = 'Xiaomi',
12712
12870
  ZEBRA = 'Zebra',
@@ -12745,7 +12903,7 @@ var uaParser = {
12745
12903
  },
12746
12904
  trim = function (str, len) {
12747
12905
  if (typeof str === STR_TYPE) {
12748
- str = str.replace(/^\s\s*/, EMPTY).replace(/\s\s*$/, EMPTY);
12906
+ str = str.replace(/^\s\s*/, EMPTY);
12749
12907
  return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
12750
12908
  }
12751
12909
  };
@@ -12884,12 +13042,13 @@ var uaParser = {
12884
13042
  // Internet Explorer
12885
13043
 
12886
13044
  // 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,
13045
+ /(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
13046
  // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
12889
13047
  /(weibo)__([\d\.]+)/i // Weibo
12890
13048
  ], [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
13049
+ ], [VERSION, [NAME, 'UC' + BROWSER]], [/microm.+\bqbcore\/([\w\.]+)/i,
13050
+ // WeChat Desktop for Windows Built-in Browser
13051
+ /\bqbcore\/([\w\.]+).+microm/i], [VERSION, [NAME, 'WeChat(Win) Desktop']], [/micromessenger\/([\w\.]+)/i // WeChat
12893
13052
  ], [VERSION, [NAME, 'WeChat']], [/konqueror\/([\w\.]+)/i // Konqueror
12894
13053
  ], [VERSION, [NAME, 'Konqueror']], [/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11
12895
13054
  ], [VERSION, [NAME, 'IE']], [/yabrowser\/([\w\.]+)/i // Yandex
@@ -12902,8 +13061,8 @@ var uaParser = {
12902
13061
  ], [VERSION, [NAME, OPERA + ' Coast']], [/miuibrowser\/([\w\.]+)/i // MIUI Browser
12903
13062
  ], [VERSION, [NAME, 'MIUI ' + BROWSER]], [/fxios\/([-\w\.]+)/i // Firefox for iOS
12904
13063
  ], [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
13064
+ ], [[NAME, '360 ' + BROWSER]], [/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i], [[NAME, /(.+)/, '$1 ' + BROWSER], VERSION], [
13065
+ // Oculus/Samsung/Sailfish/Huawei Browser
12907
13066
  /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
12908
13067
  ], [[NAME, /_/g, ' '], VERSION], [/(electron)\/([\w\.]+) safari/i,
12909
13068
  // Electron-based App
@@ -12912,7 +13071,9 @@ var uaParser = {
12912
13071
  /m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i // QQBrowser/Baidu App/2345 Browser
12913
13072
  ], [NAME, VERSION], [/(metasr)[\/ ]?([\w\.]+)/i,
12914
13073
  // SouGouBrowser
12915
- /(lbbrowser)/i // LieBao Browser
13074
+ /(lbbrowser)/i,
13075
+ // LieBao Browser
13076
+ /\[(linkedin)app\]/i // LinkedIn App for iOS & Android
12916
13077
  ], [NAME], [
12917
13078
  // WebView
12918
13079
  /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
@@ -12926,8 +13087,8 @@ var uaParser = {
12926
13087
  ], [VERSION, [NAME, CHROME + ' Headless']], [/ wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView
12927
13088
  ], [[NAME, CHROME + ' WebView'], VERSION], [/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser
12928
13089
  ], [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
13090
+ ], [NAME, VERSION], [/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i // Mobile Safari
13091
+ ], [VERSION, [NAME, 'Mobile Safari']], [/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile
12931
13092
  ], [VERSION, NAME], [/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
12932
13093
  ], [NAME, [VERSION, strMapper, oldSafariMap]], [/(webkit|khtml)\/([\w\.]+)/i], [NAME, VERSION], [
12933
13094
  // Gecko based
@@ -12950,7 +13111,8 @@ var uaParser = {
12950
13111
  /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
12951
13112
  // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
12952
13113
  /(links) \(([\w\.]+)/i // Links
12953
- ], [NAME, VERSION]],
13114
+ ], [NAME, VERSION], [/(cobalt)\/([\w\.]+)/i // Cobalt
13115
+ ], [NAME, [VERSION, /master.|lts./, ""]]],
12954
13116
  cpu: [[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i // AMD64 (x64)
12955
13117
  ], [[ARCHITECTURE, 'amd64']], [/(ia32(?=;))/i // IA32 (quicktime)
12956
13118
  ], [[ARCHITECTURE, lowerize]], [/((?:i[346]|x)86)[;\)]/i // IA32 (x86)
@@ -12970,14 +13132,14 @@ var uaParser = {
12970
13132
  /////////////////////////
12971
13133
 
12972
13134
  // 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]], [
13135
+ /\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
13136
  // Apple
12975
13137
  /\((ip(?:hone|od)[\w ]*);/i // iPod/iPhone
12976
13138
  ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [/\((ipad);[-\w\),; ]+apple/i,
12977
13139
  // iPad
12978
- /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
13140
+ /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [/(macintosh);/i], [MODEL, [VENDOR, APPLE]], [
12979
13141
  // 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]], [
13142
+ /\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
13143
  // Xiaomi
12982
13144
  /\b(poco[\w ]+)(?: bui|\))/i,
12983
13145
  // Xiaomi POCO
@@ -12987,7 +13149,7 @@ var uaParser = {
12987
13149
  // Xiaomi Hongmi
12988
13150
  /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,
12989
13151
  // Xiaomi Redmi
12990
- /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
13152
+ /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
12991
13153
  ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets
12992
13154
  ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [
12993
13155
  // OPPO
@@ -13009,7 +13171,7 @@ var uaParser = {
13009
13171
  ], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel
13010
13172
  ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
13011
13173
  // 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]], [
13174
+ /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
13175
  // OnePlus
13014
13176
  / (kb2005|in20[12]5|be20[12][59])\b/i, /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [
13015
13177
  // Amazon
@@ -13030,14 +13192,14 @@ var uaParser = {
13030
13192
  // HTC
13031
13193
 
13032
13194
  // ZTE
13033
- /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
13195
+ /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
13034
13196
  ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
13035
13197
  // Acer
13036
13198
  /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
13037
13199
  // Meizu
13038
13200
  /droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [
13039
13201
  // Sharp
13040
- /\b(sh-?[altvz]?\d\d[a-ekm]?)/i], [MODEL, [VENDOR, 'Sharp'], [TYPE, MOBILE]], [
13202
+ /\b(sh-?[altvz]?\d\d[a-ekm]?)/i], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [
13041
13203
  // MIXED
13042
13204
  /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,
13043
13205
  // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
@@ -13116,8 +13278,10 @@ var uaParser = {
13116
13278
  ], [[VENDOR, LG], [TYPE, SMARTTV]], [/(apple) ?tv/i // Apple TV
13117
13279
  ], [VENDOR, [MODEL, APPLE + ' TV'], [TYPE, SMARTTV]], [/crkey/i // Google Chromecast
13118
13280
  ], [[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,
13281
+ ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [/\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i // Sharp
13282
+ ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]], [/(bravia[\w ]+)( bui|\))/i // Sony
13283
+ ], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [/(mitv-\w{5}) bui/i // Xiaomi
13284
+ ], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
13121
13285
  // Roku
13122
13286
  /hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i // HbbTV devices
13123
13287
  ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i // SmartTV from Unidentified Vendors
@@ -13143,7 +13307,7 @@ var uaParser = {
13143
13307
  /droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors
13144
13308
  ], [MODEL, [TYPE, MOBILE]], [/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors
13145
13309
  ], [MODEL, [TYPE, TABLET]], [/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
13146
- ], [[TYPE, TABLET]], [/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
13310
+ ], [[TYPE, TABLET]], [/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
13147
13311
  ], [[TYPE, MOBILE]], [/(android[-\w\. ]{0,9});.+buil/i // Generic Android Device
13148
13312
  ], [MODEL, [VENDOR, 'Generic']]],
13149
13313
  engine: [[/windows.+ edge\/([\w\.]+)/i // EdgeHTML
@@ -13173,7 +13337,7 @@ var uaParser = {
13173
13337
  /cfnetwork\/.+darwin/i], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [/(mac os x) ?([\w\. ]*)/i, /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
13174
13338
  ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [
13175
13339
  // Mobile OSes
13176
- /droid ([\w\.]+)\b.+(android[- ]x86)/i // Android-x86
13340
+ /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
13177
13341
  ], [VERSION, NAME], [
13178
13342
  // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
13179
13343
  /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i, /(blackberry)\w*\/([\w\.]*)/i,
@@ -13336,7 +13500,7 @@ var uaParser = {
13336
13500
  })(uaParser, uaParserExports);
13337
13501
  var UAParser = uaParserExports;
13338
13502
 
13339
- var version$1 = "1.6.1";
13503
+ var version$1 = "1.6.3";
13340
13504
 
13341
13505
  const version = version$1;
13342
13506
  const protocolVersion = 8;
@@ -15603,6 +15767,27 @@ function r(r, e, n) {
15603
15767
  }, d;
15604
15768
  }
15605
15769
 
15770
+ /**
15771
+ * Timers that can be overridden with platform specific implementations
15772
+ * that ensure that they are fired. These should be used when it is critical
15773
+ * that the timer fires on time.
15774
+ */
15775
+ class CriticalTimers {}
15776
+ // eslint-disable-next-line @typescript-eslint/no-implied-eval
15777
+ CriticalTimers.setTimeout = function () {
15778
+ return setTimeout(...arguments);
15779
+ };
15780
+ // eslint-disable-next-line @typescript-eslint/no-implied-eval
15781
+ CriticalTimers.setInterval = function () {
15782
+ return setInterval(...arguments);
15783
+ };
15784
+ CriticalTimers.clearTimeout = function () {
15785
+ return clearTimeout(...arguments);
15786
+ };
15787
+ CriticalTimers.clearInterval = function () {
15788
+ return clearInterval(...arguments);
15789
+ };
15790
+
15606
15791
  const REACTION_DELAY = 100;
15607
15792
  class RemoteVideoTrack extends RemoteTrack {
15608
15793
  constructor(mediaTrack, sid, receiver, adaptiveStreamSettings) {
@@ -15774,7 +15959,7 @@ class RemoteVideoTrack extends RemoteTrack {
15774
15959
  }
15775
15960
  if (!isVisible && Date.now() - lastVisibilityChange < REACTION_DELAY) {
15776
15961
  // delay hidden events
15777
- setTimeout(() => {
15962
+ CriticalTimers.setTimeout(() => {
15778
15963
  this.updateVisibility();
15779
15964
  }, REACTION_DELAY);
15780
15965
  return;
@@ -17904,10 +18089,11 @@ class SignalClient {
17904
18089
  this.isReconnecting = true;
17905
18090
  // clear ping interval and restart it once reconnected
17906
18091
  this.clearPingInterval();
17907
- await this.connect(url, token, _objectSpread2(_objectSpread2({}, this.options), {}, {
18092
+ const res = await this.connect(url, token, _objectSpread2(_objectSpread2({}, this.options), {}, {
17908
18093
  reconnect: true,
17909
18094
  sid
17910
18095
  }));
18096
+ return res;
17911
18097
  }
17912
18098
  connect(url, token, opts, abortSignal) {
17913
18099
  this.connectOptions = opts;
@@ -17953,17 +18139,8 @@ class SignalClient {
17953
18139
  // other errors, handle
17954
18140
  this.handleWSError(ev);
17955
18141
  };
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
18142
  this.ws.onmessage = async ev => {
17966
- var _a, _b;
18143
+ var _a, _b, _c, _d;
17967
18144
  // not considered connected until JoinResponse is received
17968
18145
  let resp;
17969
18146
  if (typeof ev.data === 'string') {
@@ -17976,6 +18153,7 @@ class SignalClient {
17976
18153
  return;
17977
18154
  }
17978
18155
  if (!this.isConnected) {
18156
+ let shouldProcessMessage = false;
17979
18157
  // handle join message only
17980
18158
  if (((_a = resp.message) === null || _a === void 0 ? void 0 : _a.$case) === 'join') {
17981
18159
  this.isConnected = true;
@@ -17990,10 +18168,24 @@ class SignalClient {
17990
18168
  this.startPingInterval();
17991
18169
  }
17992
18170
  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")));
18171
+ } else if (opts.reconnect) {
18172
+ // in reconnecting, any message received means signal reconnected
18173
+ this.isConnected = true;
18174
+ abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener('abort', abortHandler);
18175
+ this.startPingInterval();
18176
+ if (((_b = resp.message) === null || _b === void 0 ? void 0 : _b.$case) === 'reconnect') {
18177
+ resolve((_c = resp.message) === null || _c === void 0 ? void 0 : _c.reconnect);
18178
+ } else {
18179
+ resolve();
18180
+ shouldProcessMessage = true;
18181
+ }
18182
+ } else if (!opts.reconnect) {
18183
+ // non-reconnect case, should receive join response first
18184
+ reject(new ConnectionError("did not receive join response, got ".concat((_d = resp.message) === null || _d === void 0 ? void 0 : _d.$case, " instead")));
18185
+ }
18186
+ if (!shouldProcessMessage) {
18187
+ return;
17995
18188
  }
17996
- return;
17997
18189
  }
17998
18190
  if (this.signalLatency) {
17999
18191
  await sleep(this.signalLatency);
@@ -18262,7 +18454,7 @@ class SignalClient {
18262
18454
  livekitLogger.warn('ping timeout duration not set');
18263
18455
  return;
18264
18456
  }
18265
- this.pingTimeout = setTimeout(() => {
18457
+ this.pingTimeout = CriticalTimers.setTimeout(() => {
18266
18458
  livekitLogger.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now() - this.pingTimeoutDuration * 1000).toUTCString()));
18267
18459
  if (this.onClose) {
18268
18460
  this.onClose('ping timeout');
@@ -18271,7 +18463,7 @@ class SignalClient {
18271
18463
  }
18272
18464
  clearPingTimeout() {
18273
18465
  if (this.pingTimeout) {
18274
- clearTimeout(this.pingTimeout);
18466
+ CriticalTimers.clearTimeout(this.pingTimeout);
18275
18467
  }
18276
18468
  }
18277
18469
  startPingInterval() {
@@ -18282,7 +18474,7 @@ class SignalClient {
18282
18474
  return;
18283
18475
  }
18284
18476
  livekitLogger.debug('start ping interval');
18285
- this.pingInterval = setInterval(() => {
18477
+ this.pingInterval = CriticalTimers.setInterval(() => {
18286
18478
  this.sendPing();
18287
18479
  }, this.pingIntervalDuration * 1000);
18288
18480
  }
@@ -18290,7 +18482,7 @@ class SignalClient {
18290
18482
  livekitLogger.debug('clearing ping interval');
18291
18483
  this.clearPingTimeout();
18292
18484
  if (this.pingInterval) {
18293
- clearInterval(this.pingInterval);
18485
+ CriticalTimers.clearInterval(this.pingInterval);
18294
18486
  }
18295
18487
  }
18296
18488
  }
@@ -19083,6 +19275,7 @@ class PCTransport extends eventsExports {
19083
19275
  this.renegotiate = false;
19084
19276
  this.trackBitrates = [];
19085
19277
  this.remoteStereoMids = [];
19278
+ this.remoteNackMids = [];
19086
19279
  // debounced negotiate interface
19087
19280
  this.negotiate = r(onError => {
19088
19281
  this.emit(PCEvents.NegotiationStarted);
@@ -19109,7 +19302,12 @@ class PCTransport extends eventsExports {
19109
19302
  }
19110
19303
  async setRemoteDescription(sd) {
19111
19304
  if (sd.type === 'offer') {
19112
- this.remoteStereoMids = extractStereoTracksFromOffer(sd);
19305
+ let {
19306
+ stereoMids,
19307
+ nackMids
19308
+ } = extractStereoAndNackAudioFromOffer(sd);
19309
+ this.remoteStereoMids = stereoMids;
19310
+ this.remoteNackMids = nackMids;
19113
19311
  }
19114
19312
  await this.pc.setRemoteDescription(sd);
19115
19313
  this.pendingCandidates.forEach(candidate => {
@@ -19155,7 +19353,7 @@ class PCTransport extends eventsExports {
19155
19353
  const sdpParsed = parse((_a = offer.sdp) !== null && _a !== void 0 ? _a : '');
19156
19354
  sdpParsed.media.forEach(media => {
19157
19355
  if (media.type === 'audio') {
19158
- ensureAudioNackAndStereo(media, []);
19356
+ ensureAudioNackAndStereo(media, [], []);
19159
19357
  } else if (media.type === 'video') {
19160
19358
  // mung sdp for codec bitrate setting that can't apply by sendEncoding
19161
19359
  this.trackBitrates.some(trackbr => {
@@ -19201,7 +19399,7 @@ class PCTransport extends eventsExports {
19201
19399
  const sdpParsed = parse((_a = answer.sdp) !== null && _a !== void 0 ? _a : '');
19202
19400
  sdpParsed.media.forEach(media => {
19203
19401
  if (media.type === 'audio') {
19204
- ensureAudioNackAndStereo(media, this.remoteStereoMids);
19402
+ ensureAudioNackAndStereo(media, this.remoteStereoMids, this.remoteNackMids);
19205
19403
  }
19206
19404
  });
19207
19405
  await this.setMungedLocalDescription(answer, write(sdpParsed));
@@ -19245,7 +19443,7 @@ class PCTransport extends eventsExports {
19245
19443
  }
19246
19444
  }
19247
19445
  }
19248
- function ensureAudioNackAndStereo(media, stereoMids) {
19446
+ function ensureAudioNackAndStereo(media, stereoMids, nackMids) {
19249
19447
  // found opus codec to add nack fb
19250
19448
  let opusPayload = 0;
19251
19449
  media.rtp.some(rtp => {
@@ -19260,7 +19458,7 @@ function ensureAudioNackAndStereo(media, stereoMids) {
19260
19458
  if (!media.rtcpFb) {
19261
19459
  media.rtcpFb = [];
19262
19460
  }
19263
- if (!media.rtcpFb.some(fb => fb.payload === opusPayload && fb.type === 'nack')) {
19461
+ if (nackMids.includes(media.mid) && !media.rtcpFb.some(fb => fb.payload === opusPayload && fb.type === 'nack')) {
19264
19462
  media.rtcpFb.push({
19265
19463
  payload: opusPayload,
19266
19464
  type: 'nack'
@@ -19279,12 +19477,14 @@ function ensureAudioNackAndStereo(media, stereoMids) {
19279
19477
  }
19280
19478
  }
19281
19479
  }
19282
- function extractStereoTracksFromOffer(offer) {
19480
+ function extractStereoAndNackAudioFromOffer(offer) {
19283
19481
  var _a;
19284
19482
  const stereoMids = [];
19483
+ const nackMids = [];
19285
19484
  const sdpParsed = parse((_a = offer.sdp) !== null && _a !== void 0 ? _a : '');
19286
19485
  let opusPayload = 0;
19287
19486
  sdpParsed.media.forEach(media => {
19487
+ var _a;
19288
19488
  if (media.type === 'audio') {
19289
19489
  media.rtp.some(rtp => {
19290
19490
  if (rtp.codec === 'opus') {
@@ -19293,6 +19493,9 @@ function extractStereoTracksFromOffer(offer) {
19293
19493
  }
19294
19494
  return false;
19295
19495
  });
19496
+ if ((_a = media.rtcpFb) === null || _a === void 0 ? void 0 : _a.some(fb => fb.payload === opusPayload && fb.type === 'nack')) {
19497
+ nackMids.push(media.mid);
19498
+ }
19296
19499
  media.fmtp.some(fmtp => {
19297
19500
  if (fmtp.payload === opusPayload) {
19298
19501
  if (fmtp.config.includes('sprop-stereo=1')) {
@@ -19304,7 +19507,10 @@ function extractStereoTracksFromOffer(offer) {
19304
19507
  });
19305
19508
  }
19306
19509
  });
19307
- return stereoMids;
19510
+ return {
19511
+ stereoMids,
19512
+ nackMids
19513
+ };
19308
19514
  }
19309
19515
 
19310
19516
  const lossyDataChannel = '_lossy';
@@ -19426,17 +19632,13 @@ class RTCEngine extends eventsExports.EventEmitter {
19426
19632
  delay = 0;
19427
19633
  }
19428
19634
  livekitLogger.debug("reconnecting in ".concat(delay, "ms"));
19429
- if (_this.reconnectTimeout) {
19430
- clearTimeout(_this.reconnectTimeout);
19431
- }
19432
- _this.reconnectTimeout = setTimeout(() => _this.attemptReconnect(signalEvents), delay);
19635
+ _this.clearReconnectTimeout();
19636
+ _this.reconnectTimeout = CriticalTimers.setTimeout(() => _this.attemptReconnect(signalEvents), delay);
19433
19637
  };
19434
19638
  this.handleBrowserOnLine = () => {
19435
19639
  // in case the engine is currently reconnecting, attempt a reconnect immediately after the browser state has changed to 'onLine'
19436
19640
  if (this.client.isReconnecting) {
19437
- if (this.reconnectTimeout) {
19438
- clearTimeout(this.reconnectTimeout);
19439
- }
19641
+ this.clearReconnectTimeout();
19440
19642
  this.attemptReconnect(true);
19441
19643
  }
19442
19644
  };
@@ -19573,29 +19775,7 @@ class RTCEngine extends eventsExports.EventEmitter {
19573
19775
  return;
19574
19776
  }
19575
19777
  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';
19778
+ const rtcConfig = this.makeRTCConfiguration(joinResponse);
19599
19779
  this.publisher = new PCTransport(rtcConfig);
19600
19780
  this.subscriber = new PCTransport(rtcConfig);
19601
19781
  this.emit(EngineEvent.TransportsCreated, this.publisher, this.subscriber);
@@ -19727,6 +19907,32 @@ class RTCEngine extends eventsExports.EventEmitter {
19727
19907
  });
19728
19908
  };
19729
19909
  }
19910
+ makeRTCConfiguration(serverResponse) {
19911
+ const rtcConfig = _objectSpread2({}, this.rtcConfig);
19912
+ // update ICE servers before creating PeerConnection
19913
+ if (serverResponse.iceServers && !rtcConfig.iceServers) {
19914
+ const rtcIceServers = [];
19915
+ serverResponse.iceServers.forEach(iceServer => {
19916
+ const rtcIceServer = {
19917
+ urls: iceServer.urls
19918
+ };
19919
+ if (iceServer.username) rtcIceServer.username = iceServer.username;
19920
+ if (iceServer.credential) {
19921
+ rtcIceServer.credential = iceServer.credential;
19922
+ }
19923
+ rtcIceServers.push(rtcIceServer);
19924
+ });
19925
+ rtcConfig.iceServers = rtcIceServers;
19926
+ }
19927
+ if (serverResponse.clientConfiguration && serverResponse.clientConfiguration.forceRelay === ClientConfigSetting.ENABLED) {
19928
+ rtcConfig.iceTransportPolicy = 'relay';
19929
+ }
19930
+ // @ts-ignore
19931
+ rtcConfig.sdpSemantics = 'unified-plan';
19932
+ // @ts-ignore
19933
+ rtcConfig.continualGatheringPolicy = 'gather_continually';
19934
+ return rtcConfig;
19935
+ }
19730
19936
  createDataChannels() {
19731
19937
  if (!this.publisher) {
19732
19938
  return;
@@ -19881,11 +20087,8 @@ class RTCEngine extends eventsExports.EventEmitter {
19881
20087
  } else {
19882
20088
  await this.resumeConnection(signalEvents);
19883
20089
  }
19884
- this.reconnectAttempts = 0;
20090
+ this.clearPendingReconnect();
19885
20091
  this.fullReconnectOnNext = false;
19886
- if (this.reconnectTimeout) {
19887
- clearTimeout(this.reconnectTimeout);
19888
- }
19889
20092
  } catch (e) {
19890
20093
  this.reconnectAttempts += 1;
19891
20094
  let reconnectRequired = false;
@@ -19980,7 +20183,12 @@ class RTCEngine extends eventsExports.EventEmitter {
19980
20183
  this.emit(EngineEvent.Resuming);
19981
20184
  }
19982
20185
  try {
19983
- await this.client.reconnect(this.url, this.token, this.participantSid);
20186
+ const res = await this.client.reconnect(this.url, this.token, this.participantSid);
20187
+ if (res) {
20188
+ const rtcConfig = this.makeRTCConfiguration(res);
20189
+ this.publisher.pc.setConfiguration(rtcConfig);
20190
+ this.subscriber.pc.setConfiguration(rtcConfig);
20191
+ }
19984
20192
  } catch (e) {
19985
20193
  let message = '';
19986
20194
  if (e instanceof Error) {
@@ -20140,10 +20348,13 @@ class RTCEngine extends eventsExports.EventEmitter {
20140
20348
  }
20141
20349
  }
20142
20350
  }
20143
- clearPendingReconnect() {
20351
+ clearReconnectTimeout() {
20144
20352
  if (this.reconnectTimeout) {
20145
- clearTimeout(this.reconnectTimeout);
20353
+ CriticalTimers.clearTimeout(this.reconnectTimeout);
20146
20354
  }
20355
+ }
20356
+ clearPendingReconnect() {
20357
+ this.clearReconnectTimeout();
20147
20358
  this.reconnectAttempts = 0;
20148
20359
  }
20149
20360
  registerOnLineListener() {
@@ -20334,7 +20545,7 @@ class Room extends eventsExports.EventEmitter {
20334
20545
  return;
20335
20546
  }
20336
20547
  // don't return until ICE connected
20337
- const connectTimeout = setTimeout(() => {
20548
+ const connectTimeout = CriticalTimers.setTimeout(() => {
20338
20549
  // timeout
20339
20550
  this.recreateEngine();
20340
20551
  this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
@@ -20342,7 +20553,7 @@ class Room extends eventsExports.EventEmitter {
20342
20553
  }, this.connOptions.peerConnectionTimeout);
20343
20554
  const abortHandler = () => {
20344
20555
  livekitLogger.warn('closing engine');
20345
- clearTimeout(connectTimeout);
20556
+ CriticalTimers.clearTimeout(connectTimeout);
20346
20557
  this.recreateEngine();
20347
20558
  this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
20348
20559
  reject(new ConnectionError('room connection has been cancelled'));
@@ -20353,7 +20564,7 @@ class Room extends eventsExports.EventEmitter {
20353
20564
  (_b = this.abortController) === null || _b === void 0 ? void 0 : _b.signal.addEventListener('abort', abortHandler);
20354
20565
  this.engine.once(EngineEvent.Connected, () => {
20355
20566
  var _a, _b;
20356
- clearTimeout(connectTimeout);
20567
+ CriticalTimers.clearTimeout(connectTimeout);
20357
20568
  (_a = this.abortController) === null || _a === void 0 ? void 0 : _a.signal.removeEventListener('abort', abortHandler);
20358
20569
  // also hook unload event
20359
20570
  if (isWeb()) {
@@ -21170,11 +21381,12 @@ class Room extends eventsExports.EventEmitter {
21170
21381
  * No actual connection to a server will be established, all state is
21171
21382
  * @experimental
21172
21383
  */
21173
- simulateParticipants(options) {
21384
+ async simulateParticipants(options) {
21174
21385
  var _a, _b;
21175
21386
  const publishOptions = _objectSpread2({
21176
21387
  audio: true,
21177
- video: true
21388
+ video: true,
21389
+ useRealTracks: false
21178
21390
  }, options.publish);
21179
21391
  const participantOptions = _objectSpread2({
21180
21392
  count: 9,
@@ -21198,7 +21410,9 @@ class Room extends eventsExports.EventEmitter {
21198
21410
  sid: Math.floor(Math.random() * 10000).toString(),
21199
21411
  type: TrackType.AUDIO,
21200
21412
  name: 'video-dummy'
21201
- }), new LocalVideoTrack(createDummyVideoStreamTrack((_a = 160 * participantOptions.aspectRatios[0]) !== null && _a !== void 0 ? _a : 1, 160, true, true)));
21413
+ }), new LocalVideoTrack(publishOptions.useRealTracks ? (await navigator.mediaDevices.getUserMedia({
21414
+ video: true
21415
+ })).getVideoTracks()[0] : createDummyVideoStreamTrack((_a = 160 * participantOptions.aspectRatios[0]) !== null && _a !== void 0 ? _a : 1, 160, true, true)));
21202
21416
  // @ts-ignore
21203
21417
  this.localParticipant.addTrackPublication(camPub);
21204
21418
  this.localParticipant.emit(ParticipantEvent.LocalTrackPublished, camPub);
@@ -21208,7 +21422,9 @@ class Room extends eventsExports.EventEmitter {
21208
21422
  source: TrackSource.MICROPHONE,
21209
21423
  sid: Math.floor(Math.random() * 10000).toString(),
21210
21424
  type: TrackType.AUDIO
21211
- }), new LocalAudioTrack(getEmptyAudioStreamTrack()));
21425
+ }), new LocalAudioTrack(publishOptions.useRealTracks ? (await navigator.mediaDevices.getUserMedia({
21426
+ audio: true
21427
+ })).getAudioTracks()[0] : getEmptyAudioStreamTrack()));
21212
21428
  // @ts-ignore
21213
21429
  this.localParticipant.addTrackPublication(audioPub);
21214
21430
  this.localParticipant.emit(ParticipantEvent.LocalTrackPublished, audioPub);
@@ -21710,5 +21926,5 @@ class ConnectionCheck extends eventsExports {
21710
21926
  }
21711
21927
  }
21712
21928
 
21713
- 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 };
21929
+ export { AudioPresets, ConnectionCheck, ConnectionError, ConnectionQuality, ConnectionState, CriticalTimers, 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 };
21714
21930
  //# sourceMappingURL=livekit-client.esm.mjs.map