Make MatrixRTC mode a required input to CallViewModel

This commit is contained in:
Robin
2025-12-15 15:16:47 -05:00
parent c7e9f1ce14
commit 87fbbb9a3f
2 changed files with 9 additions and 13 deletions

View File

@@ -62,7 +62,6 @@ import {
import {
duplicateTiles,
MatrixRTCMode,
matrixRTCMode as matrixRTCModeSetting,
playReactionsSound,
showReactions,
} from "../../settings/settings";
@@ -156,8 +155,8 @@ export interface CallViewModelOptions {
connectionState$?: Behavior<ConnectionState>;
/** Optional behavior overriding the computed window size, mainly for testing purposes. */
windowSize$?: Behavior<{ width: number; height: number }>;
/** Optional behavior overriding the MatrixRTC mode, mainly for testing purposes. */
matrixRTCMode$?: Behavior<MatrixRTCMode>;
/** The version & compatibility mode of MatrixRTC that we should use. */
matrixRTCMode$: Behavior<MatrixRTCMode>;
}
// Do not play any sounds if the participant count has exceeded this
@@ -408,15 +407,13 @@ export function createCallViewModel$(
memberships$,
);
const matrixRTCMode$ = options.matrixRTCMode$ ?? matrixRTCModeSetting.value$;
const localTransport$ = createLocalTransport$({
scope: scope,
memberships$: memberships$,
client,
roomId: matrixRoom.roomId,
useOldestMember$: scope.behavior(
matrixRTCMode$.pipe(map((v) => v === MatrixRTCMode.Legacy)),
options.matrixRTCMode$.pipe(map((v) => v === MatrixRTCMode.Legacy)),
),
});
@@ -468,7 +465,7 @@ export function createCallViewModel$(
});
const connectOptions$ = scope.behavior(
matrixRTCMode$.pipe(
options.matrixRTCMode$.pipe(
map((mode) => ({
encryptMedia: livekitKeyProvider !== undefined,
// TODO. This might need to get called again on each change of matrixRTCMode...