livekit-client 1.6.3 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/dist/livekit-client.esm.mjs +158 -41
  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.map +1 -1
  6. package/dist/src/connectionHelper/ConnectionCheck.d.ts +2 -2
  7. package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
  8. package/dist/src/proto/livekit_models.d.ts +10 -3
  9. package/dist/src/proto/livekit_models.d.ts.map +1 -1
  10. package/dist/src/proto/livekit_rtc.d.ts +188 -98
  11. package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
  12. package/dist/src/room/Room.d.ts +1 -1
  13. package/dist/src/room/Room.d.ts.map +1 -1
  14. package/dist/src/room/errors.d.ts +3 -0
  15. package/dist/src/room/errors.d.ts.map +1 -1
  16. package/dist/src/room/participant/LocalParticipant.d.ts +1 -3
  17. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  18. package/dist/src/room/participant/Participant.d.ts +1 -1
  19. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  20. package/dist/src/room/track/create.d.ts.map +1 -1
  21. package/dist/src/room/track/options.d.ts +2 -2
  22. package/dist/src/room/track/options.d.ts.map +1 -1
  23. package/dist/src/test/mocks.d.ts +1 -1
  24. package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -2
  25. package/dist/ts4.2/src/proto/livekit_models.d.ts +14 -3
  26. package/dist/ts4.2/src/proto/livekit_rtc.d.ts +237 -129
  27. package/dist/ts4.2/src/room/Room.d.ts +1 -1
  28. package/dist/ts4.2/src/room/errors.d.ts +3 -0
  29. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +1 -3
  30. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -1
  31. package/dist/ts4.2/src/room/track/options.d.ts +2 -2
  32. package/dist/ts4.2/src/test/mocks.d.ts +1 -1
  33. package/package.json +17 -17
  34. package/src/api/SignalClient.ts +5 -1
  35. package/src/connectionHelper/ConnectionCheck.ts +1 -1
  36. package/src/proto/google/protobuf/timestamp.ts +2 -2
  37. package/src/proto/livekit_models.ts +42 -9
  38. package/src/proto/livekit_rtc.ts +99 -4
  39. package/src/room/RTCEngine.ts +2 -2
  40. package/src/room/Room.ts +4 -7
  41. package/src/room/errors.ts +6 -0
  42. package/src/room/participant/LocalParticipant.ts +12 -17
  43. package/src/room/participant/Participant.ts +10 -2
  44. package/src/room/track/create.ts +6 -1
  45. 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;
@@ -4698,6 +4698,7 @@ function createBaseParticipantPermission() {
4698
4698
  canSubscribe: false,
4699
4699
  canPublish: false,
4700
4700
  canPublishData: false,
4701
+ canPublishSources: [],
4701
4702
  hidden: false,
4702
4703
  recorder: false
4703
4704
  };
@@ -4714,6 +4715,11 @@ const ParticipantPermission = {
4714
4715
  if (message.canPublishData === true) {
4715
4716
  writer.uint32(24).bool(message.canPublishData);
4716
4717
  }
4718
+ writer.uint32(74).fork();
4719
+ for (const v of message.canPublishSources) {
4720
+ writer.int32(v);
4721
+ }
4722
+ writer.ldelim();
4717
4723
  if (message.hidden === true) {
4718
4724
  writer.uint32(56).bool(message.hidden);
4719
4725
  }
@@ -4738,6 +4744,16 @@ const ParticipantPermission = {
4738
4744
  case 3:
4739
4745
  message.canPublishData = reader.bool();
4740
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;
4741
4757
  case 7:
4742
4758
  message.hidden = reader.bool();
4743
4759
  break;
@@ -4756,6 +4772,7 @@ const ParticipantPermission = {
4756
4772
  canSubscribe: isSet$1(object.canSubscribe) ? Boolean(object.canSubscribe) : false,
4757
4773
  canPublish: isSet$1(object.canPublish) ? Boolean(object.canPublish) : false,
4758
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)) : [],
4759
4776
  hidden: isSet$1(object.hidden) ? Boolean(object.hidden) : false,
4760
4777
  recorder: isSet$1(object.recorder) ? Boolean(object.recorder) : false
4761
4778
  };
