Skip to content

Commit 022f4cb

Browse files
authored
Allowing subscription settings to update before fully subscribed (#471)
* Allowing subscription settings to update before fully subscribed also made logs easier to parse. browsers sometimes log contextual objects as [object Object] * changeset
1 parent 2dc83e4 commit 022f4cb

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

.changeset/ten-moons-smile.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'livekit-client': patch
3+
---
4+
5+
Allow subscription settings before fully subscribed

src/room/RTCEngine.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,7 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
298298
}
299299
this.primaryPC = primaryPC;
300300
primaryPC.onconnectionstatechange = async () => {
301-
log.debug('primary PC state changed', {
302-
state: primaryPC.connectionState,
303-
});
301+
log.debug(`primary PC state changed ${primaryPC.connectionState}`);
304302
if (primaryPC.connectionState === 'connected') {
305303
try {
306304
this.connectedServerAddr = await getConnectedAddress(primaryPC);
@@ -322,9 +320,7 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
322320
}
323321
};
324322
secondaryPC.onconnectionstatechange = async () => {
325-
log.debug('secondary PC state changed', {
326-
state: secondaryPC.connectionState,
327-
});
323+
log.debug(`secondary PC state changed ${secondaryPC.connectionState}`);
328324
// also reconnect if secondary peerconnection fails
329325
if (secondaryPC.connectionState === 'failed') {
330326
this.handleDisconnect('secondary peerconnection');

src/room/Room.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
11911191
event: E,
11921192
...args: Parameters<RoomEventCallbacks[E]>
11931193
): boolean {
1194-
log.debug('room event', { event, args });
1194+
// active speaker updates are too spammy
1195+
if (event !== RoomEvent.ActiveSpeakersChanged) {
1196+
log.debug(`room event ${event}`, { event, args });
1197+
}
11951198
return super.emit(event, ...args);
11961199
}
11971200
}

src/room/track/RemoteTrackPublication.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export default class RemoteTrackPublication extends TrackPublication {
219219
});
220220
return false;
221221
}
222-
if (!this.isSubscribed) {
222+
if (!this.isDesired) {
223223
log.warn('cannot update track settings when not subscribed', { trackSid: this.trackSid });
224224
return false;
225225
}

0 commit comments

Comments
 (0)