livekit-client 2.0.0 → 2.0.1

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.
@@ -1208,6 +1208,7 @@ export class LeaveRequest extends Message<LeaveRequest> {
1208
1208
  /**
1209
1209
  * sent when server initiates the disconnect due to server-restart
1210
1210
  * indicates clients should attempt full-reconnect sequence
1211
+ * NOTE: `can_reconnect` obsoleted by `action` starting in protocol version 13
1211
1212
  *
1212
1213
  * @generated from field: bool can_reconnect = 1;
1213
1214
  */
@@ -1218,6 +1219,16 @@ export class LeaveRequest extends Message<LeaveRequest> {
1218
1219
  */
1219
1220
  reason = DisconnectReason.UNKNOWN_REASON;
1220
1221
 
1222
+ /**
1223
+ * @generated from field: livekit.LeaveRequest.Action action = 3;
1224
+ */
1225
+ action = LeaveRequest_Action.DISCONNECT;
1226
+
1227
+ /**
1228
+ * @generated from field: livekit.RegionSettings regions = 4;
1229
+ */
1230
+ regions?: RegionSettings;
1231
+
1221
1232
  constructor(data?: PartialMessage<LeaveRequest>) {
1222
1233
  super();
1223
1234
  proto3.util.initPartial(data, this);
@@ -1228,6 +1239,8 @@ export class LeaveRequest extends Message<LeaveRequest> {
1228
1239
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
1229
1240
  { no: 1, name: "can_reconnect", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
1230
1241
  { no: 2, name: "reason", kind: "enum", T: proto3.getEnumType(DisconnectReason) },
1242
+ { no: 3, name: "action", kind: "enum", T: proto3.getEnumType(LeaveRequest_Action) },
1243
+ { no: 4, name: "regions", kind: "message", T: RegionSettings },
1231
1244
  ]);
1232
1245
 
1233
1246
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): LeaveRequest {
@@ -1247,6 +1260,40 @@ export class LeaveRequest extends Message<LeaveRequest> {
1247
1260
  }
1248
1261
  }
1249
1262
 
1263
+ /**
1264
+ * indicates action clients should take on receiving this message
1265
+ *
1266
+ * @generated from enum livekit.LeaveRequest.Action
1267
+ */
1268
+ export enum LeaveRequest_Action {
1269
+ /**
1270
+ * should disconnect
1271
+ *
1272
+ * @generated from enum value: DISCONNECT = 0;
1273
+ */
1274
+ DISCONNECT = 0,
1275
+
1276
+ /**
1277
+ * should attempt a resume with `reconnect=1` in join URL
1278
+ *
1279
+ * @generated from enum value: RESUME = 1;
1280
+ */
1281
+ RESUME = 1,
1282
+
1283
+ /**
1284
+ * should attempt a reconnect, i. e. no `reconnect=1`
1285
+ *
1286
+ * @generated from enum value: RECONNECT = 2;
1287
+ */
1288
+ RECONNECT = 2,
1289
+ }
1290
+ // Retrieve enum metadata with: proto3.getEnumType(LeaveRequest_Action)
1291
+ proto3.util.setEnumType(LeaveRequest_Action, "livekit.LeaveRequest.Action", [
1292
+ { no: 0, name: "DISCONNECT" },
1293
+ { no: 1, name: "RESUME" },
1294
+ { no: 2, name: "RECONNECT" },
1295
+ ]);
1296
+
1250
1297
  /**
1251
1298
  * message to indicate published video track dimensions are changing
1252
1299
  *
@@ -1947,6 +1994,11 @@ export class SyncState extends Message<SyncState> {
1947
1994
  */
1948
1995
  offer?: SessionDescription;
1949
1996
 
1997
+ /**
1998
+ * @generated from field: repeated string track_sids_disabled = 6;
1999
+ */
2000
+ trackSidsDisabled: string[] = [];
2001
+
1950
2002
  constructor(data?: PartialMessage<SyncState>) {
1951
2003
  super();
1952
2004
  proto3.util.initPartial(data, this);
@@ -1960,6 +2012,7 @@ export class SyncState extends Message<SyncState> {
1960
2012
  { no: 3, name: "publish_tracks", kind: "message", T: TrackPublishedResponse, repeated: true },
1961
2013
  { no: 4, name: "data_channels", kind: "message", T: DataChannelInfo, repeated: true },
1962
2014
  { no: 5, name: "offer", kind: "message", T: SessionDescription },
2015
+ { no: 6, name: "track_sids_disabled", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
1963
2016
  ]);
1964
2017
 
1965
2018
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SyncState {
@@ -5,7 +5,7 @@ import { debounce } from 'ts-debounce';
5
5
  import log, { LoggerNames, getLogger } from '../logger';
6
6
  import { NegotiationError, UnexpectedConnectionState } from './errors';
7
7
  import type { LoggerOptions } from './types';
8
- import { ddExtensionURI, isChromiumBased, isSVCCodec } from './utils';
8
+ import { ddExtensionURI, isSVCCodec } from './utils';
9
9
 
10
10
  /** @internal */
11
11
  interface TrackBitrateInfo {
@@ -42,8 +42,6 @@ export default class PCTransport extends EventEmitter {
42
42
 
43
43
  private config?: RTCConfiguration;
44
44
 
45
- private mediaConstraints: Record<string, unknown>;
46
-
47
45
  private log = log;
48
46
 
49
47
  private loggerOptions: LoggerOptions;
@@ -76,24 +74,16 @@ export default class PCTransport extends EventEmitter {
76
74
 
77
75
  onTrack?: (ev: RTCTrackEvent) => void;
78
76
 
79
- constructor(
80
- config?: RTCConfiguration,
81
- mediaConstraints: Record<string, unknown> = {},
82
- loggerOptions: LoggerOptions = {},
83
- ) {
77
+ constructor(config?: RTCConfiguration, loggerOptions: LoggerOptions = {}) {
84
78
  super();
85
79
  this.log = getLogger(loggerOptions.loggerName ?? LoggerNames.PCTransport);
86
80
  this.loggerOptions = loggerOptions;
87
81
  this.config = config;
88
- this.mediaConstraints = mediaConstraints;
89
82
  this._pc = this.createPC();
90
83
  }
91
84
 
92
85
  private createPC() {
93
- const pc = isChromiumBased()
94
- ? // @ts-expect-error chrome allows additional media constraints to be passed into the RTCPeerConnection constructor
95
- new RTCPeerConnection(this.config, this.mediaConstraints)
96
- : new RTCPeerConnection(this.config);
86
+ const pc = new RTCPeerConnection(this.config);
97
87
 
98
88
  pc.onicecandidate = (ev) => {
99
89
  if (!ev.candidate) return;
@@ -71,8 +71,7 @@ export class PCTransportManager {
71
71
 
72
72
  this.isPublisherConnectionRequired = !subscriberPrimary;
73
73
  this.isSubscriberConnectionRequired = subscriberPrimary;
74
- const googConstraints = { optional: [{ googDscp: true }] };
75
- this.publisher = new PCTransport(rtcConfig, googConstraints, loggerOptions);
74
+ this.publisher = new PCTransport(rtcConfig, loggerOptions);
76
75
  this.subscriber = new PCTransport(rtcConfig, loggerOptions);
77
76
 
78
77
  this.publisher.onConnectionStateChange = this.updateState;
@@ -1271,11 +1271,15 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
1271
1271
  */
1272
1272
  const autoSubscribe = this.signalOpts?.autoSubscribe ?? true;
1273
1273
  const trackSids = new Array<string>();
1274
+ const trackSidsDisabled = new Array<string>();
1274
1275
 
1275
1276
  remoteTracks.forEach((track) => {
1276
1277
  if (track.isDesired !== autoSubscribe) {
1277
1278
  trackSids.push(track.trackSid);
1278
1279
  }
1280
+ if (!track.isEnabled) {
1281
+ trackSidsDisabled.push(track.trackSid);
1282
+ }
1279
1283
  });
1280
1284
 
1281
1285
  this.client.sendSyncState(
@@ -1299,6 +1303,7 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
1299
1303
  }),
1300
1304
  publishTracks: getTrackPublicationInfo(localTracks),
1301
1305
  dataChannels: this.dataChannelsInfo(),
1306
+ trackSidsDisabled,
1302
1307
  }),
1303
1308
  );
1304
1309
  }
@@ -27,7 +27,14 @@ export enum RoomEvent {
27
27
 
28
28
  /**
29
29
  * When disconnected from room. This fires when room.disconnect() is called or
30
- * when an unrecoverable connection issue had occured
30
+ * when an unrecoverable connection issue had occured.
31
+ *
32
+ * DisconnectReason can be used to determine why the participant was disconnected. Notable reasons are
33
+ * - DUPLICATE_IDENTITY: another client with the same identity has joined the room
34
+ * - PARTICIPANT_REMOVED: participant was removed by RemoveParticipant API
35
+ * - ROOM_DELETED: the room has ended via DeleteRoom API
36
+ *
37
+ * args: ([[DisconnectReason]])
31
38
  */
32
39
  Disconnected = 'disconnected',
33
40