@@ -4765,18 +4782,24 @@ const ParticipantPermission = {
4765
4782
  message.canSubscribe !== undefined && (obj.canSubscribe = message.canSubscribe);
4766
4783
  message.canPublish !== undefined && (obj.canPublish = message.canPublish);
4767
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
+ }
4768
4790
  message.hidden !== undefined && (obj.hidden = message.hidden);
4769
4791
  message.recorder !== undefined && (obj.recorder = message.recorder);
4770
4792
  return obj;
4771
4793
  },
4772
4794
  fromPartial(object) {
4773
- var _a, _b, _c, _d, _e;
4795
+ var _a, _b, _c, _d, _e, _f;
4774
4796
  const message = createBaseParticipantPermission();
4775
4797
  message.canSubscribe = (_a = object.canSubscribe) !== null && _a !== void 0 ? _a : false;
4776
4798
  message.canPublish = (_b = object.canPublish) !== null && _b !== void 0 ? _b : false;
4777
4799
  message.canPublishData = (_c = object.canPublishData) !== null && _c !== void 0 ? _c : false;
4778
- message.hidden = (_d = object.hidden) !== null && _d !== void 0 ? _d : false;
4779
- 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;
4780
4803
  return message;
4781
4804
  }
4782
4805
  };
@@ -6062,9 +6085,9 @@ const DisabledCodecs = {
6062
6085
  return message;
6063
6086
  }
6064
6087
  };
