Compare commits

...
Author SHA1 Message Date
Robin 83dad2d081 Temporarily stop using matrix-js-sdk's LivekitTransport
This will allow matrix-js-sdk to introduce the new variants without livekit_service_url, which we can then adopt in a separate step.
2026-10-01 16:57:43 +02:00
21 changed files with 84 additions and 36 deletions
+11
View File
@@ -86,6 +86,17 @@
],
"message": "Please use matrix-js-sdk instead"
}
],
"paths": [
{
"name": "matrix-js-sdk/lib/matrixrtc",
"importNames": [
"LivekitTransport",
"isLivekitTransport",
"isLivekitTransportConfig"
],
"message": "Please use src/LivekitTransport.ts instead"
}
]
}
],
+28
View File
@@ -0,0 +1,28 @@
/*
Copyright 2023 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { test, expect } from "vitest";
import { isLivekitTransport } from "./LivekitTransport";
test("isLivekitTransport", () => {
expect(
isLivekitTransport({
type: "livekit",
livekit_service_url: "http://test.com",
}),
).toBeTruthy();
expect(isLivekitTransport({ type: "livekit" })).toBeFalsy();
expect(
isLivekitTransport({
type: "not-livekit",
livekit_service_url: "http://test.com",
}),
).toBeFalsy();
expect(
isLivekitTransport({ type: "livekit", other_service_url: "multi_sfu" }),
).toBeFalsy();
});
+20
View File
@@ -0,0 +1,20 @@
/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { type Transport } from "matrix-js-sdk/lib/matrixrtc";
// TODO: Delete this module and return to using LivekitTransport from
// matrix-js-sdk. This should only exist for a short time to facilitate merging
// some breaking changes to LivekitTransport in matrix-js-sdk.
export interface LivekitTransport extends Transport {
type: "livekit";
livekit_service_url: string;
}
export const isLivekitTransport = (object: any): object is LivekitTransport =>
object.type === "livekit" && "livekit_service_url" in object;
+2 -4
View File
@@ -16,10 +16,7 @@ import {
} from "vitest";
import { act } from "react";
import { type RoomMember } from "matrix-js-sdk";
import {
type LivekitTransport,
type CallMembership,
} from "matrix-js-sdk/lib/matrixrtc";
import { type CallMembership } from "matrix-js-sdk/lib/matrixrtc";
import {
exampleTransport,
@@ -40,6 +37,7 @@ import {
} from "../utils/test-fixtures";
import { MAX_PARTICIPANT_COUNT_FOR_SOUND } from "../state/CallViewModel/CallViewModel";
import { initializeWidget } from "../widget";
import { type LivekitTransport } from "../LivekitTransport";
initializeWidget();
vitest.mock("livekit-client/e2ee-worker?worker");
vitest.mock("../useAudioContext");
@@ -31,7 +31,6 @@ import {
type CallMembership,
type IRTCNotificationContent,
MatrixRTCSessionEvent,
type LivekitTransport,
} from "matrix-js-sdk/lib/matrixrtc";
import { deepCompare } from "matrix-js-sdk/lib/utils";
@@ -70,6 +69,7 @@ import { MatrixRTCMode } from "../../config/ConfigOptions.ts";
import { initializeWidget } from "../../widget.ts";
import { computeUrlParams } from "../../UrlParams.ts";
import { callViewModelOptionsFromParams } from "./CallViewModel.ts";
import { type LivekitTransport } from "../../LivekitTransport.ts";
initializeWidget();
+1 -1
View File
@@ -43,7 +43,6 @@ import {
import { type Logger, logger as rootLogger } from "matrix-js-sdk/lib/logger";
import {
MembershipManagerEvent,
type LivekitTransport,
type MatrixRTCSession,
type RTCCallIntent,
type RTCNotificationType,
@@ -163,6 +162,7 @@ import {
type RingingMediaViewModel,
} from "../media/RingingMediaViewModel.ts";
import { type GridTileViewModel } from "../TileViewModel.ts";
import { type LivekitTransport } from "../../LivekitTransport.ts";
//TODO
// Larger rename
@@ -8,7 +8,6 @@ Please see LICENSE in the repository root for full details.
import {
Status as RTCMemberStatus,
type LivekitTransport,
type MatrixRTCSession,
} from "matrix-js-sdk/lib/matrixrtc";
import {
@@ -60,6 +59,7 @@ import { initializeWidget } from "../../../widget";
import { nullHostBridge } from "../../../HostBridge";
import { type LocalTransport } from "./LocalTransport";
import * as openIDSFU from "../../../livekit/openIDSFU";
import { type LivekitTransport } from "../../../LivekitTransport";
initializeWidget();
@@ -18,7 +18,6 @@ import { observeParticipantEvents } from "@livekit/components-core";
import { type MatrixClient } from "matrix-js-sdk";
import {
Status as RTCSessionStatus,
type LivekitTransport,
type MatrixRTCSession,
type RTCCallIntent,
type RTCNotificationType,
@@ -81,6 +80,7 @@ import {
import { type HomeserverConnected } from "./HomeserverConnected.ts";
import { type LocalTransport } from "./LocalTransport.ts";
import { getSFUConfigWithOpenID } from "../../../livekit/openIDSFU.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
export enum TransportState {
/** Not even a transport is available to the LocalMembership */
@@ -5,7 +5,6 @@ SPDX-License-IdFentifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
import { type MatrixClient } from "matrix-js-sdk";
import { logger as rootLogger, type Logger } from "matrix-js-sdk/lib/logger";
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
@@ -24,6 +23,7 @@ import {
import { customLivekitUrl } from "../../../settings/settings.ts";
import { RtcTransportAutoDiscovery } from "./RtcTransportAutoDiscovery.ts";
import { type MatrixRTCMode } from "../../../config/ConfigOptions.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
interface Props {
ownMembershipIdentity: CallMembershipIdentityParts;
@@ -15,16 +15,14 @@ import {
} from "vitest";
import { MatrixError } from "matrix-js-sdk";
import { logger as rootLogger } from "matrix-js-sdk/lib/logger";
import {
type LivekitTransport,
type Transport,
} from "matrix-js-sdk/lib/matrixrtc";
import { type Transport } from "matrix-js-sdk/lib/matrixrtc";
import type { ResolvedConfigOptions } from "../../../config/ConfigOptions.ts";
import {
RtcTransportAutoDiscovery,
type RtcTransportAutoDiscoveryProps,
} from "./RtcTransportAutoDiscovery.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
type DiscoveryClient = RtcTransportAutoDiscoveryProps["client"];
@@ -4,15 +4,15 @@ Copyright 2026 Element Creations Ltd.
SPDX-License-IdFentifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import {
isLivekitTransport,
type LivekitTransport,
} from "matrix-js-sdk/lib/matrixrtc";
import { type MatrixClient } from "matrix-js-sdk";
import { type Logger } from "matrix-js-sdk/lib/logger";
import type { ResolvedConfigOptions } from "../../../config/ConfigOptions.ts";
import { doNetworkOperationWithRetry } from "../../../utils/matrix.ts";
import {
isLivekitTransport,
type LivekitTransport,
} from "../../../LivekitTransport.ts";
type TransportDiscoveryClient = Pick<
MatrixClient,
@@ -30,7 +30,6 @@ import fetchMock from "fetch-mock";
import EventEmitter from "events";
import { type IOpenIDToken } from "matrix-js-sdk";
import { logger, type Logger } from "matrix-js-sdk/lib/logger";
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
import {
Connection,
@@ -45,6 +44,7 @@ import {
} from "../../../utils/errors.ts";
import { testJWTToken } from "../../../utils/test-fixtures.ts";
import { mockRemoteParticipant, ownMemberMock } from "../../../utils/test.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
let testScope: ObservableScope;
@@ -22,7 +22,6 @@ import {
type Track,
type TrackPublication,
} from "livekit-client";
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
import { BehaviorSubject, map } from "rxjs";
import { type Logger } from "matrix-js-sdk/lib/logger";
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
@@ -42,6 +41,7 @@ import {
SFURoomCreationRestrictedError,
UnknownCallError,
} from "../../../utils/errors.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
export interface ConnectionOpts {
/**
@@ -16,7 +16,6 @@ import { logger, type Logger } from "matrix-js-sdk/lib/logger";
// imported as inline to support worker when loaded from a cdn (cross domain)
import E2EEWorker from "livekit-client/e2ee-worker?worker&inline";
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
import { type ObservableScope } from "../../ObservableScope.ts";
import { Connection } from "./Connection.ts";
@@ -39,6 +38,7 @@ import {
noiseSuppressionSetting,
autoGainControlSetting,
} from "../../../settings/settings.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
// TODO evaluate if this should be done like the Publisher Factory
export interface ConnectionFactory {
@@ -7,7 +7,6 @@ Please see LICENSE in the repository root for full details.
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { BehaviorSubject, NEVER } from "rxjs";
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
import { type RemoteParticipant } from "livekit-client";
import { logger } from "matrix-js-sdk/lib/logger";
@@ -21,6 +20,7 @@ import { type Connection } from "./Connection.ts";
import { ownMemberMock, withTestScheduler } from "../../../utils/test.ts";
import { areLivekitTransportsEqual } from "./MatrixLivekitMembers.ts";
import { type Behavior } from "../../Behavior.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
// Some test constants
@@ -6,7 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
import {
combineLatest,
map,
@@ -32,6 +31,7 @@ import {
type LocalTransport,
} from "../localMember/LocalTransport.ts";
import { type SFUConfig } from "../../../livekit/openIDSFU.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
export class ConnectionManagerData {
private readonly store: Map<
@@ -7,10 +7,7 @@ Please see LICENSE in the repository root for full details.
import { describe, test, expect, beforeEach, afterEach, vi } from "vitest";
import { logger } from "matrix-js-sdk/lib/logger";
import {
type CallMembership,
type LivekitTransport,
} from "matrix-js-sdk/lib/matrixrtc";
import { type CallMembership } from "matrix-js-sdk/lib/matrixrtc";
import { BehaviorSubject, combineLatest, map, type Observable } from "rxjs";
import { type IConnectionManager } from "./ConnectionManager.ts";
@@ -33,6 +30,7 @@ import {
import { type Connection } from "./Connection.ts";
import { constant } from "../../Behavior.ts";
import { localRtcMember } from "../../../utils/test-fixtures.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
let testScope: ObservableScope;
@@ -6,10 +6,7 @@ Please see LICENSE in the repository root for full details.
*/
import { type LocalParticipant, type RemoteParticipant } from "livekit-client";
import {
type CallMembership,
type LivekitTransport,
} from "matrix-js-sdk/lib/matrixrtc";
import { type CallMembership } from "matrix-js-sdk/lib/matrixrtc";
import { combineLatest, filter, map } from "rxjs";
import { logger } from "matrix-js-sdk/lib/logger";
@@ -18,6 +15,7 @@ import { type IConnectionManager } from "./ConnectionManager";
import { Epoch, type ObservableScope } from "../../ObservableScope";
import { type Connection } from "./Connection";
import { generateItemsWithEpoch } from "../../../utils/observable";
import { type LivekitTransport } from "../../../LivekitTransport";
interface LocalTaggedParticipant {
type: "local";
@@ -10,7 +10,6 @@ import { BehaviorSubject, NEVER } from "rxjs";
import { type Room as LivekitRoom } from "livekit-client";
import EventEmitter from "events";
import fetchMock from "fetch-mock";
import { type LivekitTransport } from "matrix-js-sdk/lib/matrixrtc";
import { logger } from "matrix-js-sdk/lib/logger";
import {
@@ -35,6 +34,7 @@ import {
import { createConnectionManager$ } from "./ConnectionManager.ts";
import { membershipsAndTransports$ } from "../../SessionBehaviors.ts";
import { localRtcMember, testJWTToken } from "../../../utils/test-fixtures.ts";
import { type LivekitTransport } from "../../../LivekitTransport.ts";
// Test the integration of ConnectionManager and MatrixLivekitMerger
+1 -2
View File
@@ -7,10 +7,8 @@ Please see LICENSE in the repository root for full details.
import {
type CallMembership,
type LivekitTransport,
type MatrixRTCSession,
MatrixRTCSessionEvent,
isLivekitTransport,
} from "matrix-js-sdk/lib/matrixrtc";
import { fromEvent } from "rxjs";
@@ -21,6 +19,7 @@ import {
type ObservableScope,
} from "./ObservableScope";
import { type Behavior } from "./Behavior";
import { isLivekitTransport, type LivekitTransport } from "../LivekitTransport";
/**
* Tracks the transports used by ourselves, plus all other MatrixRTC session
+1 -3
View File
@@ -25,8 +25,6 @@ import {
} from "matrix-js-sdk";
import {
CallMembership,
type LivekitFocusSelection,
type LivekitTransport,
type MatrixRTCSession,
MatrixRTCSessionEvent,
type MatrixRTCSessionEventHandlerMap,
@@ -79,6 +77,7 @@ import {
} from "../state/media/RemoteScreenShareViewModel";
import { Connection } from "../state/CallViewModel/remoteMembers/Connection";
import { type SFUConfig } from "../livekit/openIDSFU";
import { type LivekitTransport } from "../LivekitTransport";
export function withFakeTimers(continuation: () => void): void {
vi.useFakeTimers();
@@ -228,7 +227,6 @@ export function mockRtcMembership(
rtcBackendIdentity?: string;
callId?: string;
fociPreferred?: Transport[];
focusActive?: LivekitFocusSelection;
membership?: Partial<SessionMembershipData>;
},
): CallMembership {