59 lines
2.5 KiB
TypeScript
59 lines
2.5 KiB
TypeScript
import { type Logger } from "../logger.ts";
|
|
import { type MatrixClient } from "../client.ts";
|
|
import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
|
|
import { type Room } from "../models/room.ts";
|
|
import { MatrixRTCSession } from "./MatrixRTCSession.ts";
|
|
import { type RtcSlotEventContent, type SlotDescription } from "./types.ts";
|
|
export declare enum MatrixRTCSessionManagerEvents {
|
|
SessionStarted = "session_started",
|
|
SessionEnded = "session_ended"
|
|
}
|
|
type EventHandlerMap = {
|
|
[MatrixRTCSessionManagerEvents.SessionStarted]: (roomId: string, session: MatrixRTCSession) => void;
|
|
[MatrixRTCSessionManagerEvents.SessionEnded]: (roomId: string, session: MatrixRTCSession) => void;
|
|
};
|
|
/**
|
|
* Holds all active MatrixRTC session objects and creates new ones as events arrive.
|
|
* One `MatrixRTCSessionManager` is required for each MatrixRTC sessionDescription (application, session id) that the client wants to support.
|
|
* If no application type is specified in the constructor, the default is "m.call".
|
|
*
|
|
* This interface is UNSTABLE and may change without warning.
|
|
*/
|
|
export declare class MatrixRTCSessionManager extends TypedEventEmitter<MatrixRTCSessionManagerEvents, EventHandlerMap> {
|
|
private client;
|
|
private readonly slotDescription;
|
|
private roomSessions;
|
|
private readonly logger;
|
|
constructor(rootLogger: Logger, client: MatrixClient, slotDescription?: SlotDescription);
|
|
start(): void;
|
|
stop(): void;
|
|
/**
|
|
* Gets the main MatrixRTC session for a room, or undefined if there is
|
|
* no current session
|
|
*/
|
|
getActiveRoomSession(room: Room): MatrixRTCSession | undefined;
|
|
/**
|
|
* Reads the current slot state event's content for the given room's session.
|
|
*
|
|
* @returns The slot event's content, or `undefined` if no slot event exists for the session.
|
|
*/
|
|
getRtcSlot(room: Room): RtcSlotEventContent | undefined;
|
|
/**
|
|
* Whether the given room's slot is closed.
|
|
*
|
|
* @returns `true` if the slot is closed, `false` if the slot is open or `undefined`
|
|
* if no slot exists.
|
|
*/
|
|
isSlotClosed(room: Room): boolean | undefined;
|
|
/**
|
|
* Gets the main MatrixRTC session for a room, returning an empty session
|
|
* if no members are currently participating
|
|
*/
|
|
getRoomSession(room: Room): MatrixRTCSession;
|
|
private onRoom;
|
|
private readonly onEvent;
|
|
private readonly onRoomState;
|
|
private refreshRoom;
|
|
}
|
|
export {};
|
|
//# sourceMappingURL=MatrixRTCSessionManager.d.ts.map
|