livekit-client 0.18.4-RC6 → 0.18.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 (127) hide show
  1. package/README.md +2 -5
  2. package/dist/api/RequestQueue.d.ts +13 -12
  3. package/dist/api/RequestQueue.d.ts.map +1 -0
  4. package/dist/api/SignalClient.d.ts +67 -66
  5. package/dist/api/SignalClient.d.ts.map +1 -0
  6. package/dist/connect.d.ts +24 -23
  7. package/dist/connect.d.ts.map +1 -0
  8. package/dist/index.d.ts +27 -26
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/livekit-client.esm.mjs +546 -486
  11. package/dist/livekit-client.esm.mjs.map +1 -1
  12. package/dist/livekit-client.umd.js +1 -1
  13. package/dist/livekit-client.umd.js.map +1 -1
  14. package/dist/logger.d.ts +26 -25
  15. package/dist/logger.d.ts.map +1 -0
  16. package/dist/options.d.ts +128 -127
  17. package/dist/options.d.ts.map +1 -0
  18. package/dist/proto/google/protobuf/timestamp.d.ts +133 -132
  19. package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -0
  20. package/dist/proto/livekit_models.d.ts +876 -868
  21. package/dist/proto/livekit_models.d.ts.map +1 -0
  22. package/dist/proto/livekit_rtc.d.ts +3904 -3859
  23. package/dist/proto/livekit_rtc.d.ts.map +1 -0
  24. package/dist/room/DeviceManager.d.ts +8 -7
  25. package/dist/room/DeviceManager.d.ts.map +1 -0
  26. package/dist/room/PCTransport.d.ts +16 -15
  27. package/dist/room/PCTransport.d.ts.map +1 -0
  28. package/dist/room/RTCEngine.d.ts +67 -66
  29. package/dist/room/RTCEngine.d.ts.map +1 -0
  30. package/dist/room/Room.d.ts +166 -165
  31. package/dist/room/Room.d.ts.map +1 -0
  32. package/dist/room/errors.d.ts +29 -28
  33. package/dist/room/errors.d.ts.map +1 -0
  34. package/dist/room/events.d.ts +391 -390
  35. package/dist/room/events.d.ts.map +1 -0
  36. package/dist/room/participant/LocalParticipant.d.ts +126 -125
  37. package/dist/room/participant/LocalParticipant.d.ts.map +1 -0
  38. package/dist/room/participant/Participant.d.ts +94 -93
  39. package/dist/room/participant/Participant.d.ts.map +1 -0
  40. package/dist/room/participant/ParticipantTrackPermission.d.ts +26 -19
  41. package/dist/room/participant/ParticipantTrackPermission.d.ts.map +1 -0
  42. package/dist/room/participant/RemoteParticipant.d.ts +40 -39
  43. package/dist/room/participant/RemoteParticipant.d.ts.map +1 -0
  44. package/dist/room/participant/publishUtils.d.ts +18 -17
  45. package/dist/room/participant/publishUtils.d.ts.map +1 -0
  46. package/dist/room/stats.d.ts +66 -65
  47. package/dist/room/stats.d.ts.map +1 -0
  48. package/dist/room/track/LocalAudioTrack.d.ts +20 -19
  49. package/dist/room/track/LocalAudioTrack.d.ts.map +1 -0
  50. package/dist/room/track/LocalTrack.d.ts +28 -27
  51. package/dist/room/track/LocalTrack.d.ts.map +1 -0
  52. package/dist/room/track/LocalTrackPublication.d.ts +38 -37
  53. package/dist/room/track/LocalTrackPublication.d.ts.map +1 -0
  54. package/dist/room/track/LocalVideoTrack.d.ts +31 -30
  55. package/dist/room/track/LocalVideoTrack.d.ts.map +1 -0
  56. package/dist/room/track/RemoteAudioTrack.d.ts +20 -19
  57. package/dist/room/track/RemoteAudioTrack.d.ts.map +1 -0
  58. package/dist/room/track/RemoteTrack.d.ts +16 -15
  59. package/dist/room/track/RemoteTrack.d.ts.map +1 -0
  60. package/dist/room/track/RemoteTrackPublication.d.ts +51 -50
  61. package/dist/room/track/RemoteTrackPublication.d.ts.map +1 -0
  62. package/dist/room/track/RemoteVideoTrack.d.ts +28 -27
  63. package/dist/room/track/RemoteVideoTrack.d.ts.map +1 -0
  64. package/dist/room/track/Track.d.ts +101 -100
  65. package/dist/room/track/Track.d.ts.map +1 -0
  66. package/dist/room/track/TrackPublication.d.ts +50 -49
  67. package/dist/room/track/TrackPublication.d.ts.map +1 -0
  68. package/dist/room/track/create.d.ts +24 -23
  69. package/dist/room/track/create.d.ts.map +1 -0
  70. package/dist/room/track/defaults.d.ts +5 -4
  71. package/dist/room/track/defaults.d.ts.map +1 -0
  72. package/dist/room/track/options.d.ts +223 -222
  73. package/dist/room/track/options.d.ts.map +1 -0
  74. package/dist/room/track/types.d.ts +19 -18
  75. package/dist/room/track/types.d.ts.map +1 -0
  76. package/dist/room/track/utils.d.ts +14 -13
  77. package/dist/room/track/utils.d.ts.map +1 -0
  78. package/dist/room/utils.d.ts +17 -15
  79. package/dist/room/utils.d.ts.map +1 -0
  80. package/dist/test/mocks.d.ts +12 -11
  81. package/dist/test/mocks.d.ts.map +1 -0
  82. package/dist/version.d.ts +3 -2
  83. package/dist/version.d.ts.map +1 -0
  84. package/package.json +4 -5
  85. package/src/api/RequestQueue.ts +53 -0
  86. package/src/api/SignalClient.ts +497 -0
  87. package/src/connect.ts +98 -0
  88. package/src/index.ts +49 -0
  89. package/src/logger.ts +56 -0
  90. package/src/options.ts +156 -0
  91. package/src/proto/google/protobuf/timestamp.ts +216 -0
  92. package/src/proto/livekit_models.ts +2456 -0
  93. package/src/proto/livekit_rtc.ts +2859 -0
  94. package/src/room/DeviceManager.ts +80 -0
  95. package/src/room/PCTransport.ts +88 -0
  96. package/src/room/RTCEngine.ts +695 -0
  97. package/src/room/Room.ts +970 -0
  98. package/src/room/errors.ts +65 -0
  99. package/src/room/events.ts +438 -0
  100. package/src/room/participant/LocalParticipant.ts +755 -0
  101. package/src/room/participant/Participant.ts +287 -0
  102. package/src/room/participant/ParticipantTrackPermission.ts +42 -0
  103. package/src/room/participant/RemoteParticipant.ts +263 -0
  104. package/src/room/participant/publishUtils.test.ts +144 -0
  105. package/src/room/participant/publishUtils.ts +229 -0
  106. package/src/room/stats.ts +134 -0
  107. package/src/room/track/LocalAudioTrack.ts +134 -0
  108. package/src/room/track/LocalTrack.ts +229 -0
  109. package/src/room/track/LocalTrackPublication.ts +87 -0
  110. package/src/room/track/LocalVideoTrack.test.ts +72 -0
  111. package/src/room/track/LocalVideoTrack.ts +295 -0
  112. package/src/room/track/RemoteAudioTrack.ts +86 -0
  113. package/src/room/track/RemoteTrack.ts +62 -0
  114. package/src/room/track/RemoteTrackPublication.ts +207 -0
  115. package/src/room/track/RemoteVideoTrack.ts +240 -0
  116. package/src/room/track/Track.ts +358 -0
  117. package/src/room/track/TrackPublication.ts +120 -0
  118. package/src/room/track/create.ts +122 -0
  119. package/src/room/track/defaults.ts +27 -0
  120. package/src/room/track/options.ts +281 -0
  121. package/src/room/track/types.ts +20 -0
  122. package/src/room/track/utils.test.ts +110 -0
  123. package/src/room/track/utils.ts +113 -0
  124. package/src/room/utils.ts +115 -0
  125. package/src/test/mocks.ts +17 -0
  126. package/src/version.ts +2 -0
  127. package/CHANGELOG.md +0 -5
@@ -325,9 +325,9 @@ livekitLogger.setLevel(LogLevel.info);
325
325
  function setLogLevel(level) {
326
326
  livekitLogger.setLevel(level);
327
327
  }
328
- /**
329
- * use this to hook into the logging function to allow sending internal livekit logs to third party services
330
- * if set, the browser logs will lose their stacktrace information (see https://github.com/pimterry/loglevel#writing-plugins)
328
+ /**
329
+ * use this to hook into the logging function to allow sending internal livekit logs to third party services
330
+ * if set, the browser logs will lose their stacktrace information (see https://github.com/pimterry/loglevel#writing-plugins)
331
331
  */
332
332
 
333
333
  function setLogExtension(extension) {
@@ -5024,7 +5024,8 @@ function createBaseParticipantInfo() {
5024
5024
  name: '',
5025
5025
  version: 0,
5026
5026
  permission: undefined,
5027
- region: ''
5027
+ region: '',
5028
+ isPublisher: false
5028
5029
  };
5029
5030
  }
5030
5031
 
@@ -5072,6 +5073,10 @@ const ParticipantInfo = {
5072
5073
  writer.uint32(98).string(message.region);
5073
5074
  }
5074
5075
 
5076
+ if (message.isPublisher === true) {
5077
+ writer.uint32(104).bool(message.isPublisher);
5078
+ }
5079
+
5075
5080
  return writer;
5076
5081
  },
5077
5082
 
@@ -5124,6 +5129,10 @@ const ParticipantInfo = {
5124
5129
  message.region = reader.string();
5125
5130
  break;
5126
5131
 
5132
+ case 13:
5133
+ message.isPublisher = reader.bool();
5134
+ break;
5135
+
5127
5136
  default:
5128
5137
  reader.skipType(tag & 7);
5129
5138
  break;
@@ -5144,7 +5153,8 @@ const ParticipantInfo = {
5144
5153
  name: isSet$1(object.name) ? String(object.name) : '',
5145
5154
  version: isSet$1(object.version) ? Number(object.version) : 0,
5146
5155
  permission: isSet$1(object.permission) ? ParticipantPermission.fromJSON(object.permission) : undefined,
5147
- region: isSet$1(object.region) ? String(object.region) : ''
5156
+ region: isSet$1(object.region) ? String(object.region) : '',
5157
+ isPublisher: isSet$1(object.isPublisher) ? Boolean(object.isPublisher) : false
5148
5158
  };
5149
5159
  },
