matrix-js-sdk
    Preparing search index...

    Class MatrixRTCSession

    A MatrixRTCSession manages the membership & properties of a MatrixRTC session. This class doesn't deal with media at all, just membership & properties of a session.

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    • This constructs a room session. When using MatrixRTC inside the js-sdk this is expected to be used with the MatrixRTCSessionManager exclusively.

      In cases where you don't use the js-sdk but build on top of another Matrix stack this class can be used standalone to manage a joined MatrixRTC session.

      Parameters

      • client: Pick<
            MatrixClient,
            | "sendEvent"
            | "getUserId"
            | "getDeviceId"
            | "sendStateEvent"
            | "_unstable_sendDelayedStateEvent"
            | "_unstable_updateDelayedEvent"
            | "cancelPendingEvent",
        >

        A subset of the MatrixClient that lets the session interact with the Matrix room.

      • roomSubset: Pick<Room, "roomId" | "getLiveTimeline" | "getVersion" | "hasMembershipState">

        The room this session is attached to. A subset of a js-sdk Room that the session needs.

      • memberships: CallMembership[]

        The list of memberships this session currently has.

      Returns MatrixRTCSession

    Properties

    memberships: CallMembership[]

    The list of memberships this session currently has.

    Accessors

    • get callId(): undefined | string

      The callId (sessionId) of the call.

      It can be undefined since the callId is only known once the first membership joins. The callId is the property that, per definition, groups memberships into one call.

      Returns undefined | string

    • get room(): Room

      WARN: this can in theory only be a subset of the room with the properties required by this class. Outside of tests this most likely will be a full room, however.

      Returns Room

      Relying on a full Room object being available here is an anti-pattern. You should be tracking the room object in your own code and passing it in when needed.

    Methods

    • Get the active focus from the current CallMemberState event

      Returns undefined | Focus

      The focus that is currently in use to connect to this session. This is undefined if the client is not connected to this session.

    • A map of keys used to encrypt and decrypt (we are using a symmetric cipher) given participant's media. This also includes our own key

      Returns IterableIterator<[string, Uint8Array<ArrayBufferLike>[]]>

      This will be made private in a future release.

    • This method is used when the user is not yet connected to the Session but wants to know what focus the users in the session are using to make a decision how it wants/should connect.

      See also getActiveFocus

      Returns undefined | Focus

      The focus which should be used when joining this session.

    • Announces this user and device as joined to the MatrixRTC session, and continues to update the membership event to keep it valid until leaveRoomSession() is called This will not subscribe to updates: remember to call subscribe() separately if desired. This method will return immediately and the session will be joined in the background.

      Parameters

      • fociPreferred: Focus[]

        The list of preferred foci this member proposes to use/knows/has access to. For the livekit case this is a list of foci generated from the homeserver well-known, the current rtc session, or optionally other room members homeserver well known.

      • OptionalfociActive: Focus

        The object representing the active focus. (This depends on the focus type.)

      • OptionaljoinConfig: JoinSessionConfig

        Additional configuration for the joined session.

      Returns void

    • Announces this user and device as having left the MatrixRTC session and stops scheduled updates. This will not unsubscribe from updates: remember to call unsubscribe() separately if desired. The membership update required to leave the session will retry if it fails. Without network connection the promise will never resolve. A timeout can be provided so that there is a guarantee for the promise to resolve.

      Parameters

      • timeout: undefined | number = undefined

      Returns Promise<boolean>

      Whether the membership update was attempted and did not time out.

    • Process m.call.encryption_keys events to track the encryption keys for call participants. This should be called each time the relevant event is received from a room timeline. If the event is malformed then it will be logged and ignored.

      Parameters

      Returns void

    • Returns void

      use onRoomMemberUpdate or onRTCSessionMemberUpdate instead. this should be called when any membership in the call is updated the old name might have implied to only need to call this when your own membership changes.

    • Call this when something changed that may impacts the current MatrixRTC members in this session.

      Returns void

    • Re-emit an EncryptionKeyChanged event for each tracked encryption key. This can be used to export the keys.

      Returns void

    MMNEPVFCICPMFPCPTTAAATR