Make MatrixRTC mode a required input to CallViewModel
This commit is contained in:
@@ -62,7 +62,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
duplicateTiles,
|
duplicateTiles,
|
||||||
MatrixRTCMode,
|
MatrixRTCMode,
|
||||||
matrixRTCMode as matrixRTCModeSetting,
|
|
||||||
playReactionsSound,
|
playReactionsSound,
|
||||||
showReactions,
|
showReactions,
|
||||||
} from "../../settings/settings";
|
} from "../../settings/settings";
|
||||||
@@ -156,8 +155,8 @@ export interface CallViewModelOptions {
|
|||||||
connectionState$?: Behavior<ConnectionState>;
|
connectionState$?: Behavior<ConnectionState>;
|
||||||
/** Optional behavior overriding the computed window size, mainly for testing purposes. */
|
/** Optional behavior overriding the computed window size, mainly for testing purposes. */
|
||||||
windowSize$?: Behavior<{ width: number; height: number }>;
|
windowSize$?: Behavior<{ width: number; height: number }>;
|
||||||
/** Optional behavior overriding the MatrixRTC mode, mainly for testing purposes. */
|
/** The version & compatibility mode of MatrixRTC that we should use. */
|
||||||
matrixRTCMode$?: Behavior<MatrixRTCMode>;
|
matrixRTCMode$: Behavior<MatrixRTCMode>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not play any sounds if the participant count has exceeded this
|
// Do not play any sounds if the participant count has exceeded this
|
||||||
@@ -408,15 +407,13 @@ export function createCallViewModel$(
|
|||||||
memberships$,
|
memberships$,
|
||||||
);
|
);
|
||||||
|
|
||||||
const matrixRTCMode$ = options.matrixRTCMode$ ?? matrixRTCModeSetting.value$;
|
|
||||||
|
|
||||||
const localTransport$ = createLocalTransport$({
|
const localTransport$ = createLocalTransport$({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
memberships$: memberships$,
|
memberships$: memberships$,
|
||||||
client,
|
client,
|
||||||
roomId: matrixRoom.roomId,
|
roomId: matrixRoom.roomId,
|
||||||
useOldestMember$: scope.behavior(
|
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(
|
const connectOptions$ = scope.behavior(
|
||||||
matrixRTCMode$.pipe(
|
options.matrixRTCMode$.pipe(
|
||||||
map((mode) => ({
|
map((mode) => ({
|
||||||
encryptMedia: livekitKeyProvider !== undefined,
|
encryptMedia: livekitKeyProvider !== undefined,
|
||||||
// TODO. This might need to get called again on each change of matrixRTCMode...
|
// TODO. This might need to get called again on each change of matrixRTCMode...
|
||||||
|
|||||||
@@ -102,11 +102,7 @@ export function withCallViewModel(mode: MatrixRTCMode) {
|
|||||||
},
|
},
|
||||||
setSyncState: (value: SyncState) => void,
|
setSyncState: (value: SyncState) => void,
|
||||||
) => void,
|
) => void,
|
||||||
options: CallViewModelOptions = {
|
options: Partial<CallViewModelOptions> = {},
|
||||||
encryptionSystem: { kind: E2eeType.PER_PARTICIPANT },
|
|
||||||
autoLeaveWhenOthersLeft: false,
|
|
||||||
matrixRTCMode$: constant(mode),
|
|
||||||
},
|
|
||||||
): void => {
|
): void => {
|
||||||
let syncState = initialSyncState;
|
let syncState = initialSyncState;
|
||||||
const setSyncState = (value: SyncState): void => {
|
const setSyncState = (value: SyncState): void => {
|
||||||
@@ -176,7 +172,8 @@ export function withCallViewModel(mode: MatrixRTCMode) {
|
|||||||
mediaDevices,
|
mediaDevices,
|
||||||
muteStates,
|
muteStates,
|
||||||
{
|
{
|
||||||
...options,
|
encryptionSystem: { kind: E2eeType.PER_PARTICIPANT },
|
||||||
|
autoLeaveWhenOthersLeft: false,
|
||||||
livekitRoomFactory: (): LivekitRoom =>
|
livekitRoomFactory: (): LivekitRoom =>
|
||||||
mockLivekitRoom({
|
mockLivekitRoom({
|
||||||
localParticipant,
|
localParticipant,
|
||||||
@@ -185,6 +182,8 @@ export function withCallViewModel(mode: MatrixRTCMode) {
|
|||||||
}),
|
}),
|
||||||
connectionState$,
|
connectionState$,
|
||||||
windowSize$,
|
windowSize$,
|
||||||
|
matrixRTCMode$: constant(mode),
|
||||||
|
...options,
|
||||||
},
|
},
|
||||||
raisedHands$,
|
raisedHands$,
|
||||||
reactions$,
|
reactions$,
|
||||||
|
|||||||
Reference in New Issue
Block a user