5150
5160
 
@@ -5166,11 +5176,12 @@ const ParticipantInfo = {
5166
5176
  message.version !== undefined && (obj.version = Math.round(message.version));
5167
5177
  message.permission !== undefined && (obj.permission = message.permission ? ParticipantPermission.toJSON(message.permission) : undefined);
5168
5178
  message.region !== undefined && (obj.region = message.region);
5179
+ message.isPublisher !== undefined && (obj.isPublisher = message.isPublisher);
5169
5180
  return obj;
5170
5181
  },
5171
5182
 
5172
5183
  fromPartial(object) {
5173
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5184
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
5174
5185
 
5175
5186
  const message = createBaseParticipantInfo();
5176
5187
  message.sid = (_a = object.sid) !== null && _a !== void 0 ? _a : '';
@@ -5183,6 +5194,7 @@ const ParticipantInfo = {
5183
5194
  message.version = (_h = object.version) !== null && _h !== void 0 ? _h : 0;
5184
5195
  message.permission = object.permission !== undefined && object.permission !== null ? ParticipantPermission.fromPartial(object.permission) : undefined;
5185
5196
  message.region = (_j = object.region) !== null && _j !== void 0 ? _j : '';
5197
+ message.isPublisher = (_k = object.isPublisher) !== null && _k !== void 0 ? _k : false;
5186
5198
  return message;
5187
5199
  }
5188
5200
 
@@ -6231,11 +6243,9 @@ const btoa = globalThis$1.btoa || (bin => globalThis$1.Buffer.from(bin, 'binary'
6231
6243
 
6232
6244
  function base64FromBytes(arr) {
6233
6245
  const bin = [];
6234
-
6235
- for (const byte of arr) {
6246
+ arr.forEach(byte => {
6236
6247
  bin.push(String.fromCharCode(byte));
6237
- }
6238
-
6248
+ });
6239
6249
  return btoa(bin.join(''));
6240
6250
  }
6241
6251
 
@@ -8585,7 +8595,8 @@ function createBaseTrackPermission() {
8585
8595
  return {
8586
8596
  participantSid: '',
8587
8597
  allTracks: false,
8588
- trackSids: []
8598
+ trackSids: [],
8599
+ participantIdentity: ''
8589
8600
  };
8590
8601
  }
8591
8602
 
@@ -8605,6 +8616,10 @@ const TrackPermission = {
8605
8616
  writer.uint32(26).string(v);
8606
8617
  }
8607
8618
 
8619
+ if (message.participantIdentity !== '') {
8620
+ writer.uint32(34).string(message.participantIdentity);
8621
+ }
8622
+
8608
8623
  return writer;
8609
8624
  },
8610
8625
 
@@ -8629,6 +8644,10 @@ const TrackPermission = {
8629
8644
  message.trackSids.push(reader.string());
8630
8645
  break;
8631
8646
 
8647
+ case 4:
8648
+ message.participantIdentity = reader.string();
8649
+ break;
8650
+
8632
8651
  default:
8633
8652
  reader.skipType(tag & 7);
8634
8653
  break;
@@ -8642,7 +8661,8 @@ const TrackPermission = {
8642
8661
  return {
8643
8662
  participantSid: isSet(object.participantSid) ? String(object.participantSid) : '',
8644
8663
  allTracks: isSet(object.allTracks) ? Boolean(object.allTracks) : false,
8645
- trackSids: Array.isArray(object === null || object === void 0 ? void 0 : object.trackSids) ? object.trackSids.map(e => String(e)) : []
8664
+ trackSids: Array.isArray(object === null || object === void 0 ? void 0 : object.trackSids) ? object.trackSids.map(e => String(e)) : [],
8665
+ participantIdentity: isSet(object.participantIdentity) ? String(object.participantIdentity) : ''
8646
8666
  };
8647
8667
  },
8648
8668
 
@@ -8657,16 +8677,18 @@ const TrackPermission = {
8657
8677
  obj.trackSids = [];
8658
8678
  }
8659
8679
 
8680
+ message.participantIdentity !== undefined && (obj.participantIdentity = message.participantIdentity);
8660
8681
  return obj;
8661
8682
  },
8662
8683
 
8663
8684
  fromPartial(object) {
8664
- var _a, _b, _c;
8685
+ var _a, _b, _c, _d;
8665
8686
 
8666
8687
  const message = createBaseTrackPermission();
8667
8688
  message.participantSid = (_a = object.participantSid) !== null && _a !== void 0 ? _a : '';
8668
8689
  message.allTracks = (_b = object.allTracks) !== null && _b !== void 0 ? _b : false;
8669
8690
  message.trackSids = ((_c = object.trackSids) === null || _c === void 0 ? void 0 : _c.map(e => e)) || [];
8691
+ message.participantIdentity = (_d = object.participantIdentity) !== null && _d !== void 0 ? _d : '';
8670
8692
  return message;
8671
8693
  }
8672
8694
 
@@ -9207,237 +9229,237 @@ var MediaDeviceFailure;
9207
9229
  MediaDeviceFailure.getFailure = getFailure;
9208
9230
  })(MediaDeviceFailure || (MediaDeviceFailure = {}));
9209
9231
 
9210
- /**
9211
- * Events are the primary way LiveKit notifies your application of changes.
9212
- *
9213
- * The following are events emitted by [[Room]], listen to room events like
9214
- *
9215
- * ```typescript
9216
- * room.on(RoomEvent.TrackPublished, (track, publication, participant) => {})
9217
- * ```
9232
+ /**
9233
+ * Events are the primary way LiveKit notifies your application of changes.
9234
+ *
9235
+ * The following are events emitted by [[Room]], listen to room events like
9236
+ *
9237
+ * ```typescript
9238
+ * room.on(RoomEvent.TrackPublished, (track, publication, participant) => {})
9239
+ * ```
9218
9240
  */
9219
9241
  var RoomEvent;
9220
9242
 
