mirror of
https://github.com/vector-im/element-call.git
synced 2026-10-16 23:45:50 +00:00
The session speaks MatrixRTC and sees media through MediaBackend in sdk/src/backend/api.ts. Everything LiveKit lives in sdk/src/backend/livekit/, the only place in the SDK that imports livekit-client; the import boundary rule now enforces that outside sdk/src/backend/ the LiveKit packages appear in type imports only. The seam sits above the connection manager: one connection per transport url is the LiveKit multi-SFU strategy, not a MatrixRTC concept, so a cascading SFU or full mesh replaces the folder, not the session. A backend prepares the local transport the session discovered (the token exchange and the delegation probe, reported as canDelegateDelayedLeave), hands the delayed leave over per delay id, gives the local member one publish switch plus publish/unpublish, builds a remote member's media from its membership and registers that membership's transport for as long as the member lives, and reports its connections for the transport registry, which keys on the raw transport serialised with sorted keys. The backend's context carries no Matrix client (a backend picks what it calls in its own options), no membership list, and no js-sdk session: media keys arrive as a stream replayed on subscribe, and MatrixKeyProvider subscribes to it. The MatrixRTC mode no longer reaches LiveKit; it becomes a tokenEndpoint choice made where the default backend is built. Two behaviour changes ride along. Publishing is one boolean, joined and homeserver reachable, where before a sync hiccup after leave() resumed the upstream of tracks that were meant to stay silent. And ResolvedConnection keeps one ResolvedTransport object per fetch, so a state change no longer reads as a change of what was fetched. MatrixRTCClientOptions gains backend?: MediaBackendFactory, defaulting to createLivekitBackend built from the client options. authenticateWithTransport takes tokenEndpoint instead of matrixRTCMode.
68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
/*
|
|
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.
|
|
*/
|
|
|
|
/**
|
|
* EXPERIMENTAL
|
|
*
|
|
* MatrixRTC sessions with LiveKit media, without Element Call's UI: the call
|
|
* model Element Call's own view model is built on, for hosts that want to
|
|
* build a different one. The design is in `SdkArchitecture.md` next to this
|
|
* file.
|
|
*/
|
|
|
|
export { type Behavior, constant } from "./src/reactive/Behavior";
|
|
export {
|
|
Epoch,
|
|
mapEpoch,
|
|
ObservableScope,
|
|
trackEpoch,
|
|
} from "./src/reactive/ObservableScope";
|
|
export {
|
|
filterBehavior,
|
|
finalizeValue,
|
|
generateItems,
|
|
generateItemsWithEpoch,
|
|
pauseWhen,
|
|
} from "./src/reactive/observable";
|
|
export { E2eeType, type EncryptionSystem } from "./src/encryption";
|
|
export {
|
|
defaultMediaQuality,
|
|
defaultSessionTimings,
|
|
type DelayedLeaveTimings,
|
|
MatrixRTCMode,
|
|
type MediaQuality,
|
|
type SessionTimings,
|
|
} from "./src/config";
|
|
export {
|
|
ErrorCategory,
|
|
ErrorCode,
|
|
FailToGetOpenIdToken,
|
|
FailToStartLivekitConnection,
|
|
InsufficientCapacityError,
|
|
LivekitConnectionError,
|
|
MatrixRTCTransportMissingError,
|
|
MembershipManagerError,
|
|
NoMatrix2AuthorizationService,
|
|
PeerConnectionTimeoutError,
|
|
SFURoomCreationRestrictedError,
|
|
UnknownRTCError,
|
|
} from "./src/errors";
|
|
|
|
export * from "./src/api";
|
|
export * from "./src/backend/api";
|
|
export { trackBySource$, type TrackOfSource } from "./src/utils/tracks";
|
|
export { createMatrixRTCClient } from "./src/session/MatrixRTCClient";
|
|
export {
|
|
createLivekitBackend,
|
|
type LivekitBackendOptions,
|
|
} from "./src/backend/livekit/LivekitBackend";
|
|
// For a developer panel to check a transport url before using it
|
|
export {
|
|
getSFUConfigWithOpenID as authenticateWithTransport,
|
|
type TokenEndpoint,
|
|
} from "./src/backend/livekit/openIDSFU";
|