mirror of
https://github.com/vector-im/element-call.git
synced 2026-10-16 23:45:50 +00:00
Un-hardcode the slot ID
This commit is contained in:
@@ -582,6 +582,7 @@ export function createCallViewModel$(
|
||||
new ECConnectionFactory(
|
||||
client,
|
||||
matrixRoom.roomId,
|
||||
matrixRTCSession.slotId,
|
||||
mediaDevices,
|
||||
trackProcessorState$,
|
||||
livekitKeyProvider,
|
||||
|
||||
@@ -225,6 +225,7 @@ export function withCallViewModel(mode: MatrixRTCMode) {
|
||||
ownMembershipIdentity,
|
||||
client: room.client,
|
||||
roomId: room.roomId,
|
||||
slotId: "m.call#room",
|
||||
livekitRoomFactory,
|
||||
},
|
||||
logger,
|
||||
|
||||
@@ -300,6 +300,7 @@ describe("LocalMembership", () => {
|
||||
scope,
|
||||
...defaultCreateLocalMemberValues,
|
||||
matrixRTCSession: {
|
||||
slotId: "m.call#room",
|
||||
updateCallIntent: vi.fn().mockImplementation(reject),
|
||||
leave: vi.fn(),
|
||||
},
|
||||
|
||||
@@ -153,7 +153,10 @@ interface Props {
|
||||
ownMembershipIdentity: CallMembershipIdentityParts;
|
||||
localTransport$: Observable<UnstableLivekitTransport>;
|
||||
client: ClientDelegationParts & ClientOpenIDParts;
|
||||
matrixRTCSession: Pick<MatrixRTCSession, "updateCallIntent" | "leave">;
|
||||
matrixRTCSession: Pick<
|
||||
MatrixRTCSession,
|
||||
"slotId" | "updateCallIntent" | "leave"
|
||||
>;
|
||||
/** Whether to hide the screen-sharing button. */
|
||||
hideScreensharing: boolean;
|
||||
/** The application hosting Element Call, to be kept informed of join/leave. */
|
||||
@@ -710,6 +713,7 @@ export const createLocalMembership$ = ({
|
||||
client,
|
||||
membership: ownMembershipIdentity,
|
||||
transport: joinParams.transport,
|
||||
slotId: matrixRTCSession.slotId,
|
||||
roomId,
|
||||
delayId,
|
||||
logger,
|
||||
|
||||
@@ -59,6 +59,7 @@ let localParticipantEventEmiter: EventEmitter;
|
||||
let fakeLocalParticipant: MockedObject<LocalParticipant>;
|
||||
|
||||
const ROOM_ID = "!roomID:example.org";
|
||||
const SLOT_ID = "m.call#room";
|
||||
|
||||
const transport: UnstableLivekitTransport = {
|
||||
type: "livekit",
|
||||
@@ -122,6 +123,7 @@ function setupRemoteConnection(): Connection {
|
||||
const opts: ConnectionOpts = {
|
||||
client: client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
role: "subscriber",
|
||||
transport: transport,
|
||||
scope: testScope,
|
||||
@@ -169,6 +171,7 @@ describe("Start connection states", () => {
|
||||
const opts: ConnectionOpts = {
|
||||
client: client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
role: "subscriber",
|
||||
transport: transport,
|
||||
scope: testScope,
|
||||
@@ -187,6 +190,7 @@ describe("Start connection states", () => {
|
||||
const opts: ConnectionOpts = {
|
||||
client: client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
role: "subscriber",
|
||||
transport: transport,
|
||||
scope: testScope,
|
||||
@@ -238,6 +242,7 @@ describe("Start connection states", () => {
|
||||
const opts: ConnectionOpts = {
|
||||
client: client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
role: "subscriber",
|
||||
transport: transport,
|
||||
scope: testScope,
|
||||
@@ -298,6 +303,7 @@ describe("Start connection states", () => {
|
||||
const opts: ConnectionOpts = {
|
||||
client: client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
role: "subscriber",
|
||||
transport: transport,
|
||||
scope: testScope,
|
||||
@@ -537,6 +543,7 @@ describe("remote track logging", () => {
|
||||
{
|
||||
client,
|
||||
roomId: ROOM_ID,
|
||||
slotId: SLOT_ID,
|
||||
role: "subscriber",
|
||||
transport: transport,
|
||||
scope: testScope,
|
||||
|
||||
@@ -53,8 +53,10 @@ export interface ConnectionOpts {
|
||||
transport: UnstableLivekitTransport;
|
||||
/** The Matrix client to use for OpenID and SFU config requests. */
|
||||
client: ClientGetTokenParts & ClientOpenIDParts;
|
||||
/** The room ID this connection is associated with. */
|
||||
/** The ID of the Matrix room in which the session takes place. */
|
||||
roomId: string;
|
||||
/** The ID of the MatrixRTC slot in which the session takes place. */
|
||||
slotId: string;
|
||||
/** The observable scope to use for this connection. */
|
||||
scope: ObservableScope;
|
||||
|
||||
@@ -142,6 +144,7 @@ export class Connection {
|
||||
// TODO: can we just keep the ConnectionOpts object instead of spreading?
|
||||
private readonly client: ClientGetTokenParts & ClientOpenIDParts;
|
||||
private readonly roomId: string;
|
||||
private readonly slotId: string;
|
||||
private readonly logger: Logger;
|
||||
private readonly ownMembershipIdentity: CallMembershipIdentityParts;
|
||||
/**
|
||||
@@ -154,6 +157,7 @@ export class Connection {
|
||||
public constructor(opts: ConnectionOpts, logger: Logger) {
|
||||
this.ownMembershipIdentity = opts.ownMembershipIdentity;
|
||||
this.roomId = opts.roomId;
|
||||
this.slotId = opts.slotId;
|
||||
this.logger = logger.getChild(
|
||||
`[Connection ${JSON.stringify(opts.transport)}]`,
|
||||
);
|
||||
@@ -398,6 +402,7 @@ export class Connection {
|
||||
role: this.role,
|
||||
transport: this.transport,
|
||||
roomId: this.roomId,
|
||||
slotId: this.slotId,
|
||||
logger: this.logger,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,7 +58,8 @@ export class ECConnectionFactory implements ConnectionFactory {
|
||||
* Creates a ConnectionFactory for LiveKit connections.
|
||||
*
|
||||
* @param client - The OpenID client parts for authentication, needed to get openID and JWT tokens.
|
||||
* @param roomId - The current room ID.
|
||||
* @param roomId - The ID of the Matrix room in which the session takes place.
|
||||
* @param slotId - The ID of the MatrixRTC slot in which the session takes place.
|
||||
* @param devices - Used for video/audio out/in capture options.
|
||||
* @param processorState$ - Effects like background blur (only for publishing connection?)
|
||||
* @param livekitKeyProvider - Optional key provider for end-to-end encryption.
|
||||
@@ -68,6 +69,7 @@ export class ECConnectionFactory implements ConnectionFactory {
|
||||
public constructor(
|
||||
private client: ClientGetTokenParts & ClientOpenIDParts,
|
||||
private readonly roomId: string,
|
||||
private readonly slotId: string,
|
||||
private devices: MediaDevices,
|
||||
private processorState$: Behavior<ProcessorState>,
|
||||
livekitKeyProvider: BaseKeyProvider | undefined,
|
||||
@@ -111,6 +113,7 @@ export class ECConnectionFactory implements ConnectionFactory {
|
||||
return new Connection(
|
||||
{
|
||||
roomId: this.roomId,
|
||||
slotId: this.slotId,
|
||||
role,
|
||||
transport,
|
||||
client: this.client,
|
||||
|
||||
@@ -84,6 +84,7 @@ describe("ECConnectionFactory - Audio inputs options", () => {
|
||||
const ecConnectionFactory = new ECConnectionFactory(
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#room",
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
@@ -127,6 +128,7 @@ describe("ECConnectionFactory - ControlledAudioDevice", () => {
|
||||
const ecConnectionFactory = new ECConnectionFactory(
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#room",
|
||||
mockMediaDevices({
|
||||
audioOutput: {
|
||||
available$: constant(new Map<never, never>()),
|
||||
@@ -169,6 +171,7 @@ describe("ECConnectionFactory - Camera quality settings", () => {
|
||||
const ecConnectionFactory = new ECConnectionFactory(
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#room",
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
@@ -207,6 +210,7 @@ describe("ECConnectionFactory - Camera quality settings", () => {
|
||||
const ecConnectionFactory = new ECConnectionFactory(
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#room",
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
@@ -246,6 +250,7 @@ describe("ECConnectionFactory - Camera quality settings", () => {
|
||||
const ecConnectionFactory = new ECConnectionFactory(
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#room",
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
|
||||
@@ -76,6 +76,7 @@ beforeEach(() => {
|
||||
ecConnectionFactory = new ECConnectionFactory(
|
||||
mockClient,
|
||||
"!roomid:example.org",
|
||||
"m.call#room",
|
||||
mockMediaDevices({}),
|
||||
new BehaviorSubject<ProcessorState>({
|
||||
supported: true,
|
||||
|
||||
Reference in New Issue
Block a user