9221
9243
  (function (RoomEvent) {
9222
- /**
9223
- * When the connection to the server has been interrupted and it's attempting
9224
- * to reconnect.
9244
+ /**
9245
+ * When the connection to the server has been interrupted and it's attempting
9246
+ * to reconnect.
9225
9247
  */
9226
9248
  RoomEvent["Reconnecting"] = "reconnecting";
9227
- /**
9228
- * Fires when a reconnection has been successful.
9249
+ /**
9250
+ * Fires when a reconnection has been successful.
9229
9251
  */
9230
9252
 
9231
9253
  RoomEvent["Reconnected"] = "reconnected";
9232
- /**
9233
- * When disconnected from room. This fires when room.disconnect() is called or
9234
- * when an unrecoverable connection issue had occured
9254
+ /**
9255
+ * When disconnected from room. This fires when room.disconnect() is called or
9256
+ * when an unrecoverable connection issue had occured
9235
9257
  */
9236
9258
 
9237
9259
  RoomEvent["Disconnected"] = "disconnected";
9238
- /**
9239
- * Whenever the connection state of the room changes
9240
- *
9241
- * args: ([[RoomState]])
9260
+ /**
9261
+ * Whenever the connection state of the room changes
9262
+ *
9263
+ * args: ([[RoomState]])
9242
9264
  */
9243
9265
 
9244
9266
  RoomEvent["StateChanged"] = "stateChanged";
9245
- /**
9246
- * When input or output devices on the machine have changed.
9267
+ /**
9268
+ * When input or output devices on the machine have changed.
9247
9269
  */
9248
9270
 
9249
9271
  RoomEvent["MediaDevicesChanged"] = "mediaDevicesChanged";
9250
- /**
9251
- * When a [[RemoteParticipant]] joins *after* the local
9252
- * participant. It will not emit events for participants that are already
9253
- * in the room
9254
- *
9255
- * args: ([[RemoteParticipant]])
9272
+ /**
9273
+ * When a [[RemoteParticipant]] joins *after* the local
9274
+ * participant. It will not emit events for participants that are already
9275
+ * in the room
9276
+ *
9277
+ * args: ([[RemoteParticipant]])
9256
9278
  */
9257
9279
 
9258
9280
  RoomEvent["ParticipantConnected"] = "participantConnected";
9259
- /**
9260
- * When a [[RemoteParticipant]] leaves *after* the local
9261
- * participant has joined.
9262
- *
9263
- * args: ([[RemoteParticipant]])
9281
+ /**
9282
+ * When a [[RemoteParticipant]] leaves *after* the local
9283
+ * participant has joined.
9284
+ *
9285
+ * args: ([[RemoteParticipant]])
9264
9286
  */
9265
9287
 
9266
9288
  RoomEvent["ParticipantDisconnected"] = "participantDisconnected";
9267
- /**
9268
- * When a new track is published to room *after* the local
9269
- * participant has joined. It will not fire for tracks that are already published.
9270
- *
9271
- * A track published doesn't mean the participant has subscribed to it. It's
9272
- * simply reflecting the state of the room.
9273
- *
9274
- * args: ([[RemoteTrackPublication]], [[RemoteParticipant]])
9289
+ /**
9290
+ * When a new track is published to room *after* the local
9291
+ * participant has joined. It will not fire for tracks that are already published.
9292
+ *
9293
+ * A track published doesn't mean the participant has subscribed to it. It's
9294
+ * simply reflecting the state of the room.
9295
+ *
9296
+ * args: ([[RemoteTrackPublication]], [[RemoteParticipant]])
9275
9297
  */
9276
9298
 
9277
9299
  RoomEvent["TrackPublished"] = "trackPublished";
9278
- /**
9279
- * The [[LocalParticipant]] has subscribed to a new track. This event will **always**
9280
- * fire as long as new tracks are ready for use.
9281
- *
9282
- * args: ([[RemoteTrack]], [[RemoteTrackPublication]], [[RemoteParticipant]])
9300
+ /**
9301
+ * The [[LocalParticipant]] has subscribed to a new track. This event will **always**
9302
+ * fire as long as new tracks are ready for use.
9303
+ *
9304
+ * args: ([[RemoteTrack]], [[RemoteTrackPublication]], [[RemoteParticipant]])
9283
9305
  */
9284
9306
 
9285
9307
  RoomEvent["TrackSubscribed"] = "trackSubscribed";
9286
- /**
9287
- * Could not subscribe to a track
9288
- *
9289
- * args: (track sid, [[RemoteParticipant]])
9308
+ /**
9309
+ * Could not subscribe to a track
9310
+ *
9311
+ * args: (track sid, [[RemoteParticipant]])
9290
9312
  */
9291
9313
 
9292
9314
  RoomEvent["TrackSubscriptionFailed"] = "trackSubscriptionFailed";
9293
- /**
9294
- * A [[RemoteParticipant]] has unpublished a track
9295
- *
9296
- * args: ([[RemoteTrackPublication]], [[RemoteParticipant]])
9315
+ /**
9316
+ * A [[RemoteParticipant]] has unpublished a track
9317
+ *
9318
+ * args: ([[RemoteTrackPublication]], [[RemoteParticipant]])
9297
9319
  */
9298
9320
 
9299
9321
  RoomEvent["TrackUnpublished"] = "trackUnpublished";
9300
- /**
9301
- * A subscribed track is no longer available. Clients should listen to this
9302
- * event and ensure they detach tracks.
9303
- *
9304
- * args: ([[Track]], [[RemoteTrackPublication]], [[RemoteParticipant]])
9322
+ /**
9323
+ * A subscribed track is no longer available. Clients should listen to this
9324
+ * event and ensure they detach tracks.
9325
+ *
9326
+ * args: ([[Track]], [[RemoteTrackPublication]], [[RemoteParticipant]])
9305
9327
  */
9306
9328
 
9307
9329
  RoomEvent["TrackUnsubscribed"] = "trackUnsubscribed";
9308
- /**
9309
- * A track that was muted, fires on both [[RemoteParticipant]]s and [[LocalParticipant]]
9310
- *
9311
- * args: ([[TrackPublication]], [[Participant]])
9330
+ /**
9331
+ * A track that was muted, fires on both [[RemoteParticipant]]s and [[LocalParticipant]]
9332
+ *
9333
+ * args: ([[TrackPublication]], [[Participant]])
9312
9334
  */
9313
9335
 
9314
9336
  RoomEvent["TrackMuted"] = "trackMuted";
9315
- /**
9316
- * A track that was unmuted, fires on both [[RemoteParticipant]]s and [[LocalParticipant]]
9317
- *
9318
- * args: ([[TrackPublication]], [[Participant]])
9337
+ /**
9338
+ * A track that was unmuted, fires on both [[RemoteParticipant]]s and [[LocalParticipant]]
9339
+ *
9340
+ * args: ([[TrackPublication]], [[Participant]])
9319
9341
  */
9320
9342
 
9321
9343
  RoomEvent["TrackUnmuted"] = "trackUnmuted";
9322
- /**
9323
- * A local track was published successfully. This event is helpful to know
9324
- * when to update your local UI with the newly published track.
9325
- *
9326
- * args: ([[LocalTrackPublication]], [[LocalParticipant]])
9344
+ /**
9345
+ * A local track was published successfully. This event is helpful to know
9346
+ * when to update your local UI with the newly published track.
9347
+ *
9348
+ * args: ([[LocalTrackPublication]], [[LocalParticipant]])
9327
9349
  */
9328
9350
 
9329
9351
  RoomEvent["LocalTrackPublished"] = "localTrackPublished";
9330
- /**
9331
- * A local track was unpublished. This event is helpful to know when to remove
9332
- * the local track from your UI.
9333
- *
9334
- * When a user stops sharing their screen by pressing "End" on the browser UI,
9335
- * this event will also fire.
9336
- *
9337
- * args: ([[LocalTrackPublication]], [[LocalParticipant]])
9352
+ /**
9353
+ * A local track was unpublished. This event is helpful to know when to remove
9354
+ * the local track from your UI.
9355
+ *
9356
+ * When a user stops sharing their screen by pressing "End" on the browser UI,
9357
+ * this event will also fire.
9358
+ *
9359
+ * args: ([[LocalTrackPublication]], [[LocalParticipant]])
9338
9360
  */
9339
9361
 
9340
9362
  RoomEvent["LocalTrackUnpublished"] = "localTrackUnpublished";
9341
- /**
9342
- * Active speakers changed. List of speakers are ordered by their audio level.
9343
- * loudest speakers first. This will include the LocalParticipant too.
9344
- *
9345
- * Speaker updates are sent only to the publishing participant and their subscribers.
9346
- *
9347
- * args: (Array<[[Participant]]>)
9363
+ /**
9364
+ * Active speakers changed. List of speakers are ordered by their audio level.
9365
+ * loudest speakers first. This will include the LocalParticipant too.
9366
+ *
9367
+ * Speaker updates are sent only to the publishing participant and their subscribers.
9368
+ *
9369
+ * args: (Array<[[Participant]]>)
9348
9370
  */
9349
9371
 
9350
9372
  RoomEvent["ActiveSpeakersChanged"] = "activeSpeakersChanged";
9351
- /**
9352
- * @deprecated Use ParticipantMetadataChanged instead
9353
- * @internal
9373
+ /**
9374
+ * @deprecated Use ParticipantMetadataChanged instead
9375
+ * @internal
9354
9376
  */
9355
9377
 
9356
9378
  RoomEvent["MetadataChanged"] = "metadataChanged";
9357
- /**
9358
- * Participant metadata is a simple way for app-specific state to be pushed to
9359
- * all users.
9360
- * When RoomService.UpdateParticipantMetadata is called to change a participant's
9361
- * state, *all* participants in the room will fire this event.
9362
- *
9363
- * args: (prevMetadata: string, [[Participant]])
9364
- *
9379
+ /**
9380
+ * Participant metadata is a simple way for app-specific state to be pushed to
9381
+ * all users.
9382
+ * When RoomService.UpdateParticipantMetadata is called to change a participant's
9383
+ * state, *all* participants in the room will fire this event.
9384
+ *
9385
+ * args: (prevMetadata: string, [[Participant]])
9386
+ *
9365
9387
  */
9366
9388
 
9367
9389
  RoomEvent["ParticipantMetadataChanged"] = "participantMetadataChanged";
9368
- /**
9369
- * Room metadata is a simple way for app-specific state to be pushed to
9370
- * all users.
9371
- * When RoomService.UpdateRoomMetadata is called to change a room's state,
9372
- * *all* participants in the room will fire this event.
9373
- *
9374
- * args: (string)
9390
+ /**
9391
+ * Room metadata is a simple way for app-specific state to be pushed to
9392
+ * all users.
9393
+ * When RoomService.UpdateRoomMetadata is called to change a room's state,
9394
+ * *all* participants in the room will fire this event.
9395
+ *
9396
+ * args: (string)
9375
9397
  */
9376
9398
 
9377
9399
  RoomEvent["RoomMetadataChanged"] = "roomMetadataChanged";
9378
- /**
9379
- * Data received from another participant.
9380
- * Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
9381
- * All participants in the room will receive the messages sent to the room.
9382
- *
9383
- * args: (payload: Uint8Array, participant: [[Participant]], kind: [[DataPacket_Kind]])
9400
+ /**
9401
+ * Data received from another participant.
9402
+ * Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
9403
+ * All participants in the room will receive the messages sent to the room.
9404
+ *
9405
+ * args: (payload: Uint8Array, participant: [[Participant]], kind: [[DataPacket_Kind]])
9384
9406
  */
9385
9407
 
9386
9408
  RoomEvent["DataReceived"] = "dataReceived";
9387
- /**
9388
- * Connection quality was changed for a Participant. It'll receive updates
9389
- * from the local participant, as well as any [[RemoteParticipant]]s that we are
9390
- * subscribed to.
9391
- *
9392
- * args: (connectionQuality: [[ConnectionQuality]], participant: [[Participant]])
9409
+ /**
9410
+ * Connection quality was changed for a Participant. It'll receive updates
9411
+ * from the local participant, as well as any [[RemoteParticipant]]s that we are
9412
+ * subscribed to.
9413
+ *
9414
+ * args: (connectionQuality: [[ConnectionQuality]], participant: [[Participant]])
9393
9415
  */
9394
9416
 
9395
9417
  RoomEvent["ConnectionQualityChanged"] = "connectionQualityChanged";
9396
- /**
9397
- * StreamState indicates if a subscribed (remote) track has been paused by the SFU
9398
- * (typically this happens because of subscriber's bandwidth constraints)
9399
- *
9400
- * When bandwidth conditions allow, the track will be resumed automatically.
9401
- * TrackStreamStateChanged will also be emitted when that happens.
9402
- *
9403
- * args: (pub: [[RemoteTrackPublication]], streamState: [[Track.StreamState]],
9404
- * participant: [[RemoteParticipant]])
9418
+ /**
9419
+ * StreamState indicates if a subscribed (remote) track has been paused by the SFU
9420
+ * (typically this happens because of subscriber's bandwidth constraints)
9421
+ *
9422
+ * When bandwidth conditions allow, the track will be resumed automatically.
9423
+ * TrackStreamStateChanged will also be emitted when that happens.
9424
+ *
9425
+ * args: (pub: [[RemoteTrackPublication]], streamState: [[Track.StreamState]],
9426
+ * participant: [[RemoteParticipant]])
9405
9427
  */
9406
9428
 
9407
9429
  RoomEvent["TrackStreamStateChanged"] = "trackStreamStateChanged";
9408
- /**
9409
- * One of subscribed tracks have changed its permissions for the current
9410
- * participant. If permission was revoked, then the track will no longer
9411
- * be subscribed. If permission was granted, a TrackSubscribed event will
9412
- * be emitted.
9413
- *
9414
- * args: (pub: [[RemoteTrackPublication]],
9415
- * status: [[TrackPublication.SubscriptionStatus]],
9416
- * participant: [[RemoteParticipant]])
9430
+ /**
9431
+ * One of subscribed tracks have changed its permissions for the current
9432
+ * participant. If permission was revoked, then the track will no longer
9433
+ * be subscribed. If permission was granted, a TrackSubscribed event will
9434
+ * be emitted.
9435
+ *
9436
+ * args: (pub: [[RemoteTrackPublication]],
9437
+ * status: [[TrackPublication.SubscriptionStatus]],
9438
+ * participant: [[RemoteParticipant]])
9417
9439
  */
9418
9440
 
9419
9441
  RoomEvent["TrackSubscriptionPermissionChanged"] = "trackSubscriptionPermissionChanged";
9420
- /**
9421
- * LiveKit will attempt to autoplay all audio tracks when you attach them to
9422
- * audio elements. However, if that fails, we'll notify you via AudioPlaybackStatusChanged.
9423
- * `Room.canPlayAudio` will indicate if audio playback is permitted.
9442
+ /**
9443
+ * LiveKit will attempt to autoplay all audio tracks when you attach them to
9444
+ * audio elements. However, if that fails, we'll notify you via AudioPlaybackStatusChanged.
9445
+ * `Room.canPlayAudio` will indicate if audio playback is permitted.
9424
9446
  */
9425
9447
 
9426
9448
  RoomEvent["AudioPlaybackStatusChanged"] = "audioPlaybackChanged";
9427
- /**
9428
- * When we have encountered an error while attempting to create a track.
9429
- * The errors take place in getUserMedia().
9430
- * Use MediaDeviceFailure.getFailure(error) to get the reason of failure.
9431
- * [[getAudioCreateError]] and [[getVideoCreateError]] will indicate if it had
9432
- * an error while creating the audio or video track respectively.
9433
- *
9434
- * args: (error: Error)
9449
+ /**
9450
+ * When we have encountered an error while attempting to create a track.
9451
+ * The errors take place in getUserMedia().
9452
+ * Use MediaDeviceFailure.getFailure(error) to get the reason of failure.
9453
+ * [[getAudioCreateError]] and [[getVideoCreateError]] will indicate if it had
9454
+ * an error while creating the audio or video track respectively.
9455
+ *
9456
+ * args: (error: Error)
9435
9457
  */
9436
9458
 
9437
9459
  RoomEvent["MediaDevicesError"] = "mediaDevicesError";
9438
- /**
9439
- * A participant's permission has changed. Currently only fired on LocalParticipant.
9440
- * args: (prevPermissions: [[ParticipantPermission]], participant: [[Participant]])
9460
+ /**
9461
+ * A participant's permission has changed. Currently only fired on LocalParticipant.
9462
+ * args: (prevPermissions: [[ParticipantPermission]], participant: [[Participant]])
9441
9463
  */
9442
9464
 
9443
9465
  RoomEvent["ParticipantPermissionsChanged"] = "participantPermissionsChanged";
@@ -9446,141 +9468,141 @@ var RoomEvent;
9446
9468
  var ParticipantEvent;
9447
9469
 
9448
9470
  (function (ParticipantEvent) {
9449
- /**
9450
- * When a new track is published to room *after* the local
9451
- * participant has joined. It will not fire for tracks that are already published.
9452
- *
9453
- * A track published doesn't mean the participant has subscribed to it. It's
9454
- * simply reflecting the state of the room.
9455
- *
9456
- * args: ([[RemoteTrackPublication]])
9471
+ /**
9472
+ * When a new track is published to room *after* the local
9473
+ * participant has joined. It will not fire for tracks that are already published.
9474
+ *
9475
+ * A track published doesn't mean the participant has subscribed to it. It's
9476
+ * simply reflecting the state of the room.
9477
+ *
9478
+ * args: ([[RemoteTrackPublication]])
9457
9479
  */
9458
9480
  ParticipantEvent["TrackPublished"] = "trackPublished";
9459
- /**
9460
- * Successfully subscribed to the [[RemoteParticipant]]'s track.
9461
- * This event will **always** fire as long as new tracks are ready for use.
9462
- *
9463
- * args: ([[RemoteTrack]], [[RemoteTrackPublication]])
9481
+ /**
9482
+ * Successfully subscribed to the [[RemoteParticipant]]'s track.
9483
+ * This event will **always** fire as long as new tracks are ready for use.
9484
+ *
9485
+ * args: ([[RemoteTrack]], [[RemoteTrackPublication]])
9464
9486
  */
9465
9487
 
9466
9488
  ParticipantEvent["TrackSubscribed"] = "trackSubscribed";
9467
- /**
9468
- * Could not subscribe to a track
9469
- *
9470
- * args: (track sid)
9489
+ /**
9490
+ * Could not subscribe to a track
9491
+ *
9492
+ * args: (track sid)
9471
9493
  */
9472
9494
 
9473
9495
  ParticipantEvent["TrackSubscriptionFailed"] = "trackSubscriptionFailed";
9474
- /**
9475
- * A [[RemoteParticipant]] has unpublished a track
9476
- *
9477
- * args: ([[RemoteTrackPublication]])
9496
+ /**
9497
+ * A [[RemoteParticipant]] has unpublished a track
9498
+ *
9499
+ * args: ([[RemoteTrackPublication]])
9478
9500
  */
9479
9501
 
9480
9502
  ParticipantEvent["TrackUnpublished"] = "trackUnpublished";
9481
- /**
9482
- * A subscribed track is no longer available. Clients should listen to this
9483
- * event and ensure they detach tracks.
9484
- *
9485
- * args: ([[RemoteTrack]], [[RemoteTrackPublication]])
9503
+ /**
9504
+ * A subscribed track is no longer available. Clients should listen to this
9505
+ * event and ensure they detach tracks.
9506
+ *
9507
+ * args: ([[RemoteTrack]], [[RemoteTrackPublication]])
9486
9508
  */
9487
9509
 
9488
9510
  ParticipantEvent["TrackUnsubscribed"] = "trackUnsubscribed";
9489
- /**
9490
- * A track that was muted, fires on both [[RemoteParticipant]]s and [[LocalParticipant]]
9491
- *
9492
- * args: ([[TrackPublication]])
9511
+ /**
9512
+ * A track that was muted, fires on both [[RemoteParticipant]]s and [[LocalParticipant]]
9513
+ *
9514
+ * args: ([[TrackPublication]])
9493
9515
  */
9494
9516
 
9495
9517
  ParticipantEvent["TrackMuted"] = "trackMuted";
9496
- /**
9497
- * A track that was unmuted, fires on both [[RemoteParticipant]]s and [[LocalParticipant]]
9498
- *
9499
- * args: ([[TrackPublication]])
9518
+ /**
9519
+ * A track that was unmuted, fires on both [[RemoteParticipant]]s and [[LocalParticipant]]
9520
+ *
9521
+ * args: ([[TrackPublication]])
9500
9522
  */
9501
9523
 
9502
9524
  ParticipantEvent["TrackUnmuted"] = "trackUnmuted";
9503
- /**
9504
- * A local track was published successfully. This event is helpful to know
9505
- * when to update your local UI with the newly published track.
9506
- *
9507
- * args: ([[LocalTrackPublication]])
9525
+ /**
9526
+ * A local track was published successfully. This event is helpful to know
9527
+ * when to update your local UI with the newly published track.
9528
+ *
9529
+ * args: ([[LocalTrackPublication]])
9508
9530
  */
9509
9531
 
9510
9532
  ParticipantEvent["LocalTrackPublished"] = "localTrackPublished";
9511
- /**
9512
- * A local track was unpublished. This event is helpful to know when to remove
9513
- * the local track from your UI.
9514
- *
9515
- * When a user stops sharing their screen by pressing "End" on the browser UI,
9516
- * this event will also fire.
9517
- *
9518
- * args: ([[LocalTrackPublication]])
9533
+ /**
9534
+ * A local track was unpublished. This event is helpful to know when to remove
9535
+ * the local track from your UI.
9536
+ *
9537
+ * When a user stops sharing their screen by pressing "End" on the browser UI,
9538
+ * this event will also fire.
9539
+ *
9540
+ * args: ([[LocalTrackPublication]])
9519
9541
  */
9520
9542
 
9521
9543
  ParticipantEvent["LocalTrackUnpublished"] = "localTrackUnpublished";
9522
- /**
9523
- * @deprecated Use ParticipantMetadataChanged instead
9524
- * @internal
9544
+ /**
9545
+ * @deprecated Use ParticipantMetadataChanged instead
9546
+ * @internal
9525
9547
  */
9526
9548
 
9527
9549
  ParticipantEvent["MetadataChanged"] = "metadataChanged";
9528
- /**
9529
- * Participant metadata is a simple way for app-specific state to be pushed to
9530
- * all users.
9531
- * When RoomService.UpdateParticipantMetadata is called to change a participant's
9532
- * state, *all* participants in the room will fire this event.
9533
- * To access the current metadata, see [[Participant.metadata]].
9534
- *
9535
- * args: (prevMetadata: string)
9536
- *
9550
+ /**
9551
+ * Participant metadata is a simple way for app-specific state to be pushed to
9552
+ * all users.
9553
+ * When RoomService.UpdateParticipantMetadata is called to change a participant's
9554
+ * state, *all* participants in the room will fire this event.
9555
+ * To access the current metadata, see [[Participant.metadata]].
9556
+ *
9557
+ * args: (prevMetadata: string)
9558
+ *
9537
9559
  */
9538
9560
 
9539
9561
  ParticipantEvent["ParticipantMetadataChanged"] = "participantMetadataChanged";
9540
- /**
9541
- * Data received from this participant as sender.
9542
- * Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
9543
- * All participants in the room will receive the messages sent to the room.
9544
- *
9545
- * args: (payload: Uint8Array, kind: [[DataPacket_Kind]])
9562
+ /**
9563
+ * Data received from this participant as sender.
9564
+ * Data packets provides the ability to use LiveKit to send/receive arbitrary payloads.
9565
+ * All participants in the room will receive the messages sent to the room.
9566
+ *
9567
+ * args: (payload: Uint8Array, kind: [[DataPacket_Kind]])
9546
9568
  */
9547
9569
 
9548
9570
  ParticipantEvent["DataReceived"] = "dataReceived";
9549
- /**
9550
- * Has speaking status changed for the current participant
9551
- *
9552
- * args: (speaking: boolean)
9571
+ /**
9572
+ * Has speaking status changed for the current participant
9573
+ *
9574
+ * args: (speaking: boolean)
9553
9575
  */
9554
9576
 
9555
9577
  ParticipantEvent["IsSpeakingChanged"] = "isSpeakingChanged";
9556
- /**
9557
- * Connection quality was changed for a Participant. It'll receive updates
9558
- * from the local participant, as well as any [[RemoteParticipant]]s that we are
9559
- * subscribed to.
9560
- *
9561
- * args: (connectionQuality: [[ConnectionQuality]])
9578
+ /**
9579
+ * Connection quality was changed for a Participant. It'll receive updates
9580
+ * from the local participant, as well as any [[RemoteParticipant]]s that we are
9581
+ * subscribed to.
9582
+ *
9583
+ * args: (connectionQuality: [[ConnectionQuality]])
9562
9584
  */
9563
9585
 
9564
9586
  ParticipantEvent["ConnectionQualityChanged"] = "connectionQualityChanged";
9565
- /**
9566
- * StreamState indicates if a subscribed track has been paused by the SFU
9567
- * (typically this happens because of subscriber's bandwidth constraints)
9568
- *
9569
- * When bandwidth conditions allow, the track will be resumed automatically.
9570
- * TrackStreamStateChanged will also be emitted when that happens.
9571
- *
9572
- * args: (pub: [[RemoteTrackPublication]], streamState: [[Track.StreamState]])
9587
+ /**
9588
+ * StreamState indicates if a subscribed track has been paused by the SFU
9589
+ * (typically this happens because of subscriber's bandwidth constraints)
9590
+ *
9591
+ * When bandwidth conditions allow, the track will be resumed automatically.
9592
+ * TrackStreamStateChanged will also be emitted when that happens.
9593
+ *
9594
+ * args: (pub: [[RemoteTrackPublication]], streamState: [[Track.StreamState]])
9573
9595
  */
9574
9596
 
9575
9597
  ParticipantEvent["TrackStreamStateChanged"] = "trackStreamStateChanged";
9576
- /**
9577
- * One of subscribed tracks have changed its permissions for the current
9578
- * participant. If permission was revoked, then the track will no longer
9579
- * be subscribed. If permission was granted, a TrackSubscribed event will
9580
- * be emitted.
9581
- *
9582
- * args: (pub: [[RemoteTrackPublication]],
9583
- * status: [[TrackPublication.SubscriptionStatus]])
9598
+ /**
9599
+ * One of subscribed tracks have changed its permissions for the current
9600
+ * participant. If permission was revoked, then the track will no longer
9601
+ * be subscribed. If permission was granted, a TrackSubscribed event will
9602
+ * be emitted.
9603
+ *
9604
+ * args: (pub: [[RemoteTrackPublication]],
9605
+ * status: [[TrackPublication.SubscriptionStatus]])
9584
9606
  */
9585
9607
 
9586
9608
  ParticipantEvent["TrackSubscriptionPermissionChanged"] = "trackSubscriptionPermissionChanged"; // fired only on LocalParticipant
@@ -9588,9 +9610,9 @@ var ParticipantEvent;
9588
9610
  /** @internal */
9589
9611
 
9590
9612
  ParticipantEvent["MediaDevicesError"] = "mediaDevicesError";
9591
- /**
9592
- * A participant's permission has changed. Currently only fired on LocalParticipant.
9593
- * args: (prevPermissions: [[ParticipantPermission]])
9613
+ /**
9614
+ * A participant's permission has changed. Currently only fired on LocalParticipant.
9615
+ * args: (prevPermissions: [[ParticipantPermission]])
9594
9616
  */
9595
9617
 
9596
9618
  ParticipantEvent["ParticipantPermissionsChanged"] = "participantPermissionsChanged";
@@ -9633,9 +9655,9 @@ var TrackEvent;
9633
9655
  /** @internal */
9634
9656
 
9635
9657
  TrackEvent["AudioPlaybackFailed"] = "audioPlaybackFailed";
9636
- /**
9637
- * @internal
9638
- * Only fires on LocalAudioTrack instances
9658
+ /**
9659
+ * @internal
9660
+ * Only fires on LocalAudioTrack instances
9639
9661
  */
9640
9662
 
9641
9663
  TrackEvent["AudioSilenceDetected"] = "audioSilenceDetected";
@@ -9651,15 +9673,15 @@ var TrackEvent;
9651
9673
  /** @internal */
9652
9674
 
9653
9675
  TrackEvent["ElementDetached"] = "elementDetached";
9654
- /**
9655
- * @internal
9656
- * Only fires on LocalTracks
9676
+ /**
9677
+ * @internal
9678
+ * Only fires on LocalTracks
9657
9679
  */
9658
9680
 
9659
9681
  TrackEvent["UpstreamPaused"] = "upstreamPaused";
9660
- /**
9661
- * @internal
9662
- * Only fires on LocalTracks
9682
+ /**
9683
+ * @internal
9684
+ * Only fires on LocalTracks
9663
9685
  */
9664
9686
 
9665
9687
  TrackEvent["UpstreamResumed"] = "upstreamResumed";
@@ -9826,24 +9848,47 @@ function getClientInfo() {
9826
9848
  });
9827
9849
  return info;
9828
9850
  }
9829
- let emptyMediaStreamTrack;
9830
- function getEmptyMediaStreamTrack() {
9831
- if (!emptyMediaStreamTrack) {
9851
+ let emptyVideoStreamTrack;
9852
+ function getEmptyVideoStreamTrack() {
9853
+ var _a;
9854
+
9855
+ if (!emptyVideoStreamTrack) {
9832
9856
  const canvas = document.createElement('canvas');
9833
9857
  canvas.width = 2;
9834
- canvas.height = 2; // @ts-ignore
9858
+ canvas.height = 2;
9859
+ (_a = canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.fillRect(0, 0, canvas.width, canvas.height); // @ts-ignore
9835
9860
 
9836
9861
  const emptyStream = canvas.captureStream();
9837
- [emptyMediaStreamTrack] = emptyStream.getTracks();
9862
+ [emptyVideoStreamTrack] = emptyStream.getTracks();
9863
+
9864
+ if (!emptyVideoStreamTrack) {
9865
+ throw Error('Could not get empty media stream video track');
9866
+ }
9838
9867
 
9839
- if (!emptyMediaStreamTrack) {
9840
- throw Error('Could not get empty media stream track');
9868
+ emptyVideoStreamTrack.enabled = false;
9869
+ }
9870
+
9871
+ return emptyVideoStreamTrack;
9872
+ }
9873
+ let emptyAudioStreamTrack;
9874
+ function getEmptyAudioStreamTrack() {
9875
+ if (!emptyAudioStreamTrack) {
9876
+ // implementation adapted from https://blog.mozilla.org/webrtc/warm-up-with-replacetrack/
9877
+ const ctx = new AudioContext();
9878
+ const oscillator = ctx.createOscillator();
9879
+ const dst = ctx.createMediaStreamDestination();
9880
+ oscillator.connect(dst);
9881
+ oscillator.start();
9882
+ [emptyAudioStreamTrack] = dst.stream.getAudioTracks();
9883
+
9884
+ if (!emptyAudioStreamTrack) {
9885
+ throw Error('Could not get empty media stream audio track');
9841
9886
  }
9842
9887
 
9843
- emptyMediaStreamTrack.enabled = false;
9888
+ emptyAudioStreamTrack.enabled = false;
9844
9889
  }
9845
9890
 
9846
- return emptyMediaStreamTrack;
9891
+ return emptyAudioStreamTrack;
9847
9892
  }
9848
9893
 
9849
9894
  var events = {exports: {}};
@@ -10674,8 +10719,8 @@ class LocalTrack extends Track {
10674
10719
  get isUpstreamPaused() {
10675
10720
  return this._isUpstreamPaused;
10676
10721
  }
10677
- /**
10678
- * @returns DeviceID of the device that is currently being used for this track
10722
+ /**
10723
+ * @returns DeviceID of the device that is currently being used for this track
10679
10724
  */
10680
10725
 
10681
10726
 
@@ -10818,7 +10863,8 @@ class LocalTrack extends Track {
10818
10863
 
10819
10864
  this._isUpstreamPaused = true;
10820
10865
  this.emit(TrackEvent.UpstreamPaused, this);
10821
- await this.sender.replaceTrack(getEmptyMediaStreamTrack());
10866
+ const emptyTrack = this.kind === Track.Kind.Audio ? getEmptyAudioStreamTrack() : getEmptyVideoStreamTrack();
10867
+ await this.sender.replaceTrack(emptyTrack);
10822
10868
  }
10823
10869
 
10824
10870
  async resumeUpstream() {
@@ -10902,9 +10948,9 @@ function constraintsForOptions(options) {
10902
10948
 
10903
10949
  return constraints;
10904
10950
  }
10905
- /**
10906
- * This function detects silence on a given [[Track]] instance.
10907
- * Returns true if the track seems to be entirely silent.
10951
+ /**
10952
+ * This function detects silence on a given [[Track]] instance.
10953
+ * Returns true if the track seems to be entirely silent.
10908
10954
  */
10909
10955
 
10910
10956
  async function detectSilence(track) {
@@ -10927,8 +10973,8 @@ async function detectSilence(track) {
10927
10973
 
10928
10974
  return false;
10929
10975
  }
10930
- /**
10931
- * @internal
10976
+ /**
10977
+ * @internal
10932
10978
  */
10933
10979
 
10934
10980
  function getNewAudioContext() {
@@ -11256,9 +11302,9 @@ class LocalVideoTrack extends LocalTrack {
11256
11302
 
11257
11303
  await this.restart(constraints);
11258
11304
  }
11259
- /**
11260
- * @internal
11261
- * Sets layers that should be publishing
11305
+ /**
11306
+ * @internal
11307
+ * Sets layers that should be publishing
11262
11308
  */
11263
11309
 
11264
11310
 
@@ -11464,8 +11510,8 @@ class RemoteAudioTrack extends RemoteTrack {
11464
11510
 
11465
11511
  this.elementVolume = 1;
11466
11512
  }
11467
- /**
11468
- * sets the volume for all attached audio elements
11513
+ /**
11514
+ * sets the volume for all attached audio elements
11469
11515
  */
11470
11516
 
11471
11517
 
@@ -11476,8 +11522,8 @@ class RemoteAudioTrack extends RemoteTrack {
11476
11522
 
11477
11523
  this.elementVolume = volume;
11478
11524
  }
11479
- /**
11480
- * gets the volume for all attached audio elements
11525
+ /**
11526
+ * gets the volume for all attached audio elements
11481
11527
  */
11482
11528
 
11483
11529
 
@@ -11617,6 +11663,10 @@ class RemoteVideoTrack extends RemoteTrack {
11617
11663
  this.updateDimensions();
11618
11664
  }, REACTION_DELAY);
11619
11665
  this.adaptiveStreamSettings = adaptiveStreamSettings;
11666
+
11667
+ if (this.isAdaptiveStream) {
11668
+ this.streamState = Track.StreamState.Paused;
11669
+ }
11620
11670
  }
11621
11671
 
11622
11672
  get isAdaptiveStream() {
@@ -11826,8 +11876,8 @@ class TrackPublication extends events.exports.EventEmitter {
11826
11876
  get isSubscribed() {
11827
11877
  return this.track !== undefined;
11828
11878
  }
11829
- /**
11830
- * an [AudioTrack] if this publication holds an audio track
11879
+ /**
11880
+ * an [AudioTrack] if this publication holds an audio track
11831
11881
  */
11832
11882
 
11833
11883
 
@@ -11836,8 +11886,8 @@ class TrackPublication extends events.exports.EventEmitter {
11836
11886
  return this.track;
11837
11887
  }
11838
11888
  }
11839
- /**
11840
- * an [VideoTrack] if this publication holds a video track
11889
+ /**
11890
+ * an [VideoTrack] if this publication holds a video track
11841
11891
  */
11842
11892
 
11843
11893
 
@@ -11923,8 +11973,8 @@ class LocalTrackPublication extends TrackPublication {
11923
11973
  get videoTrack() {
11924
11974
  return super.videoTrack;
11925
11975
  }
11926
- /**
11927
- * Mute the track associated with this publication
11976
+ /**
11977
+ * Mute the track associated with this publication
11928
11978
  */
11929
11979
 
11930
11980
 
@@ -11933,8 +11983,8 @@ class LocalTrackPublication extends TrackPublication {
11933
11983
 
11934
11984
  return (_a = this.track) === null || _a === void 0 ? void 0 : _a.mute();
11935
11985
  }
11936
- /**
11937
- * Unmute track associated with this publication
11986
+ /**
11987
+ * Unmute track associated with this publication
11938
11988
  */
11939
11989
 
11940
11990
 
@@ -11943,10 +11993,10 @@ class LocalTrackPublication extends TrackPublication {
11943
11993
 
11944
11994
  return (_a = this.track) === null || _a === void 0 ? void 0 : _a.unmute();
11945
11995
  }
11946
- /**
11947
- * Pauses the media stream track associated with this publication from being sent to the server
11948
- * and signals "muted" event to other participants
11949
- * Useful if you want to pause the stream without pausing the local media stream track
11996
+ /**
11997
+ * Pauses the media stream track associated with this publication from being sent to the server
11998
+ * and signals "muted" event to other participants
11999
+ * Useful if you want to pause the stream without pausing the local media stream track
11950
12000
  */
11951
12001
 
11952
12002
 
@@ -11955,9 +12005,9 @@ class LocalTrackPublication extends TrackPublication {
11955
12005
 
11956
12006
  await ((_a = this.track) === null || _a === void 0 ? void 0 : _a.pauseUpstream());
11957
12007
  }
11958
- /**
11959
- * Resumes sending the media stream track associated with this publication to the server after a call to [[pauseUpstream()]]
11960
- * and signals "unmuted" event to other participants (unless the track is explicitly muted)
12008
+ /**
12009
+ * Resumes sending the media stream track associated with this publication to the server after a call to [[pauseUpstream()]]
12010
+ * and signals "unmuted" event to other participants (unless the track is explicitly muted)
11961
12011
  */
11962
12012
 
11963
12013
 
@@ -12002,8 +12052,8 @@ var AudioPresets;
12002
12052
  maxBitrate: 32000
12003
12053
  };
12004
12054
  })(AudioPresets || (AudioPresets = {}));
12005
- /**
12006
- * Sane presets for video resolution/encoding
12055
+ /**
12056
+ * Sane presets for video resolution/encoding
12007
12057
  */
12008
12058
 
12009
12059
 
@@ -12033,8 +12083,8 @@ const VideoPresets = {
12033
12083
  /** @deprecated */
12034
12084
  fhd: new VideoPreset(1920, 1080, 3000000, 30)
12035
12085
  };
12036
- /**
12037
- * Four by three presets
12086
+ /**
12087
+ * Four by three presets
12038
12088
  */
12039
12089
 
12040
12090
  const VideoPresets43 = {
@@ -12132,11 +12182,11 @@ class Participant extends events.exports.EventEmitter {
12132
12182
  getTracks() {
12133
12183
  return Array.from(this.tracks.values());
12134
12184
  }
12135
- /**
12136
- * Finds the first track that matches the source filter, for example, getting
12137
- * the user's camera track with getTrackBySource(Track.Source.Camera).
12138
- * @param source
12139
- * @returns
12185
+ /**
12186
+ * Finds the first track that matches the source filter, for example, getting
12187
+ * the user's camera track with getTrackBySource(Track.Source.Camera).
12188
+ * @param source
12189
+ * @returns
12140
12190
  */
12141
12191
 
12142
12192
 
@@ -12169,10 +12219,10 @@ class Participant extends events.exports.EventEmitter {
12169
12219
  }
12170
12220
  }
12171
12221
  }
12172
- /**
12173
- * Finds the first track that matches the track's name.
12174
- * @param name
12175
- * @returns
12222
+ /**
12223
+ * Finds the first track that matches the track's name.
12224
+ * @param name
12225
+ * @returns
12176
12226
  */
12177
12227
 
12178
12228
 
@@ -12313,15 +12363,16 @@ class Participant extends events.exports.EventEmitter {
12313
12363
  }
12314
12364
 
12315
12365
  function trackPermissionToProto(perms) {
12316
- var _a;
12366
+ var _a, _b, _c;
12317
12367
 
12318
- if (!perms.participantSid) {
12319
- throw new Error('Invalid track permission, missing participantSid');
12368
+ if (!perms.participantSid && !perms.participantIdentity) {
12369
+ throw new Error('Invalid track permission, must provide at least one of participantIdentity and participantSid');
12320
12370
  }
12321
12371
 
12322
12372
  return {
12323
- participantSid: perms.participantSid,
12324
- allTracks: (_a = perms.allowAll) !== null && _a !== void 0 ? _a : false,
12373
+ participantIdentity: (_a = perms.participantIdentity) !== null && _a !== void 0 ? _a : '',
12374
+ participantSid: (_b = perms.participantSid) !== null && _b !== void 0 ? _b : '',
12375
+ allTracks: (_c = perms.allowAll) !== null && _c !== void 0 ? _c : false,
12325
12376
  trackSids: perms.allowedTrackSids || []
12326
12377
  };
12327
12378
  }
@@ -12567,9 +12618,9 @@ class RemoteTrackPublication extends TrackPublication {
12567
12618
  this.emitTrackUpdate();
12568
12619
  };
12569
12620
  }
12570
- /**
12571
- * Subscribe or unsubscribe to this remote track
12572
- * @param subscribed true to subscribe to a track, false to unsubscribe
12621
+ /**
12622
+ * Subscribe or unsubscribe to this remote track
12623
+ * @param subscribed true to subscribe to a track, false to unsubscribe
12573
12624
  */
12574
12625
 
12575
12626
 
@@ -12599,8 +12650,8 @@ class RemoteTrackPublication extends TrackPublication {
12599
12650
 
12600
12651
  return TrackPublication.SubscriptionStatus.Subscribed;
12601
12652
  }
12602
- /**
12603
- * Returns true if track is subscribed, and ready for playback
12653
+ /**
12654
+ * Returns true if track is subscribed, and ready for playback
12604
12655
  */
12605
12656
 
12606
12657
 
@@ -12619,11 +12670,11 @@ class RemoteTrackPublication extends TrackPublication {
12619
12670
  get isEnabled() {
12620
12671
  return !this.disabled;
12621
12672
  }
12622
- /**
12623
- * disable server from sending down data for this track. this is useful when
12624
- * the participant is off screen, you may disable streaming down their video
12625
- * to reduce bandwidth requirements
12626
- * @param enabled
12673
+ /**
12674
+ * disable server from sending down data for this track. this is useful when
12675
+ * the participant is off screen, you may disable streaming down their video
12676
+ * to reduce bandwidth requirements
12677
+ * @param enabled
12627
12678
  */
12628
12679
 
12629
12680
 
@@ -12635,12 +12686,12 @@ class RemoteTrackPublication extends TrackPublication {
12635
12686
  this.disabled = !enabled;
12636
12687
  this.emitTrackUpdate();
12637
12688
  }
12638
- /**
12639
- * for tracks that support simulcasting, adjust subscribed quality
12640
- *
12641
- * This indicates the highest quality the client can accept. if network
12642
- * bandwidth does not allow, server will automatically reduce quality to
12643
- * optimize for uninterrupted video
12689
+ /**
12690
+ * for tracks that support simulcasting, adjust subscribed quality
12691
+ *
12692
+ * This indicates the highest quality the client can accept. if network
12693
+ * bandwidth does not allow, server will automatically reduce quality to
12694
+ * optimize for uninterrupted video
12644
12695
  */
12645
12696
 
12646
12697
 
@@ -12800,8 +12851,8 @@ class RemoteParticipant extends Participant {
12800
12851
  return track;
12801
12852
  }
12802
12853
  }
12803
- /**
12804
- * sets the volume on the participant's microphone track if it exists.
12854
+ /**
12855
+ * sets the volume on the participant's microphone track if it exists.
12805
12856
  */
12806
12857
 
12807
12858
 
@@ -12812,9 +12863,9 @@ class RemoteParticipant extends Participant {
12812
12863
  audioPublication.track.setVolume(volume);
12813
12864
  }
12814
12865
  }
12815
- /**
12816
- * gets the volume on the participant's microphone track
12817
- * returns undefined if no microphone track exists
12866
+ /**
12867
+ * gets the volume on the participant's microphone track
12868
+ * returns undefined if no microphone track exists
12818
12869
  */
12819
12870
 
12820
12871
 
@@ -13123,31 +13174,31 @@ class LocalParticipant extends Participant {
13123
13174
  return track;
13124
13175
  }
13125
13176
  }
13126
- /**
13127
- * Enable or disable a participant's camera track.
13128
- *
13129
- * If a track has already published, it'll mute or unmute the track.
13130
- * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
13177
+ /**
13178
+ * Enable or disable a participant's camera track.
13179
+ *
13180
+ * If a track has already published, it'll mute or unmute the track.
13181
+ * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
13131
13182
  */
13132
13183
 
13133
13184
 
13134
13185
  setCameraEnabled(enabled) {
13135
13186
  return this.setTrackEnabled(Track.Source.Camera, enabled);
13136
13187
  }
13137
- /**
13138
- * Enable or disable a participant's microphone track.
13139
- *
13140
- * If a track has already published, it'll mute or unmute the track.
13141
- * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
13188
+ /**
13189
+ * Enable or disable a participant's microphone track.
13190
+ *
13191
+ * If a track has already published, it'll mute or unmute the track.
13192
+ * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
13142
13193
  */
13143
13194
 
13144
13195
 
13145
13196
  setMicrophoneEnabled(enabled) {
13146
13197
  return this.setTrackEnabled(Track.Source.Microphone, enabled);
13147
13198
  }
13148
- /**
13149
- * Start or stop sharing a participant's screen
13150
- * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
13199
+ /**
13200
+ * Start or stop sharing a participant's screen
13201
+ * Resolves with a `LocalTrackPublication` instance if successful and `undefined` otherwise
13151
13202
  */
13152
13203
 
13153
13204
 
@@ -13167,10 +13218,10 @@ class LocalParticipant extends Participant {
13167
13218
 
13168
13219
  return changed;
13169
13220
  }
13170
- /**
13171
- * Enable or disable publishing for a track by source. This serves as a simple
13172
- * way to manage the common tracks (camera, mic, or screen share).
13173
- * Resolves with LocalTrackPublication if successful and void otherwise
13221
+ /**
13222
+ * Enable or disable publishing for a track by source. This serves as a simple
13223
+ * way to manage the common tracks (camera, mic, or screen share).
13224
+ * Resolves with LocalTrackPublication if successful and void otherwise
13174
13225
  */
13175
13226
 
13176
13227
 
@@ -13243,9 +13294,9 @@ class LocalParticipant extends Participant {
13243
13294
 
13244
13295
  return track;
13245
13296
  }
13246
- /**
13247
- * Publish both camera and microphone at the same time. This is useful for
13248
- * displaying a single Permission Dialog box to the end user.
13297
+ /**
13298
+ * Publish both camera and microphone at the same time. This is useful for
13299
+ * displaying a single Permission Dialog box to the end user.
13249
13300
  */
13250
13301
 
13251
13302
 
@@ -13269,10 +13320,10 @@ class LocalParticipant extends Participant {
13269
13320
  this.pendingPublishing.delete(Track.Source.Microphone);
13270
13321
  }
13271
13322
  }
13272
- /**
13273
- * Create local camera and/or microphone tracks
13274
- * @param options
13275
- * @returns
13323
+ /**
13324
+ * Create local camera and/or microphone tracks
13325
+ * @param options
13326
+ * @returns
13276
13327
  */
13277
13328
 
13278
13329
 
@@ -13330,10 +13381,10 @@ class LocalParticipant extends Participant {
13330
13381
  return track;
13331
13382
  });
13332
13383
  }
13333
- /**
13334
- * Creates a screen capture tracks with getDisplayMedia().
13335
- * A LocalVideoTrack is always created and returned.
13336
- * If { audio: true }, and the browser supports audio capture, a LocalAudioTrack is also created.
13384
+ /**
13385
+ * Creates a screen capture tracks with getDisplayMedia().
13386
+ * A LocalVideoTrack is always created and returned.
13387
+ * If { audio: true }, and the browser supports audio capture, a LocalAudioTrack is also created.
13337
13388
  */
13338
13389
 
13339
13390
 
@@ -13382,10 +13433,10 @@ class LocalParticipant extends Participant {
13382
13433
 
13383
13434
  return localTracks;
13384
13435
  }
13385
- /**
13386
- * Publish a new track to the room
13387
- * @param track
13388
- * @param options
13436
+ /**
13437
+ * Publish a new track to the room
13438
+ * @param track
13439
+ * @param options
13389
13440
  */
13390
13441
 
13391
13442
 
@@ -13598,16 +13649,16 @@ class LocalParticipant extends Participant {
13598
13649
  });
13599
13650
  return publications;
13600
13651
  }
