Fix joining call with audio and video muted

This commit is contained in:
Robin
2025-10-14 12:19:23 -04:00
parent 13636b78d9
commit 95069fd3fa

View File

@@ -109,10 +109,15 @@ export class PublishConnection extends Connection {
if (this.stopped) return;
// TODO this can throw errors? It will also prompt for permissions if not already granted
// TODO-MULTI-SFU: Prepublish a microphone track
const audio = this.muteStates.audio.enabled$.value;
const video = this.muteStates.video.enabled$.value;
// createTracks throws if called with audio=false and video=false
if (audio || video) {
// TODO this can still throw errors? It will also prompt for permissions if not already granted
const tracks = await this.livekitRoom.localParticipant.createTracks({
audio: this.muteStates.audio.enabled$.value,
video: this.muteStates.video.enabled$.value,
audio,
video,
});
if (this.stopped) return;
for (const track of tracks) {
@@ -123,6 +128,7 @@ export class PublishConnection extends Connection {
// TODO: check if the connection is still active? and break the loop if not?
}
}
}
public async stop(): Promise<void> {
// TODO-MULTI-SFU: Move these calls back to ObservableScope.onEnd once scope