Connection: add Connection state and handle error on start

This commit is contained in:
Valere
2025-10-01 10:06:43 +02:00
parent b00f7d5409
commit 879a1d4af1
3 changed files with 89 additions and 48 deletions

View File

@@ -470,12 +470,22 @@ export class CallViewModel extends ViewModel {
}
);
public readonly livekitConnectionState$ = this.scope.behavior(
combineLatest([this.localConnection]).pipe(
switchMap(([c]) => c.connectionState$),
startWith(ConnectionState.Disconnected),
),
);
public readonly livekitConnectionState$ =
this.scope.behavior(
from(this.localConnection).pipe(
switchMap((c) =>
c.focusedConnectionState$.pipe(
map((s) => {
if (s.state === "ConnectedToLkRoom") return s.connectionState;
return ConnectionState.Disconnected
}),
distinctUntilChanged(),
),
),
startWith(ConnectionState.Disconnected),
),
)
/**
* The MatrixRTC session participants.