livekit-client 0.17.6-rc3 → 0.18.2

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.
@@ -7,10 +7,12 @@ interface ConnectOpts {
7
7
  /** internal */
8
8
  reconnect?: boolean;
9
9
  publishOnly?: string;
10
+ adaptiveStream?: boolean;
10
11
  }
11
12
  export interface SignalOptions {
12
13
  autoSubscribe?: boolean;
13
14
  publishOnly?: string;
15
+ adaptiveStream?: boolean;
14
16
  }
15
17
  /** @internal */
16
18
  export declare class SignalClient {
@@ -8624,6 +8624,10 @@ var TrackEvent;
8624
8624
  TrackEvent["VisibilityChanged"] = "visibilityChanged";
8625
8625
  /** @internal */
8626
8626
  TrackEvent["VideoDimensionsChanged"] = "videoDimensionsChanged";
8627
+ /** @internal */
8628
+ TrackEvent["ElementAttached"] = "elementAttached";
8629
+ /** @internal */
8630
+ TrackEvent["ElementDetached"] = "elementDetached";
8627
8631
  })(TrackEvent || (TrackEvent = {}));
8628
8632
 
8629
8633
  const monitorFrequency = 2000;
@@ -8710,7 +8714,7 @@ class DeviceManager {
8710
8714
  }
8711
8715
  DeviceManager.mediaDeviceKinds = ['audioinput', 'audiooutput', 'videoinput'];
8712
8716
 
8713
- const version = '0.17.5';
8717
+ const version = '0.18.2';
8714
8718
  const protocolVersion = 7;
8715
8719
 
8716
8720
  const separator = '|';
@@ -9287,6 +9291,7 @@ class Track extends events.exports.EventEmitter {
9287
9291
  this.emit(TrackEvent.AudioPlaybackFailed, e);
9288
9292
  });
9289
9293
  }
9294
+ this.emit(TrackEvent.ElementAttached, element);
9290
9295
  return element;
9291
9296
  }
9292
9297
  detach(element) {
@@ -9297,6 +9302,7 @@ class Track extends events.exports.EventEmitter {
9297
9302
  if (idx >= 0) {
9298
9303
  this.attachedElements.splice(idx, 1);
9299
9304
  this.recycleElement(element);
9305
+ this.emit(TrackEvent.ElementDetached, element);
9300
9306
  }
9301
9307
  return element;
9302
9308
  }
@@ -9305,6 +9311,7 @@ class Track extends events.exports.EventEmitter {
9305
9311
  detachTrack(this.mediaStreamTrack, elm);
9306
9312
  detached.push(elm);
9307
9313
  this.recycleElement(elm);
9314
+ this.emit(TrackEvent.ElementDetached, elm);
9308
9315
  });
9309
9316
  // remove all tracks
9310
9317
  this.attachedElements = [];
@@ -11786,8 +11793,8 @@ class LocalParticipant extends Participant {
11786
11793
  this.videoTracks.delete(publication.trackSid);
11787
11794
  break;
11788
11795
  }
11789
- publication.setTrack(undefined);
11790
11796
  this.emit(ParticipantEvent.LocalTrackUnpublished, publication);
11797
+ publication.setTrack(undefined);
11791
11798
  return publication;
11792
11799
  }
11793
11800
  unpublishTracks(tracks) {
@@ -15486,6 +15493,7 @@ class SignalClient {
15486
15493
  const res = await this.connect(url, token, {
15487
15494
  autoSubscribe: opts?.autoSubscribe,
15488
15495
  publishOnly: opts?.publishOnly,
15496
+ adaptiveStream: opts?.adaptiveStream,
15489
15497
  });
15490
15498
  return res;
15491
15499
  }
@@ -15829,6 +15837,9 @@ function createConnectionParams(token, info, opts) {
15829
15837
  if (opts?.publishOnly !== undefined) {
15830
15838
  params.set('publish', opts.publishOnly);
15831
15839
  }
15840
+ if (opts?.adaptiveStream) {
15841
+ params.set('adaptive_stream', '1');
15842
+ }
15832
15843
  return `?${params.toString()}`;
15833
15844
  }
15834
15845
 
@@ -16501,7 +16512,11 @@ class Room extends events.exports.EventEmitter {
16501
16512
  }
16502
16513
  this.connOptions = opts;
16503
16514
  try {
16504
- const joinResponse = await this.engine.join(url, token, opts);
16515
+ const joinResponse = await this.engine.join(url, token, {
16516
+ autoSubscribe: opts?.autoSubscribe,
16517
+ publishOnly: opts?.publishOnly,
16518
+ adaptiveStream: typeof this.options?.adaptiveStream === 'object' ? true : this.options?.adaptiveStream,
16519
+ });
16505
16520
  livekitLogger.debug(`connected to Livekit Server version: ${joinResponse.serverVersion}, region: ${joinResponse.serverRegion}`);
16506
16521
  if (!joinResponse.serverVersion) {
16507
16522
  throw new UnsupportedServer('unknown server version');