13601
- /**
13602
- * Publish a new data payload to the room. Data will be forwarded to each
13603
- * participant in the room if the destination argument is empty
13604
- *
13605
- * @param data Uint8Array of the payload. To send string data, use TextEncoder.encode
13606
- * @param kind whether to send this as reliable or lossy.
13607
- * For data that you need delivery guarantee (such as chat messages), use Reliable.
13608
- * For data that should arrive as quickly as possible, but you are ok with dropped
13609
- * packets, use Lossy.
13610
- * @param destination the participants who will receive the message
13652
+ /**
13653
+ * Publish a new data payload to the room. Data will be forwarded to each
13654
+ * participant in the room if the destination argument is empty
13655
+ *
13656
+ * @param data Uint8Array of the payload. To send string data, use TextEncoder.encode
13657
+ * @param kind whether to send this as reliable or lossy.
13658
+ * For data that you need delivery guarantee (such as chat messages), use Reliable.
13659
+ * For data that should arrive as quickly as possible, but you are ok with dropped
13660
+ * packets, use Lossy.
13661
+ * @param destination the participants who will receive the message
13611
13662
  */
13612
13663
 
13613
13664
 
@@ -13634,22 +13685,22 @@ class LocalParticipant extends Participant {
13634
13685
  };
13635
13686
  await this.engine.sendDataPacket(packet, kind);
