fix playwright test! (It caught an actual bug!!! so the right wording
would be: fix implementation thanks to the playwright test!
This commit is contained in:
@@ -584,7 +584,6 @@ export function createCallViewModel$(
|
|||||||
// in a split-brained state.
|
// in a split-brained state.
|
||||||
// DISCUSSION own membership manager ALSO this probably can be simplifis
|
// DISCUSSION own membership manager ALSO this probably can be simplifis
|
||||||
const reconnecting$ = localMembership.reconnecting$;
|
const reconnecting$ = localMembership.reconnecting$;
|
||||||
const pretendToBeDisconnected$ = reconnecting$;
|
|
||||||
|
|
||||||
const audioParticipants$ = scope.behavior(
|
const audioParticipants$ = scope.behavior(
|
||||||
matrixLivekitMembers$.pipe(
|
matrixLivekitMembers$.pipe(
|
||||||
@@ -633,7 +632,7 @@ export function createCallViewModel$(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handsRaised$ = scope.behavior(
|
const handsRaised$ = scope.behavior(
|
||||||
handsRaisedSubject$.pipe(pauseWhen(pretendToBeDisconnected$)),
|
handsRaisedSubject$.pipe(pauseWhen(reconnecting$)),
|
||||||
);
|
);
|
||||||
|
|
||||||
const reactions$ = scope.behavior(
|
const reactions$ = scope.behavior(
|
||||||
@@ -646,7 +645,7 @@ export function createCallViewModel$(
|
|||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
pauseWhen(pretendToBeDisconnected$),
|
pauseWhen(reconnecting$),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -737,7 +736,7 @@ export function createCallViewModel$(
|
|||||||
livekitRoom$,
|
livekitRoom$,
|
||||||
focusUrl$,
|
focusUrl$,
|
||||||
mediaDevices,
|
mediaDevices,
|
||||||
pretendToBeDisconnected$,
|
reconnecting$,
|
||||||
displayName$,
|
displayName$,
|
||||||
matrixMemberMetadataStore.createAvatarUrlBehavior$(userId),
|
matrixMemberMetadataStore.createAvatarUrlBehavior$(userId),
|
||||||
handsRaised$.pipe(map((v) => v[participantId]?.time ?? null)),
|
handsRaised$.pipe(map((v) => v[participantId]?.time ?? null)),
|
||||||
|
|||||||
@@ -234,19 +234,26 @@ export const createLocalMembership$ = ({
|
|||||||
// */
|
// */
|
||||||
const connected$ = scope.behavior(
|
const connected$ = scope.behavior(
|
||||||
and$(
|
and$(
|
||||||
homeserverConnected$,
|
homeserverConnected$.pipe(
|
||||||
|
tap((v) => logger.info("matrix: Connected state changed", v)),
|
||||||
|
),
|
||||||
localConnectionState$.pipe(
|
localConnectionState$.pipe(
|
||||||
switchMap((state) => {
|
switchMap((state) => {
|
||||||
|
logger.info("livekit: Connected state changed", state);
|
||||||
if (!state) return of(false);
|
if (!state) return of(false);
|
||||||
if (state.state === "ConnectedToLkRoom") {
|
if (state.state === "ConnectedToLkRoom") {
|
||||||
state.livekitConnectionState$.pipe(
|
logger.info(
|
||||||
|
"livekit: Connected state changed (inner livekitConnectionState$)",
|
||||||
|
state.livekitConnectionState$.value,
|
||||||
|
);
|
||||||
|
return state.livekitConnectionState$.pipe(
|
||||||
map((lkState) => lkState === ConnectionState.Connected),
|
map((lkState) => lkState === ConnectionState.Connected),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return of(false);
|
return of(false);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
).pipe(tap((v) => logger.info("combined: Connected state changed", v))),
|
||||||
);
|
);
|
||||||
|
|
||||||
// MATRIX RELATED
|
// MATRIX RELATED
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
RoomEvent,
|
RoomEvent,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
|
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
|
||||||
import { BehaviorSubject, map, type Observable } from "rxjs";
|
import { BehaviorSubject, map } from "rxjs";
|
||||||
import { type Logger } from "matrix-js-sdk/lib/logger";
|
import { type Logger } from "matrix-js-sdk/lib/logger";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -54,7 +54,7 @@ export type ConnectionState =
|
|||||||
| { state: "ConnectingToLkRoom" }
|
| { state: "ConnectingToLkRoom" }
|
||||||
| {
|
| {
|
||||||
state: "ConnectedToLkRoom";
|
state: "ConnectedToLkRoom";
|
||||||
livekitConnectionState$: Observable<LivekitConenctionState>;
|
livekitConnectionState$: Behavior<LivekitConenctionState>;
|
||||||
}
|
}
|
||||||
| { state: "FailedToStart"; error: Error }
|
| { state: "FailedToStart"; error: Error }
|
||||||
| { state: "Stopped" };
|
| { state: "Stopped" };
|
||||||
@@ -82,6 +82,8 @@ export class Connection {
|
|||||||
|
|
||||||
public readonly livekitRoom: LivekitRoom;
|
public readonly livekitRoom: LivekitRoom;
|
||||||
|
|
||||||
|
private scope: ObservableScope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An observable of the participants that are publishing on this connection. (Excluding our local participant)
|
* An observable of the participants that are publishing on this connection. (Excluding our local participant)
|
||||||
* This is derived from `participantsIncludingSubscribers$` and `remoteTransports$`.
|
* This is derived from `participantsIncludingSubscribers$` and `remoteTransports$`.
|
||||||
@@ -154,7 +156,9 @@ export class Connection {
|
|||||||
|
|
||||||
this._state$.next({
|
this._state$.next({
|
||||||
state: "ConnectedToLkRoom",
|
state: "ConnectedToLkRoom",
|
||||||
livekitConnectionState$: connectionStateObserver(this.livekitRoom),
|
livekitConnectionState$: this.scope.behavior(
|
||||||
|
connectionStateObserver(this.livekitRoom),
|
||||||
|
),
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.debug(`Failed to connect to LiveKit room: ${error}`);
|
this.logger.debug(`Failed to connect to LiveKit room: ${error}`);
|
||||||
@@ -209,6 +213,7 @@ export class Connection {
|
|||||||
);
|
);
|
||||||
const { transport, client, scope } = opts;
|
const { transport, client, scope } = opts;
|
||||||
|
|
||||||
|
this.scope = scope;
|
||||||
this.livekitRoom = opts.livekitRoomFactory();
|
this.livekitRoom = opts.livekitRoomFactory();
|
||||||
this.transport = transport;
|
this.transport = transport;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
|||||||
Reference in New Issue
Block a user