6065
- var globalThis$2 = (() => {
6066
- if (typeof globalThis$2 !== "undefined") {
6067
- return globalThis$2;
6088
+ var tsProtoGlobalThis$1 = (() => {
6089
+ if (typeof globalThis !== "undefined") {
6090
+ return globalThis;
6068
6091
  }
6069
6092
  if (typeof self !== "undefined") {
6070
6093
  return self;
@@ -6078,10 +6101,10 @@ var globalThis$2 = (() => {
6078
6101
  throw "Unable to locate global object";
6079
6102
  })();
6080
6103
  function bytesFromBase64(b64) {
6081
- if (globalThis$2.Buffer) {
6082
- return Uint8Array.from(globalThis$2.Buffer.from(b64, "base64"));
6104
+ if (tsProtoGlobalThis$1.Buffer) {
6105
+ return Uint8Array.from(tsProtoGlobalThis$1.Buffer.from(b64, "base64"));
6083
6106
  } else {
6084
- const bin = globalThis$2.atob(b64);
6107
+ const bin = tsProtoGlobalThis$1.atob(b64);
6085
6108
  const arr = new Uint8Array(bin.length);
6086
6109
  for (let i = 0; i < bin.length; ++i) {
6087
6110
  arr[i] = bin.charCodeAt(i);
@@ -6090,19 +6113,19 @@ function bytesFromBase64(b64) {
6090
6113
  }
6091
6114
  }
6092
6115
  function base64FromBytes(arr) {
6093
- if (globalThis$2.Buffer) {
6094
- return globalThis$2.Buffer.from(arr).toString("base64");
6116
+ if (tsProtoGlobalThis$1.Buffer) {
6117
+ return tsProtoGlobalThis$1.Buffer.from(arr).toString("base64");
6095
6118
  } else {
6096
6119
  const bin = [];
6097
6120
  arr.forEach(byte => {
6098
6121
  bin.push(String.fromCharCode(byte));
6099
6122
  });
6100
- return globalThis$2.btoa(bin.join(""));
6123
+ return tsProtoGlobalThis$1.btoa(bin.join(""));
6101
6124
  }
6102
6125
  }
6103
6126
  function longToNumber$1(long) {
6104
6127
  if (long.gt(Number.MAX_SAFE_INTEGER)) {
6105
- 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");
6106
6129
  }
6107
6130
  return long.toNumber();
6108
6131
  }
@@ -9394,7 +9417,7 @@ function createBaseSignalRequest() {
9394
9417
  const SignalRequest = {
9395
9418
  encode(message) {
9396
9419
  let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
9397
- 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;
9398
9421
  if (((_a = message.message) === null || _a === void 0 ? void 0 : _a.$case) === "offer") {
9399
9422
  SessionDescription.encode(message.message.offer, writer.uint32(10).fork()).ldelim();
9400
9423
  }
@@ -9434,6 +9457,9 @@ const SignalRequest = {
9434
9457
  if (((_o = message.message) === null || _o === void 0 ? void 0 : _o.$case) === "ping") {
9435
9458
  writer.uint32(112).int64(message.message.ping);
9436
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
+ }
9437
9463
  return writer;
9438
9464
  },
9439
9465
  decode(input, length) {
@@ -9521,6 +9547,12 @@ const SignalRequest = {
9521
9547
  ping: longToNumber(reader.int64())
9522
9548
  };
9523
9549
  break;
9550
+ case 15:
9551
+ message.message = {
9552
+ $case: "updateMetadata",
9553
+ updateMetadata: UpdateParticipantMetadata.decode(reader, reader.uint32())
9554
+ };
9555
+ break;
9524
9556
  default:
9525
9557
  reader.skipType(tag & 7);
9526
9558
  break;
@@ -9569,11 +9601,14 @@ const SignalRequest = {
9569
9601
  } : isSet(object.ping) ? {
9570
9602
  $case: "ping",
9571
9603
  ping: Number(object.ping)
9604
+ } : isSet(object.updateMetadata) ? {
9605
+ $case: "updateMetadata",
9606
+ updateMetadata: UpdateParticipantMetadata.fromJSON(object.updateMetadata)
9572
9607
  } : undefined
9573
9608
  };
9574
9609
  },
9575
9610
  toJSON(message) {
9576
- 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;
9577
9612
  const obj = {};
9578
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);
9579
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);
@@ -9588,10 +9623,11 @@ const SignalRequest = {
9588
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);
9589
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);
9590
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);
9591
9627
  return obj;
9592
9628
  },
9593
9629
  fromPartial(object) {
9594
- 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;
9595
9631
  const message = createBaseSignalRequest();
9596
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) {
9597
9633
  message.message = {
@@ -9671,6 +9707,12 @@ const SignalRequest = {
9671
9707
  ping: object.message.ping
9672
9708
  };
9673
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
+ }
9674
9716
  return message;
9675
9717
  }
9676
9718
  };
@@ -10943,7 +10985,8 @@ function createBaseUpdateTrackSettings() {
10943
10985
  quality: 0,
10944
10986
  width: 0,
10945
10987
  height: 0,
10946
- fps: 0
10988
+ fps: 0,
10989
+ priority: 0
10947
10990
  };
10948
10991
  }
10949
10992
  const UpdateTrackSettings = {
@@ -10967,6 +11010,9 @@ const UpdateTrackSettings = {
10967
11010
  if (message.fps !== 0) {
10968
11011
  writer.uint32(56).uint32(message.fps);
10969
11012
  }
11013
+ if (message.priority !== 0) {
11014
+ writer.uint32(64).uint32(message.priority);
11015
+ }
10970
11016
  return writer;
10971
11017
  },
10972
11018
  decode(input, length) {
@@ -10994,6 +11040,9 @@ const UpdateTrackSettings = {
10994
11040
  case 7:
10995
11041
  message.fps = reader.uint32();
10996
11042
  break;
11043
+ case 8:
11044
+ message.priority = reader.uint32();
11045
+ break;
10997
11046
  default:
10998
11047
  reader.skipType(tag & 7);
10999
11048
  break;
@@ -11008,7 +11057,8 @@ const UpdateTrackSettings = {
11008
11057
  quality: isSet(object.quality) ? videoQualityFromJSON(object.quality) : 0,
11009
11058
  width: isSet(object.width) ? Number(object.width) : 0,
11010
11059
  height: isSet(object.height) ? Number(object.height) : 0,
11011
- 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
11012
11062
  };
11013
11063
  },
11014
11064
  toJSON(message) {
@@ -11023,10 +11073,11 @@ const UpdateTrackSettings = {
11023
11073
  message.width !== undefined && (obj.width = Math.round(message.width));
11024
11074
  message.height !== undefined && (obj.height = Math.round(message.height));
11025
11075
  message.fps !== undefined && (obj.fps = Math.round(message.fps));
11076
+ message.priority !== undefined && (obj.priority = Math.round(message.priority));
11026
11077
  return obj;
11027
11078
  },
11028
11079
  fromPartial(object) {
11029
- var _a, _b, _c, _d, _e, _f;
11080
+ var _a, _b, _c, _d, _e, _f, _g;
11030
11081
  const message = createBaseUpdateTrackSettings();
11031
11082
  message.trackSids = ((_a = object.trackSids) === null || _a === void 0 ? void 0 : _a.map(e => e)) || [];
11032
11083
  message.disabled = (_b = object.disabled) !== null && _b !== void 0 ? _b : false;
@@ -11034,6 +11085,7 @@ const UpdateTrackSettings = {
11034
11085
  message.width = (_d = object.width) !== null && _d !== void 0 ? _d : 0;
11035
11086
  message.height = (_e = object.height) !== null && _e !== void 0 ? _e : 0;
11036
11087
  message.fps = (_f = object.fps) !== null && _f !== void 0 ? _f : 0;
11088
+ message.priority = (_g = object.priority) !== null && _g !== void 0 ? _g : 0;
11037
11089
  return message;
11038
11090
  }
11039
11091
  };
@@ -11155,6 +11207,53 @@ const UpdateVideoLayers = {
11155
11207
  return message;
11156
11208
  }
11157
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
+ };
11158
11257
  function createBaseICEServer() {
11159
11258
  return {
11160
11259
  urls: [],
@@ -12259,9 +12358,9 @@ const SimulateScenario = {
12259
12358
  return message;
12260
12359
  }
12261
12360
  };
12262
- var globalThis$1 = (() => {
12263
- if (typeof globalThis$1 !== "undefined") {
12264
- return globalThis$1;
12361
+ var tsProtoGlobalThis = (() => {
12362
+ if (typeof globalThis !== "undefined") {
12363
+ return globalThis;
12265
12364
  }
12266
12365
  if (typeof self !== "undefined") {
12267
12366
  return self;
@@ -12276,7 +12375,7 @@ var globalThis$1 = (() => {
12276
12375
  })();
12277
12376
  function longToNumber(long) {
12278
12377
  if (long.gt(Number.MAX_SAFE_INTEGER)) {
12279
- 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");
12280
12379
  }
12281
12380
  return long.toNumber();
12282
12381
  }
@@ -12301,6 +12400,11 @@ class ConnectionError extends LivekitError {
12301
12400
  this.reason = reason;
12302
12401
  }
12303
12402
  }
12403
+ class DeviceUnsupportedError extends LivekitError {
12404
+ constructor(message) {
12405
+ super(21, message !== null && message !== void 0 ? message : 'device is unsupported');
12406
+ }
12407
+ }
12304
12408
  class TrackInvalidError extends LivekitError {
12305
12409
  constructor(message) {
12306
12410
  super(20, message !== null && message !== void 0 ? message : 'track is invalid');
@@ -13500,7 +13604,7 @@ var uaParser = {
13500
13604
  })(uaParser, uaParserExports);
13501
13605
  var UAParser = uaParserExports;
13502
13606
 
13503
- var version$1 = "1.6.3";
13607
+ var version$1 = "1.6.4";
13504
13608
 
13505
13609
  const version = version$1;
13506
13610
  const protocolVersion = 8;
@@ -16405,8 +16509,15 @@ class Participant extends eventsExports.EventEmitter {
16405
16509
  /** @internal */
16406
16510
  setPermissions(permissions) {
16407
16511
  var _a, _b, _c, _d, _e;
16408
- 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
+ });
16409
16517
  this.permissions = permissions;
16518
+ if (changed) {
16519
+ this.emit(ParticipantEvent.ParticipantPermissionsChanged, prevPermissions);
16520
+ }
16410
16521
  return changed;
16411
16522
  }
16412
16523
  /** @internal */
@@ -17406,15 +17517,6 @@ class LocalParticipant extends Participant {
17406
17517
  setScreenShareEnabled(enabled, options, publishOptions) {
17407
17518
  return this.setTrackEnabled(Track.Source.ScreenShare, enabled, options, publishOptions);
17408
17519
  }
17409
- /** @internal */
17410
- setPermissions(permissions) {
17411
- const prevPermissions = this.permissions;
17412
- const changed = super.setPermissions(permissions);
17413
- if (changed && prevPermissions) {
17414
- this.emit(ParticipantEvent.ParticipantPermissionsChanged, prevPermissions);
17415
- }
17416
- return changed;
17417
- }
17418
17520
  async setTrackEnabled(source, enabled, options, publishOptions) {
17419
17521
  var _a, _b;
17420
17522
  livekitLogger.debug('setTrackEnabled', {
@@ -17593,6 +17695,9 @@ class LocalParticipant extends Participant {
17593
17695
  };
17594
17696
  }
17595
17697
  }
17698
+ if (navigator.mediaDevices.getDisplayMedia === undefined) {
17699
+ throw new DeviceUnsupportedError('getDisplayMedia not supported');
17700
+ }
17596
17701
  const stream = await navigator.mediaDevices.getDisplayMedia({
17597
17702
  audio: (_a = options.audio) !== null && _a !== void 0 ? _a : false,
17598
17703
  video: videoConstraints
@@ -17981,6 +18086,11 @@ class LocalParticipant extends Participant {
17981
18086
  }
17982
18087
  /** @internal */
17983
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
+ }
17984
18094
  super.updateInfo(info);
17985
18095
  // reconcile track mute status.
17986
18096
  // if server's track mute status doesn't match actual, we'll have to update
@@ -18367,6 +18477,10 @@ class SignalClient {
18367
18477
  handleSignalResponse(res) {
18368
18478
  var _a, _b;
18369
18479
  const msg = res.message;
18480
+ if (msg == undefined) {
18481
+ livekitLogger.debug('received unsupported message');
18482
+ return;
18483
+ }
18370
18484
  if (msg.$case === 'answer') {
18371
18485
  const sd = fromProtoSessionDescription(msg.answer);
18372
18486
  if (this.onAnswer) {
@@ -19609,13 +19723,13 @@ class RTCEngine extends eventsExports.EventEmitter {
19609
19723
  if (_this._isClosed) {
19610
19724
  return;
19611
19725
  }
19612
- livekitLogger.debug("".concat(connection, " disconnected"));
19726
+ livekitLogger.warn("".concat(connection, " disconnected"));
19613
19727
  if (_this.reconnectAttempts === 0) {
19614
19728
  // only reset start time on the first try
19615
19729
  _this.reconnectStart = Date.now();
19616
19730
  }
19617
19731
  const disconnect = duration => {
19618
- 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"));
19619
19733
  _this.emit(EngineEvent.Disconnected);
19620
19734
  _this.close();
19621
19735
  };
@@ -20670,7 +20784,7 @@ class Room extends eventsExports.EventEmitter {
20670
20784
  this.handleParticipantUpdates = participantInfos => {
20671
20785
  // handle changes to participant state, and send events
20672
20786
  participantInfos.forEach(info => {
20673
- if (info.sid === this.localParticipant.sid || info.identity === this.localParticipant.identity) {
20787
+ if (info.identity === this.localParticipant.identity) {
20674
20788
  this.localParticipant.updateInfo(info);
20675
20789
  return;
20676
20790
  }
@@ -21559,6 +21673,9 @@ async function createLocalScreenTracks(options) {
21559
21673
  height: options.resolution.height
21560
21674
  };
21561
21675
  }
21676
+ if (navigator.mediaDevices.getDisplayMedia === undefined) {
21677
+ throw new DeviceUnsupportedError('getDisplayMedia not supported');
21678
+ }
21562
21679
  // typescript definition is missing getDisplayMedia: https://github.com/microsoft/TypeScript/issues/33232
21563
21680
  // @ts-ignore
21564
21681
  const stream = await navigator.mediaDevices.getDisplayMedia({
@@ -21926,5 +22043,5 @@ class ConnectionCheck extends eventsExports {
21926
22043
  }
21927
22044
  }
21928
22045
 
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 };
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 };
21930
22047
  //# sourceMappingURL=livekit-client.esm.mjs.map