13636
13687
  }
13637
- /**
13638
- * Control who can subscribe to LocalParticipant's published tracks.
13639
- *
13640
- * By default, all participants can subscribe. This allows fine-grained control over
13641
- * who is able to subscribe at a participant and track level.
13642
- *
13643
- * Note: if access is given at a track-level (i.e. both [allParticipantsAllowed] and
13644
- * [ParticipantTrackPermission.allTracksAllowed] are false), any newer published tracks
13645
- * will not grant permissions to any participants and will require a subsequent
13646
- * permissions update to allow subscription.
13647
- *
13648
- * @param allParticipantsAllowed Allows all participants to subscribe all tracks.
13649
- * Takes precedence over [[participantTrackPermissions]] if set to true.
13650
- * By default this is set to true.
13651
- * @param participantTrackPermissions Full list of individual permissions per
13652
- * participant/track. Any omitted participants will not receive any permissions.
13688
+ /**
13689
+ * Control who can subscribe to LocalParticipant's published tracks.
13690
+ *
13691
+ * By default, all participants can subscribe. This allows fine-grained control over
13692
+ * who is able to subscribe at a participant and track level.
13693
+ *
13694
+ * Note: if access is given at a track-level (i.e. both [allParticipantsAllowed] and
13695
+ * [ParticipantTrackPermission.allTracksAllowed] are false), any newer published tracks
13696
+ * will not grant permissions to any participants and will require a subsequent
13697
+ * permissions update to allow subscription.
13698
+ *
13699
+ * @param allParticipantsAllowed Allows all participants to subscribe all tracks.
13700
+ * Takes precedence over [[participantTrackPermissions]] if set to true.
13701
+ * By default this is set to true.
13702
+ * @param participantTrackPermissions Full list of individual permissions per
13703
+ * participant/track. Any omitted participants will not receive any permissions.
13653
13704
  */
