From 3cdb452d5dc9748f1010a0d5022795c7cb16032c Mon Sep 17 00:00:00 2001 From: "Timo K." Date: Thu, 8 Oct 2026 12:30:03 +0200 Subject: [PATCH] [SDK] update state structure (less duplication, one state enum) - remove media from LocalMembership file --- sdk/SdkArchitecture.md | 72 ++++--- sdk/dev/main.ts | 13 +- sdk/src/RTCParticipation.ts | 50 +++-- sdk/src/api.ts | 49 +++-- sdk/src/matrixrtc/HomeserverConnected.test.ts | 115 +++++++---- sdk/src/matrixrtc/HomeserverConnected.ts | 40 ++-- sdk/src/matrixrtc/LocalMembership.test.ts | 158 ++++++--------- sdk/src/matrixrtc/LocalMembership.ts | 190 ++++++------------ sdk/src/matrixrtc/status.test.ts | 85 -------- sdk/src/matrixrtc/status.ts | 38 ---- sdk/src/participationState.test.ts | 145 +++++++++++++ sdk/src/participationState.ts | 42 ++++ 12 files changed, 500 insertions(+), 497 deletions(-) delete mode 100644 sdk/src/matrixrtc/status.test.ts delete mode 100644 sdk/src/matrixrtc/status.ts create mode 100644 sdk/src/participationState.test.ts create mode 100644 sdk/src/participationState.ts diff --git a/sdk/SdkArchitecture.md b/sdk/SdkArchitecture.md index 9b28ae2c5..6a6df9f42 100644 --- a/sdk/SdkArchitecture.md +++ b/sdk/SdkArchitecture.md @@ -131,18 +131,18 @@ participation split in [`client-into-slot-session-split-plan.md`](./client-into-slot-session-split-plan.md); the sections below still describe `MatrixRTCClient` until that lands. -| Word | Meaning here | Elsewhere | -| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| slot | an `RTCSlot`: the namespace in a room that memberships join into, `application` plus `id`. It exists while the room does, with nobody in it too. Holds `members$`, its open or closed `status$`, and `join()` | the js-sdk `MatrixRTCSession` is one per slot; the MSC4143 slot event | -| participation | an `RTCParticipation`: the span between our `join()` of a slot and our `leave()`. Holds the connection and its `status$`, `localMember$`, `remoteMembers$`, the connected transports and the data channel. Made by `slot.join()`, never reused | "session" is not used here, because in the js-sdk it means the slot | -| member | an `RTCMember`: one membership in a slot with what the SDK derives from it, `rtcBackendIdentity`, `userId`, `deviceId`, `memberId`, `displayName$`, `avatarUrl$`, `transport$` and `applicationData$`. No media. What the slot hands out in `members$` | the js-sdk `CallMembership` behind it, which never leaves the SDK; Element Call's old "matrixLivekitMember" | -| local member, remote member | `LocalRTCMember` and `RemoteRTCMember`: an `RTCMember` plus its `MemberMedia`, which only a participation can carry. The local one's tracks carry the controls. What the participation hands out in `localMember$` and `remoteMembers$` | LiveKit `LocalParticipant` and `RemoteParticipant`, which never leave the SDK | -| media | a `MemberMedia`: what a member sends once it has arrived on its transport, `tracks$`, null while waiting, and `encryptionError$` beside it. The media backend supplies exactly these two fields per member | Element Call's `MediaViewModel` is a view of it | -| track | a `MediaTrack`: one publication of a member, audio or video, with `source`, `kind`, `id` and the behaviors on it. `LocalAudioMediaTrack` and `LocalVideoMediaTrack` add the controls over our own | LiveKit `TrackPublication` and `Track`, which never leave the SDK | -| publish request | a `PublishRequest`: a source, where to capture it from and how to encode it. Given at the join in `publish`, or later to `publish` on the participation | | -| attach, detach | handing a `