livekit-client 1.15.10 → 1.15.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/livekit-client.esm.mjs +34 -18
- 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/api/SignalClient.d.ts +1 -1
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +2 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +1 -1
- package/dist/ts4.2/src/room/Room.d.ts +2 -1
- package/package.json +1 -1
- package/src/api/SignalClient.ts +8 -4
- package/src/room/Room.ts +26 -17
@@ -76,7 +76,7 @@ export declare class SignalClient {
|
|
76
76
|
private connect;
|
77
77
|
/** @internal */
|
78
78
|
resetCallbacks: () => void;
|
79
|
-
close(): Promise<void>;
|
79
|
+
close(updateState?: boolean): Promise<void>;
|
80
80
|
sendOffer(offer: RTCSessionDescriptionInit): void;
|
81
81
|
sendAnswer(answer: RTCSessionDescriptionInit): Promise<void>;
|
82
82
|
sendIceCandidate(candidate: RTCIceCandidateInit, target: SignalTarget): Promise<void>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SignalClient.d.ts","sourceRoot":"","sources":["../../../src/api/SignalClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,eAAe,EACf,eAAe,EACf,IAAI,EACJ,WAAW,EACX,UAAU,EACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,YAAY,EAGZ,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EAEb,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EAEvB,4BAA4B,EAC5B,oBAAoB,EACpB,SAAS,EACT,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EAGxB,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,K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AAM,EAAE,UAAU,EAAE;IAU5D,iCAAiC,CAAC,eAAe,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE;IAU/F,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB;IAO/C,QAAQ;IAiBR,SAAS;IAUH,WAAW,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,GAAE,OAAe;IAqCpE,OAAO,CAAC,oBAAoB;IAyF5B,cAAc;YASA,aAAa;IAU3B,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiBxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,iBAAiB;CAO1B;AAoBD,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,qBAAqB,GAAG,yBAAyB,GACrD,kBAAkB,CAMpB"}
|
package/dist/src/room/Room.d.ts
CHANGED
@@ -59,12 +59,12 @@ declare class Room extends Room_base {
|
|
59
59
|
private connectFuture?;
|
60
60
|
private disconnectLock;
|
61
61
|
private e2eeManager;
|
62
|
-
private cachedParticipantSids;
|
63
62
|
private connectionReconcileInterval?;
|
64
63
|
private regionUrlProvider?;
|
65
64
|
private regionUrl?;
|
66
65
|
private isVideoPlaybackBlocked;
|
67
66
|
private log;
|
67
|
+
private bufferedEvents;
|
68
68
|
/**
|
69
69
|
* Creates a new Room, the primary construct for a LiveKit session.
|
70
70
|
* @param options
|
@@ -196,6 +196,7 @@ declare class Room extends Room_base {
|
|
196
196
|
private registerConnectionReconcile;
|
197
197
|
private clearConnectionReconcile;
|
198
198
|
private setAndEmitConnectionState;
|
199
|
+
private emitBufferedEvents;
|
199
200
|
private emitWhenConnected;
|
200
201
|
private onLocalParticipantMetadataChanged;
|
201
202
|
private onLocalParticipantNameChanged;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Room.d.ts","sourceRoot":"","sources":["../../../src/room/Room.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,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,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;IACvE,mBAAmB,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACxE,CAAC"}
|
@@ -76,7 +76,7 @@ export declare class SignalClient {
|
|
76
76
|
private connect;
|
77
77
|
/** @internal */
|
78
78
|
resetCallbacks: () => void;
|
79
|
-
close(): Promise<void>;
|
79
|
+
close(updateState?: boolean): Promise<void>;
|
80
80
|
sendOffer(offer: RTCSessionDescriptionInit): void;
|
81
81
|
sendAnswer(answer: RTCSessionDescriptionInit): Promise<void>;
|
82
82
|
sendIceCandidate(candidate: RTCIceCandidateInit, target: SignalTarget): Promise<void>;
|
@@ -59,12 +59,12 @@ declare class Room extends Room_base {
|
|
59
59
|
private connectFuture?;
|
60
60
|
private disconnectLock;
|
61
61
|
private e2eeManager;
|
62
|
-
private cachedParticipantSids;
|
63
62
|
private connectionReconcileInterval?;
|
64
63
|
private regionUrlProvider?;
|
65
64
|
private regionUrl?;
|
66
65
|
private isVideoPlaybackBlocked;
|
67
66
|
private log;
|
67
|
+
private bufferedEvents;
|
68
68
|
/**
|
69
69
|
* Creates a new Room, the primary construct for a LiveKit session.
|
70
70
|
* @param options
|
@@ -196,6 +196,7 @@ declare class Room extends Room_base {
|
|
196
196
|
private registerConnectionReconcile;
|
197
197
|
private clearConnectionReconcile;
|
198
198
|
private setAndEmitConnectionState;
|
199
|
+
private emitBufferedEvents;
|
199
200
|
private emitWhenConnected;
|
200
201
|
private onLocalParticipantMetadataChanged;
|
201
202
|
private onLocalParticipantNameChanged;
|
package/package.json
CHANGED
package/src/api/SignalClient.ts
CHANGED
@@ -274,7 +274,7 @@ export class SignalClient {
|
|
274
274
|
abortSignal?.addEventListener('abort', abortHandler);
|
275
275
|
this.log.debug(`connecting to ${url + params}`, this.logContext);
|
276
276
|
if (this.ws) {
|
277
|
-
await this.close();
|
277
|
+
await this.close(false);
|
278
278
|
}
|
279
279
|
this.ws = new WebSocket(url + params);
|
280
280
|
this.ws.binaryType = 'arraybuffer';
|
@@ -421,10 +421,12 @@ export class SignalClient {
|
|
421
421
|
this.onClose = undefined;
|
422
422
|
};
|
423
423
|
|
424
|
-
async close() {
|
424
|
+
async close(updateState: boolean = true) {
|
425
425
|
const unlock = await this.closingLock.lock();
|
426
426
|
try {
|
427
|
-
|
427
|
+
if (updateState) {
|
428
|
+
this.state = SignalConnectionState.DISCONNECTING;
|
429
|
+
}
|
428
430
|
if (this.ws) {
|
429
431
|
this.ws.onmessage = null;
|
430
432
|
this.ws.onopen = null;
|
@@ -449,7 +451,9 @@ export class SignalClient {
|
|
449
451
|
this.ws = undefined;
|
450
452
|
}
|
451
453
|
} finally {
|
452
|
-
|
454
|
+
if (updateState) {
|
455
|
+
this.state = SignalConnectionState.DISCONNECTED;
|
456
|
+
}
|
453
457
|
this.clearPingInterval();
|
454
458
|
unlock();
|
455
459
|
}
|
package/src/room/Room.ts
CHANGED
@@ -141,8 +141,6 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
141
141
|
|
142
142
|
private e2eeManager: E2EEManager | undefined;
|
143
143
|
|
144
|
-
private cachedParticipantSids: Array<string>;
|
145
|
-
|
146
144
|
private connectionReconcileInterval?: ReturnType<typeof setInterval>;
|
147
145
|
|
148
146
|
private regionUrlProvider?: RegionUrlProvider;
|
@@ -153,6 +151,8 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
153
151
|
|
154
152
|
private log = log;
|
155
153
|
|
154
|
+
private bufferedEvents: Array<any> = [];
|
155
|
+
|
156
156
|
/**
|
157
157
|
* Creates a new Room, the primary construct for a LiveKit session.
|
158
158
|
* @param options
|
@@ -161,7 +161,6 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
161
161
|
super();
|
162
162
|
this.setMaxListeners(100);
|
163
163
|
this.participants = new Map();
|
164
|
-
this.cachedParticipantSids = [];
|
165
164
|
this.identityToSid = new Map();
|
166
165
|
this.options = { ...roomOptionDefaults, ...options };
|
167
166
|
|
@@ -312,22 +311,16 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
312
311
|
if (this.setAndEmitConnectionState(ConnectionState.Reconnecting)) {
|
313
312
|
this.emit(RoomEvent.Reconnecting);
|
314
313
|
}
|
315
|
-
this.cachedParticipantSids = Array.from(this.participants.keys());
|
316
314
|
})
|
317
315
|
.on(EngineEvent.Resumed, () => {
|
318
316
|
this.setAndEmitConnectionState(ConnectionState.Connected);
|
319
317
|
this.emit(RoomEvent.Reconnected);
|
320
318
|
this.registerConnectionReconcile();
|
321
319
|
this.updateSubscriptions();
|
322
|
-
|
323
|
-
// once reconnected, figure out if any participants connected during reconnect and emit events for it
|
324
|
-
const diffParticipants = Array.from(this.participants.values()).filter(
|
325
|
-
(p) => !this.cachedParticipantSids.includes(p.sid),
|
326
|
-
);
|
327
|
-
diffParticipants.forEach((p) => this.emit(RoomEvent.ParticipantConnected, p));
|
328
|
-
this.cachedParticipantSids = [];
|
320
|
+
this.emitBufferedEvents();
|
329
321
|
})
|
330
322
|
.on(EngineEvent.SignalResumed, () => {
|
323
|
+
this.bufferedEvents = [];
|
331
324
|
if (this.state === ConnectionState.Reconnecting) {
|
332
325
|
this.sendSyncState();
|
333
326
|
}
|
@@ -881,10 +874,18 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
881
874
|
}
|
882
875
|
// set the srcObject to null on page hide in order to prevent lock screen controls to show up for it
|
883
876
|
dummyAudioEl.srcObject = document.hidden ? null : stream;
|
877
|
+
if (!document.hidden) {
|
878
|
+
this.log.debug(
|
879
|
+
'page visible again, triggering startAudio to resume playback and update playback status',
|
880
|
+
this.logContext,
|
881
|
+
);
|
882
|
+
this.startAudio();
|
883
|
+
}
|
884
884
|
});
|
885
885
|
document.body.append(dummyAudioEl);
|
886
886
|
this.once(RoomEvent.Disconnected, () => {
|
887
887
|
dummyAudioEl?.remove();
|
888
|
+
dummyAudioEl = null;
|
888
889
|
});
|
889
890
|
}
|
890
891
|
elements.push(dummyAudioEl);
|
@@ -1072,6 +1073,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1072
1073
|
// clear out existing remote participants, since they may have attached
|
1073
1074
|
// the old engine
|
1074
1075
|
this.participants.clear();
|
1076
|
+
this.bufferedEvents = [];
|
1075
1077
|
this.maybeCreateEngine();
|
1076
1078
|
}
|
1077
1079
|
|
@@ -1161,8 +1163,8 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1161
1163
|
...this.logContext,
|
1162
1164
|
region: joinResponse.serverRegion,
|
1163
1165
|
});
|
1166
|
+
this.bufferedEvents = [];
|
1164
1167
|
|
1165
|
-
this.cachedParticipantSids = [];
|
1166
1168
|
this.applyJoinResponse(joinResponse);
|
1167
1169
|
|
1168
1170
|
try {
|
@@ -1188,15 +1190,12 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1188
1190
|
this.setAndEmitConnectionState(ConnectionState.Connected);
|
1189
1191
|
this.emit(RoomEvent.Reconnected);
|
1190
1192
|
this.registerConnectionReconcile();
|
1191
|
-
|
1192
|
-
// emit participant connected events after connection has been re-established
|
1193
|
-
this.participants.forEach((participant) => {
|
1194
|
-
this.emit(RoomEvent.ParticipantConnected, participant);
|
1195
|
-
});
|
1193
|
+
this.emitBufferedEvents();
|
1196
1194
|
};
|
1197
1195
|
|
1198
1196
|
private handleDisconnect(shouldStopTracks = true, reason?: DisconnectReason) {
|
1199
1197
|
this.clearConnectionReconcile();
|
1198
|
+
this.bufferedEvents = [];
|
1200
1199
|
if (this.state === ConnectionState.Disconnected) {
|
1201
1200
|
return;
|
1202
1201
|
}
|
@@ -1707,12 +1706,22 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1707
1706
|
return true;
|
1708
1707
|
}
|
1709
1708
|
|
1709
|
+
private emitBufferedEvents() {
|
1710
|
+
this.bufferedEvents.forEach(([ev, args]) => {
|
1711
|
+
this.emit(ev, ...args);
|
1712
|
+
});
|
1713
|
+
this.bufferedEvents = [];
|
1714
|
+
}
|
1715
|
+
|
1710
1716
|
private emitWhenConnected<E extends keyof RoomEventCallbacks>(
|
1711
1717
|
event: E,
|
1712
1718
|
...args: Parameters<RoomEventCallbacks[E]>
|
1713
1719
|
): boolean {
|
1714
1720
|
if (this.state === ConnectionState.Connected) {
|
1715
1721
|
return this.emit(event, ...args);
|
1722
|
+
} else if (this.state === ConnectionState.Reconnecting) {
|
1723
|
+
// in case the room is reconnecting, buffer the events by firing them later after emitting RoomEvent.Reconnected
|
1724
|
+
this.bufferedEvents.push([event, args]);
|
1716
1725
|
}
|
1717
1726
|
return false;
|
1718
1727
|
}
|