13654
13705
 
13655
13706
 
@@ -18074,9 +18125,11 @@ class RTCEngine extends events.exports.EventEmitter {
18074
18125
  };
18075
18126
 
18076
18127
  let primaryPC = this.publisher.pc;
18128
+ let secondaryPC = this.subscriber.pc;
18077
18129
 
18078
18130
  if (joinResponse.subscriberPrimary) {
18079
- primaryPC = this.subscriber.pc; // in subscriber primary mode, server side opens sub data channels.
18131
+ primaryPC = this.subscriber.pc;
18132
+ secondaryPC = this.publisher.pc; // in subscriber primary mode, server side opens sub data channels.
18080
18133
 
18081
18134
  this.subscriber.pc.ondatachannel = this.handleDataChannel;
18082
18135
  }
@@ -18107,11 +18160,18 @@ class RTCEngine extends events.exports.EventEmitter {
18107
18160
  // on Safari, PeerConnection will switch to 'disconnected' during renegotiation
18108
18161
  if (this.pcState === PCState.Connected) {
18109
18162
  this.pcState = PCState.Disconnected;
18110
- this.handleDisconnect('peerconnection');
18163
+ this.handleDisconnect('primary peerconnection');
18111
18164
  }
18112
18165
  }
18113
18166
  };
