cleanup based on new js-sdk impl

This commit is contained in:
Timo K
2025-12-29 17:38:54 +01:00
parent 7591e2bda1
commit 0f5c5d8be5
18 changed files with 191 additions and 156 deletions

View File

@@ -8,6 +8,7 @@ Please see LICENSE in the repository root for full details.
import {
type CallMembership,
isLivekitTransport,
type LivekitTransport,
type MatrixRTCSession,
MatrixRTCSessionEvent,
} from "matrix-js-sdk/lib/matrixrtc";
@@ -20,18 +21,15 @@ import {
type ObservableScope,
} from "./ObservableScope";
import { type Behavior } from "./Behavior";
import { type LivekitTransportWithVersion } from "./CallViewModel/remoteMembers/ConnectionManager";
export const membershipsAndTransports$ = (
scope: ObservableScope,
memberships$: Behavior<Epoch<CallMembership[]>>,
): {
membershipsWithTransport$: Behavior<
Epoch<
{ membership: CallMembership; transport?: LivekitTransportWithVersion }[]
>
Epoch<{ membership: CallMembership; transport?: LivekitTransport }[]>
>;
transports$: Behavior<Epoch<LivekitTransportWithVersion[]>>;
transports$: Behavior<Epoch<LivekitTransport[]>>;
} => {
/**
* Lists the transports used by ourselves, plus all other MatrixRTC session
@@ -49,12 +47,7 @@ export const membershipsAndTransports$ = (
const transport = membership.getTransport(oldestMembership);
return {
membership,
transport: isLivekitTransport(transport)
? {
...transport,
useMatrix2: membership.kind === "rtc",
}
: undefined,
transport: isLivekitTransport(transport) ? transport : undefined,
};
});
}),