Show 'reconnecting' message when session warns we've hit a timeout

By using the new 'probablyLeft' state provided by MatrixRTCSession.
This commit is contained in:
Robin
2025-08-20 13:33:36 +02:00
parent 3da9013426
commit 5d0289f3c9
3 changed files with 20 additions and 6 deletions

View File

@@ -57,6 +57,7 @@ import {
type CallMembership,
type MatrixRTCSession,
MatrixRTCSessionEvent,
MembershipManagerEvent,
} from "matrix-js-sdk/lib/matrixrtc";
import { ViewModel } from "./ViewModel";
@@ -517,6 +518,19 @@ export class CallViewModel extends ViewModel {
),
),
),
// Also watch out for warnings that we've likely hit a timeout and our
// delayed leave event is being sent (this condition is here because it
// provides an earlier warning than the sync loop timeout, and we wouldn't
// see the actual leave event until we reconnect to the sync loop)
(
fromEvent(
this.matrixRTCSession,
MembershipManagerEvent.ProbablyLeft,
) as Observable<[SyncState]>
).pipe(
startWith([false]),
map(([probablyLeft]) => !probablyLeft),
),
),
);