18114
18167
 
18168
+ secondaryPC.onconnectionstatechange = async () => {
18169
+ // also reconnect if secondary peerconnection fails
18170
+ if (secondaryPC.connectionState === 'failed') {
18171
+ this.handleDisconnect('secondary peerconnection');
18172
+ }
18173
+ };
18174
+
18115
18175
  if (isWeb()) {
18116
18176
  this.subscriber.pc.ontrack = ev => {
18117
18177
  this.emit(EngineEvent.MediaTrackAdded, ev.track, ev.streams[0], ev.receiver);
@@ -18480,20 +18540,20 @@ var RoomState;
18480
18540
  RoomState["Connected"] = "connected";
18481
18541
  RoomState["Reconnecting"] = "reconnecting";
18482
18542
  })(RoomState || (RoomState = {}));
18483
- /**
18484
- * In LiveKit, a room is the logical grouping for a list of participants.
18485
- * Participants in a room can publish tracks, and subscribe to others' tracks.
18486
- *
18487
- * a Room fires [[RoomEvent | RoomEvents]].
18488
- *
18489
- * @noInheritDoc
18543
+ /**
18544
+ * In LiveKit, a room is the logical grouping for a list of participants.
18545
+ * Participants in a room can publish tracks, and subscribe to others' tracks.
18546
+ *
18547
+ * a Room fires [[RoomEvent | RoomEvents]].
18548
+ *
18549
+ * @noInheritDoc
18490
18550
  */
18491
18551
 
18492
18552
 
