livekit-client 1.15.10 → 1.15.12
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 +35 -19
- 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 +2 -2
- package/src/api/SignalClient.ts +8 -4
- package/src/room/PCTransportManager.ts +1 -1
- package/src/room/Room.ts +26 -17
|
@@ -10614,7 +10614,7 @@ function getMatch(exp, ua) {
|
|
|
10614
10614
|
return match && match.length >= id && match[id] || '';
|
|
10615
10615
|
}
|
|
10616
10616
|
|
|
10617
|
-
var version$1 = "1.15.
|
|
10617
|
+
var version$1 = "1.15.12";
|
|
10618
10618
|
|
|
10619
10619
|
const version = version$1;
|
|
10620
10620
|
const protocolVersion = 11;
|
|
@@ -14938,7 +14938,7 @@ class SignalClient {
|
|
|
14938
14938
|
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener('abort', abortHandler);
|
|
14939
14939
|
this.log.debug("connecting to ".concat(url + params), this.logContext);
|
|
14940
14940
|
if (this.ws) {
|
|
14941
|
-
yield this.close();
|
|
14941
|
+
yield this.close(false);
|
|
14942
14942
|
}
|
|
14943
14943
|
this.ws = new WebSocket(url + params);
|
|
14944
14944
|
this.ws.binaryType = 'arraybuffer';
|
|
@@ -15035,10 +15035,13 @@ class SignalClient {
|
|
|
15035
15035
|
}));
|
|
15036
15036
|
}
|
|
15037
15037
|
close() {
|
|
15038
|
+
let updateState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
15038
15039
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15039
15040
|
const unlock = yield this.closingLock.lock();
|
|
15040
15041
|
try {
|
|
15041
|
-
|
|
15042
|
+
if (updateState) {
|
|
15043
|
+
this.state = SignalConnectionState.DISCONNECTING;
|
|
15044
|
+
}
|
|
15042
15045
|
if (this.ws) {
|
|
15043
15046
|
this.ws.onmessage = null;
|
|
15044
15047
|
this.ws.onopen = null;
|
|
@@ -15061,7 +15064,9 @@ class SignalClient {
|
|
|
15061
15064
|
this.ws = undefined;
|
|
15062
15065
|
}
|
|
15063
15066
|
} finally {
|
|
15064
|
-
|
|
15067
|
+
if (updateState) {
|
|
15068
|
+
this.state = SignalConnectionState.DISCONNECTED;
|
|
15069
|
+
}
|
|
15065
15070
|
this.clearPingInterval();
|
|
15066
15071
|
unlock();
|
|
15067
15072
|
}
|
|
@@ -16744,7 +16749,7 @@ class PCTransportManager {
|
|
|
16744
16749
|
}]
|
|
16745
16750
|
};
|
|
16746
16751
|
this.publisher = new PCTransport(rtcConfig, googConstraints, loggerOptions);
|
|
16747
|
-
this.subscriber = new PCTransport(rtcConfig, loggerOptions);
|
|
16752
|
+
this.subscriber = new PCTransport(rtcConfig, undefined, loggerOptions);
|
|
16748
16753
|
this.publisher.onConnectionStateChange = this.updateState;
|
|
16749
16754
|
this.subscriber.onConnectionStateChange = this.updateState;
|
|
16750
16755
|
this.publisher.onIceConnectionStateChange = this.updateState;
|
|
@@ -21761,6 +21766,7 @@ class Room extends eventsExports.EventEmitter {
|
|
|
21761
21766
|
this.audioEnabled = true;
|
|
21762
21767
|
this.isVideoPlaybackBlocked = false;
|
|
21763
21768
|
this.log = livekitLogger;
|
|
21769
|
+
this.bufferedEvents = [];
|
|
21764
21770
|
this.connect = (url, token, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
21765
21771
|
var _c;
|
|
21766
21772
|
// In case a disconnect called happened right before the connect call, make sure the disconnect is completed first by awaiting its lock
|
|
@@ -22037,10 +22043,15 @@ class Room extends eventsExports.EventEmitter {
|
|
|
22037
22043
|
}
|
|
22038
22044
|
// set the srcObject to null on page hide in order to prevent lock screen controls to show up for it
|
|
22039
22045
|
dummyAudioEl.srcObject = document.hidden ? null : stream;
|
|
22046
|
+
if (!document.hidden) {
|
|
22047
|
+
this.log.debug('page visible again, triggering startAudio to resume playback and update playback status', this.logContext);
|
|
22048
|
+
this.startAudio();
|
|
22049
|
+
}
|
|
22040
22050
|
});
|
|
22041
22051
|
document.body.append(dummyAudioEl);
|
|
22042
22052
|
this.once(RoomEvent.Disconnected, () => {
|
|
22043
22053
|
dummyAudioEl === null || dummyAudioEl === void 0 ? void 0 : dummyAudioEl.remove();
|
|
22054
|
+
dummyAudioEl = null;
|
|
22044
22055
|
});
|
|
22045
22056
|
}
|
|
22046
22057
|
elements.push(dummyAudioEl);
|
|
@@ -22101,7 +22112,7 @@ class Room extends eventsExports.EventEmitter {
|
|
|
22101
22112
|
this.log.debug("signal reconnected to server, region ".concat(joinResponse.serverRegion), Object.assign(Object.assign({}, this.logContext), {
|
|
22102
22113
|
region: joinResponse.serverRegion
|
|
22103
22114
|
}));
|
|
22104
|
-
this.
|
|
22115
|
+
this.bufferedEvents = [];
|
|
22105
22116
|
this.applyJoinResponse(joinResponse);
|
|
22106
22117
|
try {
|
|
22107
22118
|
// unpublish & republish tracks
|
|
@@ -22123,10 +22134,7 @@ class Room extends eventsExports.EventEmitter {
|
|
|
22123
22134
|
this.setAndEmitConnectionState(ConnectionState.Connected);
|
|
22124
22135
|
this.emit(RoomEvent.Reconnected);
|
|
22125
22136
|
this.registerConnectionReconcile();
|
|
22126
|
-
|
|
22127
|
-
this.participants.forEach(participant => {
|
|
22128
|
-
this.emit(RoomEvent.ParticipantConnected, participant);
|
|
22129
|
-
});
|
|
22137
|
+
this.emitBufferedEvents();
|
|
22130
22138
|
});
|
|
22131
22139
|
this.handleParticipantUpdates = participantInfos => {
|
|
22132
22140
|
// handle changes to participant state, and send events
|
|
@@ -22355,7 +22363,6 @@ class Room extends eventsExports.EventEmitter {
|
|
|
22355
22363
|
};
|
|
22356
22364
|
this.setMaxListeners(100);
|
|
22357
22365
|
this.participants = new Map();
|
|
22358
|
-
this.cachedParticipantSids = [];
|
|
22359
22366
|
this.identityToSid = new Map();
|
|
22360
22367
|
this.options = Object.assign(Object.assign({}, roomOptionDefaults), options);
|
|
22361
22368
|
this.log = getLogger((_a = this.options.loggerName) !== null && _a !== void 0 ? _a : LoggerNames.Room);
|
|
@@ -22458,17 +22465,14 @@ class Room extends eventsExports.EventEmitter {
|
|
|
22458
22465
|
if (this.setAndEmitConnectionState(ConnectionState.Reconnecting)) {
|
|
22459
22466
|
this.emit(RoomEvent.Reconnecting);
|
|
22460
22467
|
}
|
|
22461
|
-
this.cachedParticipantSids = Array.from(this.participants.keys());
|
|
22462
22468
|
}).on(EngineEvent.Resumed, () => {
|
|
22463
22469
|
this.setAndEmitConnectionState(ConnectionState.Connected);
|
|
22464
22470
|
this.emit(RoomEvent.Reconnected);
|
|
22465
22471
|
this.registerConnectionReconcile();
|
|
22466
22472
|
this.updateSubscriptions();
|
|
22467
|
-
|
|
22468
|
-
const diffParticipants = Array.from(this.participants.values()).filter(p => !this.cachedParticipantSids.includes(p.sid));
|
|
22469
|
-
diffParticipants.forEach(p => this.emit(RoomEvent.ParticipantConnected, p));
|
|
22470
|
-
this.cachedParticipantSids = [];
|
|
22473
|
+
this.emitBufferedEvents();
|
|
22471
22474
|
}).on(EngineEvent.SignalResumed, () => {
|
|
22475
|
+
this.bufferedEvents = [];
|
|
22472
22476
|
if (this.state === ConnectionState.Reconnecting) {
|
|
22473
22477
|
this.sendSyncState();
|
|
22474
22478
|
}
|
|
@@ -22777,6 +22781,7 @@ class Room extends eventsExports.EventEmitter {
|
|
|
22777
22781
|
// clear out existing remote participants, since they may have attached
|
|
22778
22782
|
// the old engine
|
|
22779
22783
|
this.participants.clear();
|
|
22784
|
+
this.bufferedEvents = [];
|
|
22780
22785
|
this.maybeCreateEngine();
|
|
22781
22786
|
}
|
|
22782
22787
|
onTrackAdded(mediaTrack, stream, receiver) {
|
|
@@ -22835,6 +22840,7 @@ class Room extends eventsExports.EventEmitter {
|
|
|
22835
22840
|
let reason = arguments.length > 1 ? arguments[1] : undefined;
|
|
22836
22841
|
var _a;
|
|
22837
22842
|
this.clearConnectionReconcile();
|
|
22843
|
+
this.bufferedEvents = [];
|
|
22838
22844
|
if (this.state === ConnectionState.Disconnected) {
|
|
22839
22845
|
return;
|
|
22840
22846
|
}
|
|
@@ -23059,12 +23065,22 @@ class Room extends eventsExports.EventEmitter {
|
|
|
23059
23065
|
this.emit(RoomEvent.ConnectionStateChanged, this.state);
|
|
23060
23066
|
return true;
|
|
23061
23067
|
}
|
|
23068
|
+
emitBufferedEvents() {
|
|
23069
|
+
this.bufferedEvents.forEach(_ref2 => {
|
|
23070
|
+
let [ev, args] = _ref2;
|
|
23071
|
+
this.emit(ev, ...args);
|
|
23072
|
+
});
|
|
23073
|
+
this.bufferedEvents = [];
|
|
23074
|
+
}
|
|
23062
23075
|
emitWhenConnected(event) {
|
|
23076
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
23077
|
+
args[_key - 1] = arguments[_key];
|
|
23078
|
+
}
|
|
23063
23079
|
if (this.state === ConnectionState.Connected) {
|
|
23064
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
23065
|
-
args[_key - 1] = arguments[_key];
|
|
23066
|
-
}
|
|
23067
23080
|
return this.emit(event, ...args);
|
|
23081
|
+
} else if (this.state === ConnectionState.Reconnecting) {
|
|
23082
|
+
// in case the room is reconnecting, buffer the events by firing them later after emitting RoomEvent.Reconnected
|
|
23083
|
+
this.bufferedEvents.push([event, args]);
|
|
23068
23084
|
}
|
|
23069
23085
|
return false;
|
|
23070
23086
|
}
|