livekit-client 2.12.0 → 2.13.0
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.
- package/dist/livekit-client.esm.mjs +56 -8
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +1 -0
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +11 -1
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +13 -0
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/ts4.2/src/room/Room.d.ts +1 -0
- package/dist/ts4.2/src/room/events.d.ts +11 -1
- package/dist/ts4.2/src/room/participant/Participant.d.ts +13 -0
- package/package.json +1 -1
- package/src/room/RTCEngine.ts +1 -2
- package/src/room/Room.ts +5 -0
- package/src/room/events.ts +12 -0
- package/src/room/participant/LocalParticipant.ts +1 -0
- package/src/room/participant/Participant.ts +47 -2
- package/src/room/track/create.ts +3 -5
@@ -10763,6 +10763,12 @@ var RoomEvent;
|
|
10763
10763
|
* args: (changedAttributes: [[Record<string, string]], participant: [[Participant]])
|
10764
10764
|
*/
|
10765
10765
|
RoomEvent["ParticipantAttributesChanged"] = "participantAttributesChanged";
|
10766
|
+
/**
|
10767
|
+
* Emitted when the participant's state changes to ACTIVE and is ready to send/receive data messages
|
10768
|
+
*
|
10769
|
+
* args: (participant: [[Participant]])
|
10770
|
+
*/
|
10771
|
+
RoomEvent["ParticipantActive"] = "participantActive";
|
10766
10772
|
/**
|
10767
10773
|
* Room metadata is a simple way for app-specific state to be pushed to
|
10768
10774
|
* all users.
|
@@ -11057,6 +11063,10 @@ var ParticipantEvent;
|
|
11057
11063
|
ParticipantEvent["LocalTrackSubscribed"] = "localTrackSubscribed";
|
11058
11064
|
/** only emitted on local participant */
|
11059
11065
|
ParticipantEvent["ChatMessage"] = "chatMessage";
|
11066
|
+
/**
|
11067
|
+
* Emitted when the participant's state changes to ACTIVE and is ready to send/receive data messages
|
11068
|
+
*/
|
11069
|
+
ParticipantEvent["Active"] = "active";
|
11060
11070
|
})(ParticipantEvent || (ParticipantEvent = {}));
|
11061
11071
|
/** @internal */
|
11062
11072
|
var EngineEvent;
|
@@ -11249,7 +11259,7 @@ function getOSVersion(ua) {
|
|
11249
11259
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
11250
11260
|
}
|
11251
11261
|
|
11252
|
-
var version$1 = "2.
|
11262
|
+
var version$1 = "2.13.0";
|
11253
11263
|
|
11254
11264
|
const version = version$1;
|
11255
11265
|
const protocolVersion = 16;
|
@@ -17794,8 +17804,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
17794
17804
|
}
|
17795
17805
|
// create data channels
|
17796
17806
|
this.lossyDC = this.pcManager.createPublisherDataChannel(lossyDataChannel, {
|
17797
|
-
|
17798
|
-
ordered: true,
|
17807
|
+
ordered: false,
|
17799
17808
|
maxRetransmits: 0
|
17800
17809
|
});
|
17801
17810
|
this.reliableDC = this.pcManager.createPublisherDataChannel(reliableDataChannel, {
|
@@ -19576,16 +19585,17 @@ function createLocalTracks(options, loggerOptions) {
|
|
19576
19585
|
}
|
19577
19586
|
});
|
19578
19587
|
}
|
19579
|
-
// TODO if internal options don't have device Id specified, set it to 'default'
|
19580
19588
|
if (internalOptions.audio === true || typeof internalOptions.audio === 'object' && !internalOptions.audio.deviceId) {
|
19581
19589
|
internalOptions.audio = {
|
19582
19590
|
deviceId: 'default'
|
19583
19591
|
};
|
19584
19592
|
}
|
19585
|
-
if (internalOptions.video === true
|
19593
|
+
if (internalOptions.video === true) {
|
19586
19594
|
internalOptions.video = {
|
19587
19595
|
deviceId: 'default'
|
19588
19596
|
};
|
19597
|
+
} else if (typeof internalOptions.video === 'object' && !internalOptions.video.deviceId) {
|
19598
|
+
internalOptions.video.deviceId = 'default';
|
19589
19599
|
}
|
19590
19600
|
const opts = mergeDefaultOptions(internalOptions, audioDefaults, videoDefaults);
|
19591
19601
|
const constraints = constraintsForOptions(opts);
|
@@ -19742,6 +19752,10 @@ class Participant extends eventsExports.EventEmitter {
|
|
19742
19752
|
var _a;
|
19743
19753
|
return ((_a = this.permissions) === null || _a === void 0 ? void 0 : _a.agent) || this.kind === ParticipantInfo_Kind.AGENT;
|
19744
19754
|
}
|
19755
|
+
get isActive() {
|
19756
|
+
var _a;
|
19757
|
+
return ((_a = this.participantInfo) === null || _a === void 0 ? void 0 : _a.state) === ParticipantInfo_State.ACTIVE;
|
19758
|
+
}
|
19745
19759
|
get kind() {
|
19746
19760
|
return this._kind;
|
19747
19761
|
}
|
@@ -19797,6 +19811,25 @@ class Participant extends eventsExports.EventEmitter {
|
|
19797
19811
|
}
|
19798
19812
|
}
|
19799
19813
|
}
|
19814
|
+
/**
|
19815
|
+
* Waits until the participant is active and ready to receive data messages
|
19816
|
+
* @returns a promise that resolves when the participant is active
|
19817
|
+
*/
|
19818
|
+
waitUntilActive() {
|
19819
|
+
if (this.isActive) {
|
19820
|
+
return Promise.resolve();
|
19821
|
+
}
|
19822
|
+
if (this.activeFuture) {
|
19823
|
+
return this.activeFuture.promise;
|
19824
|
+
}
|
19825
|
+
this.activeFuture = new Future();
|
19826
|
+
this.once(ParticipantEvent.Active, () => {
|
19827
|
+
var _a, _b;
|
19828
|
+
(_b = (_a = this.activeFuture) === null || _a === void 0 ? void 0 : _a.resolve) === null || _b === void 0 ? void 0 : _b.call(_a);
|
19829
|
+
this.activeFuture = undefined;
|
19830
|
+
});
|
19831
|
+
return this.activeFuture.promise;
|
19832
|
+
}
|
19800
19833
|
get connectionQuality() {
|
19801
19834
|
return this._connectionQuality;
|
19802
19835
|
}
|
@@ -19826,6 +19859,7 @@ class Participant extends eventsExports.EventEmitter {
|
|
19826
19859
|
}
|
19827
19860
|
/** @internal */
|
19828
19861
|
updateInfo(info) {
|
19862
|
+
var _a;
|
19829
19863
|
// it's possible the update could be applied out of order due to await
|
19830
19864
|
// during reconnect sequences. when that happens, it's possible for server
|
19831
19865
|
// to have sent more recent version of participant info while JS is waiting
|
@@ -19840,14 +19874,14 @@ class Participant extends eventsExports.EventEmitter {
|
|
19840
19874
|
this._setName(info.name);
|
19841
19875
|
this._setMetadata(info.metadata);
|
19842
19876
|
this._setAttributes(info.attributes);
|
19877
|
+
if (info.state === ParticipantInfo_State.ACTIVE && ((_a = this.participantInfo) === null || _a === void 0 ? void 0 : _a.state) !== ParticipantInfo_State.ACTIVE) {
|
19878
|
+
this.emit(ParticipantEvent.Active);
|
19879
|
+
}
|
19843
19880
|
if (info.permission) {
|
19844
19881
|
this.setPermissions(info.permission);
|
19845
19882
|
}
|
19846
19883
|
// set this last so setMetadata can detect changes
|
19847
19884
|
this.participantInfo = info;
|
19848
|
-
this.log.trace('update participant info', Object.assign(Object.assign({}, this.logContext), {
|
19849
|
-
info
|
19850
|
-
}));
|
19851
19885
|
return true;
|
19852
19886
|
}
|
19853
19887
|
/**
|
@@ -19911,6 +19945,16 @@ class Participant extends eventsExports.EventEmitter {
|
|
19911
19945
|
this.emit(ParticipantEvent.ConnectionQualityChanged, this._connectionQuality);
|
19912
19946
|
}
|
19913
19947
|
}
|
19948
|
+
/**
|
19949
|
+
* @internal
|
19950
|
+
*/
|
19951
|
+
setDisconnected() {
|
19952
|
+
var _a, _b;
|
19953
|
+
if (this.activeFuture) {
|
19954
|
+
(_b = (_a = this.activeFuture).reject) === null || _b === void 0 ? void 0 : _b.call(_a, new Error('Participant disconnected'));
|
19955
|
+
this.activeFuture = undefined;
|
19956
|
+
}
|
19957
|
+
}
|
19914
19958
|
/**
|
19915
19959
|
* @internal
|
19916
19960
|
*/
|
@@ -21437,6 +21481,7 @@ class LocalParticipant extends Participant {
|
|
21437
21481
|
streamId,
|
21438
21482
|
topic: info.topic,
|
21439
21483
|
timestamp: numberToBigInt(Date.now()),
|
21484
|
+
attributes: info.attributes,
|
21440
21485
|
contentHeader: {
|
21441
21486
|
case: 'byteHeader',
|
21442
21487
|
value: new DataStream_ByteHeader({
|
@@ -23741,6 +23786,7 @@ class Room extends eventsExports.EventEmitter {
|
|
23741
23786
|
participant.unpublishTrack(publication.trackSid, true);
|
23742
23787
|
});
|
23743
23788
|
this.emit(RoomEvent.ParticipantDisconnected, participant);
|
23789
|
+
participant.setDisconnected();
|
23744
23790
|
(_a = this.localParticipant) === null || _a === void 0 ? void 0 : _a.handleParticipantDisconnected(participant.identity);
|
23745
23791
|
}
|
23746
23792
|
handleStreamHeader(streamHeader, participantIdentity) {
|
@@ -23947,6 +23993,8 @@ class Room extends eventsExports.EventEmitter {
|
|
23947
23993
|
this.emit(RoomEvent.TrackSubscriptionFailed, trackSid, participant, error);
|
23948
23994
|
}).on(ParticipantEvent.TrackSubscriptionPermissionChanged, (pub, status) => {
|
23949
23995
|
this.emitWhenConnected(RoomEvent.TrackSubscriptionPermissionChanged, pub, status, participant);
|
23996
|
+
}).on(ParticipantEvent.Active, () => {
|
23997
|
+
this.emitWhenConnected(RoomEvent.ParticipantActive, participant);
|
23950
23998
|
});
|
23951
23999
|
// update info at the end after callbacks have been set up
|
23952
24000
|
if (info) {
|