18493
18553
  class Room extends events.exports.EventEmitter {
18494
- /**
18495
- * Creates a new Room, the primary construct for a LiveKit session.
18496
- * @param options
18554
+ /**
18555
+ * Creates a new Room, the primary construct for a LiveKit session.
18556
+ * @param options
18497
18557
  */
18498
18558
  constructor(options) {
18499
18559
  var _this;
@@ -18503,9 +18563,9 @@ class Room extends events.exports.EventEmitter {
18503
18563
  super();
18504
18564
  _this = this;
18505
18565
  this.state = RoomState.Disconnected;
18506
- /**
18507
- * list of participants that are actively speaking. when this changes
18508
- * a [[RoomEvent.ActiveSpeakersChanged]] event is fired
18566
+ /**
18567
+ * list of participants that are actively speaking. when this changes
18568
+ * a [[RoomEvent.ActiveSpeakersChanged]] event is fired
18509
18569
  */
18510
18570
 
18511
18571
  this.activeSpeakers = []; // available after connected
@@ -18617,8 +18677,8 @@ class Room extends events.exports.EventEmitter {
18617
18677
  });
18618
18678
  });
18619
18679
  };
18620
- /**
18621
- * disconnects the room, emits [[RoomEvent.Disconnected]]
18680
+ /**
18681
+ * disconnects the room, emits [[RoomEvent.Disconnected]]
18622
18682
  */
18623
18683
 
18624
18684
 
@@ -18913,13 +18973,13 @@ class Room extends events.exports.EventEmitter {
18913
18973
  }
18914
18974
  }).on(EngineEvent.Restarting, this.handleRestarting).on(EngineEvent.Restarted, this.handleRestarted);
18915
18975
  }
18916
- /**
18917
- * getLocalDevices abstracts navigator.mediaDevices.enumerateDevices.
18918
- * In particular, it handles Chrome's unique behavior of creating `default`
18919
- * devices. When encountered, it'll be removed from the list of devices.
18920
- * The actual default device will be placed at top.
18921
- * @param kind
18922
- * @returns a list of available local devices
18976
+ /**
18977
+ * getLocalDevices abstracts navigator.mediaDevices.enumerateDevices.
18978
+ * In particular, it handles Chrome's unique behavior of creating `default`
18979
+ * devices. When encountered, it'll be removed from the list of devices.
18980
+ * The actual default device will be placed at top.
18981
+ * @param kind
18982
+ * @returns a list of available local devices
18923
18983
  */
18924
18984
 
18925
18985
 
@@ -18927,10 +18987,10 @@ class Room extends events.exports.EventEmitter {
18927
18987
  let requestPermissions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
18928
18988
  return DeviceManager.getInstance().getDevices(kind, requestPermissions);
18929
18989
  }
18930
- /**
18931
- * retrieves a participant by identity
18932
- * @param identity
18933
- * @returns
18990
+ /**
18991
+ * retrieves a participant by identity
18992
+ * @param identity
18993
+ * @returns
18934
18994
  */
18935
18995
 
18936
18996
 
@@ -18945,8 +19005,8 @@ class Room extends events.exports.EventEmitter {
18945
19005
  return this.localParticipant;
18946
19006
  }
18947
19007
  }
18948
- /**
18949
- * @internal for testing
19008
+ /**
19009
+ * @internal for testing
18950
19010
  */
18951
19011
 
18952
19012
 
@@ -18983,12 +19043,12 @@ class Room extends events.exports.EventEmitter {
18983
19043
  this.engine.client.sendSimulateScenario(req);
18984
19044
  }
18985
19045
  }
18986
- /**
18987
- * Browsers have different policies regarding audio playback. Most requiring
18988
- * some form of user interaction (click/tap/etc).
18989
- * In those cases, audio will be silent until a click/tap triggering one of the following
18990
- * - `startAudio`
18991
- * - `getUserMedia`
19046
+ /**
19047
+ * Browsers have different policies regarding audio playback. Most requiring
19048
+ * some form of user interaction (click/tap/etc).
19049
+ * In those cases, audio will be silent until a click/tap triggering one of the following
19050
+ * - `startAudio`
19051
+ * - `getUserMedia`
18992
19052
  */
18993
19053
 
18994
19054
 
@@ -19013,23 +19073,23 @@ class Room extends events.exports.EventEmitter {
19013
19073
  throw err;
19014
19074
  }
19015
19075
  }
19016
- /**
19017
- * Returns true if audio playback is enabled
19076
+ /**
19077
+ * Returns true if audio playback is enabled
19018
19078
  */
19019
19079
 
19020
19080
 
19021
19081
  get canPlaybackAudio() {
19022
19082
  return this.audioEnabled;
19023
19083
  }
19024
- /**
19025
- * Switches all active device used in this room to the given device.
19026
- *
19027
- * Note: setting AudioOutput is not supported on some browsers. See [setSinkId](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId#browser_compatibility)
19028
- *
19029
- * @param kind use `videoinput` for camera track,
19030
- * `audioinput` for microphone track,
19031
- * `audiooutput` to set speaker for all incoming audio tracks
19032
- * @param deviceId
19084
+ /**
19085
+ * Switches all active device used in this room to the given device.
19086
+ *
19087
+ * Note: setting AudioOutput is not supported on some browsers. See [setSinkId](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId#browser_compatibility)
19088
+ *
19089
+ * @param kind use `videoinput` for camera track,
19090
+ * `audioinput` for microphone track,
19091
+ * `audiooutput` to set speaker for all incoming audio tracks
19092
+ * @param deviceId
19033
19093
  */
19034
19094
 
19035
19095
 
@@ -19225,10 +19285,10 @@ class Room extends events.exports.EventEmitter {
19225
19285
  }
19226
19286
 
19227
19287
  const previousSdp = this.engine.subscriber.pc.localDescription;
19228
- /* 1. autosubscribe on, so subscribed tracks = all tracks - unsub tracks,
19229
- in this case, we send unsub tracks, so server add all tracks to this
19230
- subscribe pc and unsub special tracks from it.
19231
- 2. autosubscribe off, we send subscribed tracks.
19288
+ /* 1. autosubscribe on, so subscribed tracks = all tracks - unsub tracks,
19289
+ in this case, we send unsub tracks, so server add all tracks to this
19290
+ subscribe pc and unsub special tracks from it.
19291
+ 2. autosubscribe off, we send subscribed tracks.
19232
19292
  */
19233
19293
 
19234
19294
  const sendUnsub = ((_a = this.connOptions) === null || _a === void 0 ? void 0 : _a.autoSubscribe) || false;
@@ -19254,9 +19314,9 @@ class Room extends events.exports.EventEmitter {
19254
19314
  dataChannels: this.localParticipant.dataChannelsInfo()
19255
19315
  });
19256
19316
  }
19257
- /**
19258
- * After resuming, we'll need to notify the server of the current
19259
- * subscription settings.
19317
+ /**
19318
+ * After resuming, we'll need to notify the server of the current
19319
+ * subscription settings.
19260
19320
  */
19261
19321
 
19262
19322
 
@@ -19285,24 +19345,24 @@ class Room extends events.exports.EventEmitter {
19285
19345
 
19286
19346
  }
19287
19347
 
19288
- /**
19289
- * @deprecated Use room.connect() instead
19290
- *
19291
- * Connects to a LiveKit room, shorthand for `new Room()` and [[Room.connect]]
19292
- *
19293
- * ```typescript
19294
- * connect('wss://myhost.livekit.io', token, {
19295
- * // publish audio and video tracks on joining
19296
- * audio: true,
19297
- * video: true,
19298
- * captureDefaults: {
19299
- * facingMode: 'user',
19300
- * },
19301
- * })
19302
- * ```
19303
- * @param url URL to LiveKit server
19304
- * @param token AccessToken, a JWT token that includes authentication and room details
19305
- * @param options
19348
+ /**
19349
+ * @deprecated Use room.connect() instead
19350
+ *
19351
+ * Connects to a LiveKit room, shorthand for `new Room()` and [[Room.connect]]
19352
+ *
19353
+ * ```typescript
19354
+ * connect('wss://myhost.livekit.io', token, {
19355
+ * // publish audio and video tracks on joining
19356
+ * audio: true,
19357
+ * video: true,
19358
+ * captureDefaults: {
19359
+ * facingMode: 'user',
19360
+ * },
19361
+ * })
19362
+ * ```
19363
+ * @param url URL to LiveKit server
19364
+ * @param token AccessToken, a JWT token that includes authentication and room details
19365
+ * @param options
19306
19366
  */
19307
19367
 
19308
19368
  async function connect(url, token, options) {
@@ -19380,11 +19440,11 @@ async function connect(url, token, options) {
19380
19440
  return room;
19381
19441
  }
19382
19442
 
19383
- /**
19384
- * Creates a local video and audio track at the same time. When acquiring both
19385
- * audio and video tracks together, it'll display a single permission prompt to
19386
- * the user instead of two separate ones.
19387
- * @param options
19443
+ /**
19444
+ * Creates a local video and audio track at the same time. When acquiring both
19445
+ * audio and video tracks together, it'll display a single permission prompt to
19446
+ * the user instead of two separate ones.
19447
+ * @param options
19388
19448
  */
19389
19449
 
19390
19450
  async function createLocalTracks(options) {
@@ -19420,9 +19480,9 @@ async function createLocalTracks(options) {
19420
19480
  return track;
19421
19481
  });
19422
19482
  }
19423
- /**
19424
- * Creates a [[LocalVideoTrack]] with getUserMedia()
19425
- * @param options
19483
+ /**
19484
+ * Creates a [[LocalVideoTrack]] with getUserMedia()
19485
+ * @param options
19426
19486
  */
19427
19487
 
19428
19488
  async function createLocalVideoTrack(options) {
@@ -19439,10 +19499,10 @@ async function createLocalAudioTrack(options) {
19439
19499
  });
19440
19500
  return tracks[0];
19441
19501
  }
19442
- /**
19443
- * Creates a screen capture tracks with getDisplayMedia().
19444
- * A LocalVideoTrack is always created and returned.
19445
- * If { audio: true }, and the browser supports audio capture, a LocalAudioTrack is also created.
19502
+ /**
19503
+ * Creates a screen capture tracks with getDisplayMedia().
19504
+ * A LocalVideoTrack is always created and returned.
19505
+ * If { audio: true }, and the browser supports audio capture, a LocalAudioTrack is also created.
19446
19506
  */
19447
19507
 
19448
19508
  async function createLocalScreenTracks(options) {